resque-web-edge 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +96 -0
  3. data/Rakefile +34 -0
  4. data/app/assets/images/resque_web/idle.png +0 -0
  5. data/app/assets/images/resque_web/lifebuoy.png +0 -0
  6. data/app/assets/images/resque_web/poll.png +0 -0
  7. data/app/assets/images/resque_web/rails.png +0 -0
  8. data/app/assets/images/resque_web/working.png +0 -0
  9. data/app/assets/javascripts/resque_web/application.js +16 -0
  10. data/app/assets/javascripts/resque_web/bootstrap.js.coffee +4 -0
  11. data/app/assets/javascripts/resque_web/failure.js.coffee +7 -0
  12. data/app/assets/javascripts/resque_web/jquery.relative-date.js +47 -0
  13. data/app/assets/javascripts/resque_web/polling.js.coffee +25 -0
  14. data/app/assets/javascripts/resque_web/relative_date.js.coffee +27 -0
  15. data/app/assets/stylesheets/resque_web/application.css +13 -0
  16. data/app/assets/stylesheets/resque_web/bootstrap_and_overrides.css.scss.erb +146 -0
  17. data/app/controllers/resque_web/application_controller.rb +26 -0
  18. data/app/controllers/resque_web/failures_controller.rb +62 -0
  19. data/app/controllers/resque_web/jobs_controller.rb +12 -0
  20. data/app/controllers/resque_web/overview_controller.rb +7 -0
  21. data/app/controllers/resque_web/queues_controller.rb +22 -0
  22. data/app/controllers/resque_web/stats_controller.rb +36 -0
  23. data/app/controllers/resque_web/workers_controller.rb +23 -0
  24. data/app/controllers/resque_web/working_controller.rb +8 -0
  25. data/app/helpers/resque_web/application_helper.rb +69 -0
  26. data/app/helpers/resque_web/failures_helper.rb +58 -0
  27. data/app/helpers/resque_web/overview_helper.rb +6 -0
  28. data/app/helpers/resque_web/queues_helper.rb +72 -0
  29. data/app/helpers/resque_web/stats_helper.rb +54 -0
  30. data/app/helpers/resque_web/workers_helper.rb +16 -0
  31. data/app/helpers/resque_web/working_helper.rb +19 -0
  32. data/app/views/layouts/resque_web/application.html.erb +75 -0
  33. data/app/views/resque_web/failures/_failed_job.html.erb +53 -0
  34. data/app/views/resque_web/failures/_overview.html.erb +24 -0
  35. data/app/views/resque_web/failures/index.html.erb +32 -0
  36. data/app/views/resque_web/failures/show.html.erb +20 -0
  37. data/app/views/resque_web/overview/show.html.erb +4 -0
  38. data/app/views/resque_web/queues/_queues.html.erb +4 -0
  39. data/app/views/resque_web/queues/_queues_advanced.html.erb +14 -0
  40. data/app/views/resque_web/queues/_queues_basic.html.erb +17 -0
  41. data/app/views/resque_web/queues/index.html.erb +1 -0
  42. data/app/views/resque_web/queues/show.html.erb +39 -0
  43. data/app/views/resque_web/stats/key.html.erb +26 -0
  44. data/app/views/resque_web/stats/keys.html.erb +17 -0
  45. data/app/views/resque_web/stats/redis.html.erb +14 -0
  46. data/app/views/resque_web/stats/resque.html.erb +14 -0
  47. data/app/views/resque_web/workers/index.html.erb +19 -0
  48. data/app/views/resque_web/workers/show.html.erb +38 -0
  49. data/app/views/resque_web/working/_working.html.erb +34 -0
  50. data/app/views/resque_web/working/index.html.erb +1 -0
  51. data/config/initializers/resque_config.rb +13 -0
  52. data/config/routes.rb +35 -0
  53. data/lib/resque_web.rb +4 -0
  54. data/lib/resque_web/engine.rb +13 -0
  55. data/lib/resque_web/version.rb +3 -0
  56. data/test/dummy/Rakefile +6 -0
  57. data/test/dummy/app/assets/javascripts/application.js +13 -0
  58. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  59. data/test/dummy/app/controllers/application_controller.rb +5 -0
  60. data/test/dummy/app/helpers/application_helper.rb +2 -0
  61. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  62. data/test/dummy/bin/bundle +3 -0
  63. data/test/dummy/bin/rails +4 -0
  64. data/test/dummy/bin/rake +4 -0
  65. data/test/dummy/config.ru +4 -0
  66. data/test/dummy/config/application.rb +23 -0
  67. data/test/dummy/config/boot.rb +5 -0
  68. data/test/dummy/config/database.yml +25 -0
  69. data/test/dummy/config/environment.rb +5 -0
  70. data/test/dummy/config/environments/development.rb +29 -0
  71. data/test/dummy/config/environments/production.rb +80 -0
  72. data/test/dummy/config/environments/test.rb +36 -0
  73. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  74. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  75. data/test/dummy/config/initializers/inflections.rb +16 -0
  76. data/test/dummy/config/initializers/mime_types.rb +5 -0
  77. data/test/dummy/config/initializers/secret_token.rb +12 -0
  78. data/test/dummy/config/initializers/session_store.rb +3 -0
  79. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  80. data/test/dummy/config/locales/en.yml +23 -0
  81. data/test/dummy/config/routes.rb +4 -0
  82. data/test/dummy/db/schema.rb +16 -0
  83. data/test/dummy/public/404.html +58 -0
  84. data/test/dummy/public/422.html +58 -0
  85. data/test/dummy/public/500.html +57 -0
  86. data/test/dummy/public/favicon.ico +0 -0
  87. data/test/functional/failures_controller_test.rb +74 -0
  88. data/test/functional/jobs_controller_test.rb +45 -0
  89. data/test/functional/overview_controller_test.rb +37 -0
  90. data/test/functional/queues_controller_test.rb +58 -0
  91. data/test/functional/stats_controller_test.rb +70 -0
  92. data/test/functional/workers_controller_test.rb +26 -0
  93. data/test/functional/working_controller_test.rb +19 -0
  94. data/test/integration/plugin_integration_test.rb +72 -0
  95. data/test/support/controller_test_helpers.rb +22 -0
  96. data/test/test_helper.rb +26 -0
  97. data/test/unit/helpers/failures_helper_test.rb +15 -0
  98. data/test/unit/helpers/jobs_helper_test.rb +4 -0
  99. data/test/unit/helpers/overview_helper_test.rb +4 -0
  100. data/test/unit/helpers/queues_helper_test.rb +4 -0
  101. data/test/unit/helpers/retry_controller_helper_test.rb +4 -0
  102. data/test/unit/helpers/stats_helper_test.rb +4 -0
  103. data/test/unit/helpers/workers_helper_test.rb +4 -0
  104. data/test/unit/helpers/working_helper_test.rb +4 -0
  105. metadata +267 -0
@@ -0,0 +1,16 @@
1
+ module ResqueWeb
2
+ module WorkersHelper
3
+ def worker_hosts
4
+ @worker_hosts ||= begin
5
+ hosts = Hash.new { [] }
6
+
7
+ Resque.workers.each do |worker|
8
+ host, _ = worker.to_s.split(':')
9
+ hosts[host] += [worker.to_s]
10
+ end
11
+
12
+ hosts
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ module ResqueWeb
2
+ module WorkingHelper
3
+ def workers
4
+ @workers ||= Resque.workers
5
+ end
6
+
7
+ def jobs
8
+ @jobs ||= workers.map(&:job)
9
+ end
10
+
11
+ def worker_jobs
12
+ @worker_jobs ||= workers.zip(jobs).reject { |w, j| w.idle? || j['queue'].nil? }
13
+ end
14
+
15
+ def sorted_worker_jobs
16
+ @sorted_worker_jobs ||= worker_jobs.sort_by { |w, j| j['run_at'] || '' }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,75 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <meta name="description" content="">
7
+ <meta name="viewport" content="width=device-width">
8
+ <title>Resque.</title>
9
+ <%= stylesheet_link_tag "resque_web/application", :media => "all" %>
10
+ <%=
11
+ ResqueWeb::Plugins.plugins.collect do |p|
12
+ if Rails.application.assets.find_asset("#{p.name.underscore.downcase}/application.css")
13
+ stylesheet_link_tag "#{p.name.underscore.downcase}/application"
14
+ end
15
+ end.join("\n").html_safe
16
+ %>
17
+ <%= javascript_include_tag "resque_web/application" %>
18
+ <%=
19
+ ResqueWeb::Plugins.plugins.collect do |p|
20
+ if Rails.application.assets.find_asset("#{p.name.underscore.downcase}/application.js")
21
+ javascript_include_tag "#{p.name.underscore.downcase}/application"
22
+ end
23
+ end.join("\n").html_safe
24
+ %>
25
+ <%= csrf_meta_tags %>
26
+ </head>
27
+ <body>
28
+
29
+ <div class="navbar navbar-inverse navbar-fixed-top">
30
+ <div class="navbar-inner">
31
+ <div class="container">
32
+ <a class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
33
+ <span class="icon-bar"></span>
34
+ <span class="icon-bar"></span>
35
+ <span class="icon-bar"></span>
36
+ </a>
37
+ <%= image_tag "resque_web/lifebuoy.png", class: 'logo' %>
38
+ <%= link_to "Resque", ResqueWeb::Engine.app.url_helpers.root_path, :class => "brand navbar-brand" %>
39
+ <div class="nav-collapse navbar-collapse collapse">
40
+ <ul class="nav navbar-nav">
41
+ <% tabs.each do |tab_name,path| %>
42
+ <%= tab tab_name,path %>
43
+ <% end %>
44
+ </ul>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+
50
+ <% unless subtabs.empty? %>
51
+ <ul class="nav subnav">
52
+ <div class="container">
53
+ <% subtabs.each do |tab_name| %>
54
+ <%= subtab tab_name %>
55
+ <% end %>
56
+ </div>
57
+ </ul>
58
+ <% end %>
59
+
60
+ <div class="container" id="main">
61
+ <% flash.each do |key, message| %>
62
+ <div class="alert alert-<%= key %>"><%= message %></div>
63
+ <% end %>
64
+ <%= yield %>
65
+ </div>
66
+
67
+ <footer id="footer">
68
+ <div class="container">
69
+ <p>Powered by <a href="http://github.com/resque/resque">Resque</a> v<%=Resque::Version%></p>
70
+ <p>Connected to Redis namespace <%= Resque.redis.namespace %> on <%=Resque.redis_id%></p>
71
+ </div>
72
+ </footer>
73
+
74
+ </body>
75
+ </html>
@@ -0,0 +1,53 @@
1
+ <li>
2
+ <dl>
3
+ <% if job.nil? %>
4
+ <dt>Error</dt>
5
+ <dd>Job <%= id %> could not be parsed; perhaps it contains invalid JSON?</dd>
6
+ <% else %>
7
+ <dt>Worker</dt>
8
+ <dd>
9
+ <%= job['worker'].split(':')[0...2].join(':') %>
10
+ on <b class="label label-info"><%= job['queue'] %></b >
11
+ at <b><span class="time"><%= Time.parse(job['failed_at']).strftime(failure_date_format) %></span></b>
12
+
13
+ <% if job['retried_at'] %>
14
+ <div class="retried">
15
+ Retried <b><span class="time"><%= Time.parse(job['retried_at']).strftime(failure_date_format) %></span></b>
16
+ <%= link_to "Remove", failure_path(:queue=>failure_queue,:id=>id), :method => :delete, :class => 'remove', :rel => 'remove' %>
17
+ </div>
18
+ <% else %>
19
+ <div class="controls">
20
+ <%= link_to "Retry", retry_failure_path(:queue=>failure_queue,:id=>id), :method => :put %>
21
+ or
22
+ <%= link_to "Remove", failure_path(:queue=>failure_queue,:id=>id), :method => :delete %>
23
+ </div>
24
+ <% end %>
25
+ </dd>
26
+ <dt>Class</dt>
27
+ <dd>
28
+ <% if job['payload'] && job['payload']['class'] %>
29
+ <%= link_to failures_path(:class=>job['payload']['class'],:queue=>params[:queue]) do %>
30
+ <code><%= job['payload']['class'] %></code>
31
+ <% end %>
32
+ <% else %>
33
+ <code>nil</code>
34
+ <% end %>
35
+ </dd>
36
+ <dt>Arguments</dt>
37
+ <dd><pre><%= job_arguments(job) %></pre></dd>
38
+ <dt>Exception</dt>
39
+ <dd><code><%= job['exception'] %></code></dd>
40
+ <dt>Error</dt>
41
+ <dd class="error">
42
+ <% if job['backtrace'] %>
43
+ <a href="#" class="backtrace"><%= job['error'] %></a>
44
+ <pre style='display:none'><%=h job['backtrace'].join("\n") %></pre>
45
+ <% else %>
46
+ <%=h job['error'] %>
47
+ <% end %>
48
+ </dd>
49
+ <% end %>
50
+ </dl>
51
+ <div class="r">
52
+ </div>
53
+ </li>
@@ -0,0 +1,24 @@
1
+ <table class="table table-bordered" id="failed">
2
+ <tbody>
3
+ <tr class="total">
4
+ <td class="queue">Total Failed</td>
5
+ <td class="center"><%= Resque::Failure.count %></td>
6
+ </tr>
7
+
8
+ <% Resque::Failure.queues.sort.each do |queue| %>
9
+ <tr>
10
+ <th><%= link_to queue, failure_path(queue), :class => 'label label-info' %></th>
11
+ <th style="width:75px;" class="center"><%= Resque::Failure.count(queue) %></th>
12
+ </tr>
13
+
14
+ <% failure_class_counts(queue).each do |klass, count| %>
15
+ <tr id="<%= klass %>">
16
+ <td>
17
+ <%= link_to klass, failure_path(queue, :class => klass), :class => "failed failed_class" %>
18
+ </td>
19
+ <td style="text-align: center;" class="failed<%= (count.to_i > 1000) ? '_many' : '' %>"><%= count %></td>
20
+ </tr>
21
+ <% end %>
22
+ <% end %>
23
+ </tbody>
24
+ </table>
@@ -0,0 +1,32 @@
1
+ <% if multiple_failure_queues? && !params[:queue] %>
2
+ <h1>All Failure Queues</h1>
3
+ <% else %>
4
+ <h1>Failed Jobs <%= "on '#{params[:queue]}'" if params[:queue] %> <%= "with class '#{params[:class]}'" if params[:class] %></h1>
5
+ <% end %>
6
+
7
+ <% unless failure_size.zero? %>
8
+ <%= form_tag(destroy_all_failures_path(queue: params[:queue]), method: :delete) do %>
9
+ <%= submit_tag "Clear #{failure_queue_name} Jobs", class: 'btn btn-danger', data: { confirm: "Are you sure you want to clear ALL #{failure_queue_name.downcase} jobs?" } %>
10
+ <% if failure_size > failure_per_page %>
11
+ <%= link_to "Last page &raquo;".html_safe, { start: (failure_size - failure_per_page) }, class: 'btn' %>
12
+ <% end %>
13
+ <% end %>
14
+ <%= form_tag(retry_all_failures_path(queue: params[:queue]), method: :put) do %>
15
+ <%= submit_tag "Retry #{failure_queue_name} Jobs", class: 'btn', data: { confirm: "Are you sure you want to retry ALL #{failure_queue_name.downcase} jobs?" } %>
16
+ <% end %>
17
+ <% end %>
18
+
19
+ <% if multiple_failure_queues? && !params[:queue] %>
20
+ <p class="sub"><b><%= Resque::Failure.queues.size %></b> failure queues total</sub>
21
+ <%= render partial: 'overview' %>
22
+ <% else %>
23
+ <p class="sub">Showing <%= failure_start_at %> to <%= failure_end_at %> of <b><%= failure_size %></b> jobs</p>
24
+
25
+ <ul class="failed">
26
+ <% each_failure do |id, job| %>
27
+ <%= render partial: 'failed_job', locals: { id: id, job: job } %>
28
+ <% end %>
29
+ </ul>
30
+
31
+ <%= pagination(start: failure_start_at, total: failure_size) unless params[:class] %>
32
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <h1>Failed Jobs <%= "on '#{params[:id]}'" if params[:id] %> <%= "with class '#{params[:class]}'" if params[:class] %></h1>
2
+
3
+ <% if @jobs.any? %>
4
+ <%= form_tag("/failures/#{params[:id] if params[:id]}", :method => :delete) do %>
5
+ <%= submit_tag "Clear #{params[:id] ? "'#{params[:id]}'" : 'Failed'} Jobs", :confirm => "Are you sure?", :class => 'btn btn-danger' %>
6
+ <% end %>
7
+ <%= form_tag("/failures/#{params[:id] ? params[:id] : "all"}/retry") do %>
8
+ <%= submit_tag "Retry #{params[:id] ? "'#{params[:id]}'" : 'Failed'} Jobs", :class => 'btn' %>
9
+ <% end %>
10
+ <% end %>
11
+
12
+ <p class="sub">Showing <%= failure_start_at %> to <%= failure_end_at %> of <b><%= failure_size %></b> jobs</p>
13
+
14
+ <ul class="failed">
15
+ <% @jobs.each do |id, job| %>
16
+ <%= render :partial => 'failed_job', :locals => {:id => id, :job => job} %>
17
+ <% end %>
18
+ </ul>
19
+
20
+ <%= pagination :start => failure_start_at, :total => failure_size unless params[:class] %>
@@ -0,0 +1,4 @@
1
+ <%= render 'resque_web/queues/queues' %>
2
+ <hr>
3
+ <%= render 'resque_web/working/working' %>
4
+ <%= poll(polling) %>
@@ -0,0 +1,4 @@
1
+ <h1>Queues</h1>
2
+ <p class="intro">The list below contains all the registered queues with the number of jobs currently in the queue. Select a queue from above to view all jobs currently pending on the queue.</p>
3
+
4
+ <%= render :partial => queues_partial_name %>
@@ -0,0 +1,14 @@
1
+ <table class="table table-bordered queues">
2
+ <tr>
3
+ <th>Name</th>
4
+ <th>Jobs</th>
5
+ <th>Failures</th>
6
+ </tr>
7
+ <% queue_names.each do |queue_name| %>
8
+ <tr>
9
+ <td class="queue"><%= link_to queue_name, queue_path(queue_name) %></td>
10
+ <td class="size"><%= queue_size(queue_name) %></td>
11
+ <td class="failure"><%= failed_queue_info(queue_name) %></td>
12
+ </tr>
13
+ <% end %>
14
+ </table>
@@ -0,0 +1,17 @@
1
+ <table class="table table-bordered queues">
2
+ <tr>
3
+ <th>Name</th>
4
+ <th>Jobs</th>
5
+ </tr>
6
+ <% queue_names.each do |queue_name| %>
7
+ <tr>
8
+ <td class="queue"><%= link_to queue_name, queue_path(queue_name) %></td>
9
+ <td class="size"><%= queue_size(queue_name) %></td>
10
+ </tr>
11
+ <% end %>
12
+
13
+ <tr class="<%= failed_queue_class('failed') %> first_failure">
14
+ <td class="queue failed"><%= link_to 'failed', failures_path, :class => 'queue' %></td>
15
+ <td class="size"><%= failed_queue_size('failed') %></td>
16
+ </tr>
17
+ </table>
@@ -0,0 +1 @@
1
+ <%= render 'queues' %>
@@ -0,0 +1,39 @@
1
+ <h1>Pending jobs on <span class='hl'><%= params[:id] %></span></h1>
2
+
3
+ <%= form_tag(clear_queue_path(params[:id]), :method => :put) do %>
4
+ <%= submit_tag "Clear Pending Jobs", :class => 'btn btn-danger', :data => { :confirm => "Are you absolutely sure? This cannot be undone." } %>
5
+ <% end %>
6
+
7
+ <%= form_tag(queue_path(params[:id]), :method => :delete, :class => 'remove-queue') do %>
8
+ <%= submit_tag "Remove Queue", :class => 'btn btn-danger', :data => { :confirm => "Are you absolutely sure? This cannot be undone." } %>
9
+ <% end %>
10
+
11
+ <p class="sub">Showing <%= queue_start_at %> to <%= queue_end_at %> of <b><%= queue_size %></b> jobs</p>
12
+ <table class="table table-bordered jobs">
13
+ <tr>
14
+ <th>Class</th>
15
+ <th>Args</th>
16
+ <th>Actions</th>
17
+ </tr>
18
+ <% queue_jobs.each do |job| %>
19
+ <tr>
20
+ <td class='class'><%= job['class'] %></td>
21
+ <td class='args'><%=h job['args'].inspect %></td>
22
+ <td class='actions'>
23
+ <%= form_tag(job_path(job['class']), :method => :delete) do %>
24
+ <%= hidden_field_tag :queue, params[:id] %>
25
+ <%= hidden_field_tag :job_class, job['class'] %>
26
+ <%= hidden_field_tag :args, JSON.dump(job['args']) %>
27
+ <%= submit_tag "Delete", :class => 'btn btn-default' %>
28
+ <% end %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ <% if queue_jobs.empty? %>
33
+ <tr>
34
+ <td class='no-data' colspan='2'>There are no pending jobs in this queue</td>
35
+ </tr>
36
+ <% end %>
37
+ </table>
38
+
39
+ <%= pagination :start => queue_start_at, :total => queue_size %>
@@ -0,0 +1,26 @@
1
+ <% if redis_key_type(params[:key]) == 'string' %>
2
+ <h1>Key "<%= params[:id] %>" is a string</h1>
3
+ <h2>size: <%= redis_key_size(params[:id]) %></h2>
4
+ <table class="table table-bordered">
5
+ <tr>
6
+ <td><%= redis_get_array(key) %></td>
7
+ </tr>
8
+ </table>
9
+ <% else %>
10
+ <p class="sub">
11
+ Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = redis_key_size(params[:id]) %></b>
12
+ </p>
13
+
14
+ <h1>Key "<%= params[:id] %>" is a <%= redis_key_type(params[:id]) %></h1>
15
+ <table class="table table-bordered">
16
+ <% redis_get_array(params[:id], start).each do |row| %>
17
+ <tr>
18
+ <td>
19
+ <%= row %>
20
+ </td>
21
+ </tr>
22
+ <% end %>
23
+ </table>
24
+
25
+ <%= pagination :start => start, :total => size %>
26
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <h1>Keys owned by <%= Resque %></h1>
2
+ <p class="sub">(All keys are actually prefixed with "<%= Resque.redis.namespace %>:")</p>
3
+
4
+ <table class="table table-bordered stats">
5
+ <tr>
6
+ <th>key</th>
7
+ <th>type</th>
8
+ <th>size</th>
9
+ </tr>
10
+ <% Resque.keys.sort.each do |key| %>
11
+ <tr>
12
+ <th><%= link_to key, statistic_path("keys", key) %></th>
13
+ <td><%= redis_key_type key %></td>
14
+ <td><%= redis_key_size key %></td>
15
+ </tr>
16
+ <% end %>
17
+ </table>
@@ -0,0 +1,14 @@
1
+ <h1><%= Resque.redis_id %></h1>
2
+
3
+ <table class="table table-bordered stats">
4
+ <% redis_info.each do |key, value| %>
5
+ <tr>
6
+ <th>
7
+ <%= key %>
8
+ </th>
9
+ <td>
10
+ <%= value %>
11
+ </td>
12
+ </tr>
13
+ <% end %>
14
+ </table>
@@ -0,0 +1,14 @@
1
+ <h1><%= Resque %></h1>
2
+
3
+ <table class="table table-bordered stats">
4
+ <% resque_info.each do |key, value| %>
5
+ <tr>
6
+ <th>
7
+ <%= key %>
8
+ </th>
9
+ <td>
10
+ <%= value %>
11
+ </td>
12
+ </tr>
13
+ <% end %>
14
+ </table>
@@ -0,0 +1,19 @@
1
+ <h1 class="wi">Workers</h1>
2
+ <p class="intro">The hostnames below all have registered workers. Select a hostname to view its workers, or "all" to see all workers.</p>
3
+
4
+ <table class="table table-bordered queues">
5
+ <tr>
6
+ <th>Hostname</th>
7
+ <th>Workers</th>
8
+ </tr>
9
+ <% worker_hosts.each do |hostname, workers| %>
10
+ <tr>
11
+ <td class="queue"><%= link_to hostname, worker_path(hostname), :class => 'queue' %></td>
12
+ <td class="size"><%= workers.size %></td>
13
+ </tr>
14
+ <% end %>
15
+ <tr class="failed">
16
+ <td class="queue failed"><%= link_to "all workers", worker_path('all'), :class => 'queue' %></td>
17
+ <td class="size"><%= Resque.workers.size %></td>
18
+ </tr>
19
+ </table>
@@ -0,0 +1,38 @@
1
+ <h1 class="wi"><%= @workers.size %> Workers</h1>
2
+ <p class="intro">The workers listed below are all registered as active on your system.</p>
3
+
4
+ <table class="table table-bordered workers">
5
+ <tr>
6
+ <th>&nbsp;</th>
7
+ <th>Where</th>
8
+ <th>Queues</th>
9
+ <th>Processing</th>
10
+ </tr>
11
+ <% @workers.each do |worker| %>
12
+ <tr class="<% worker.state %>">
13
+ <td class="icon"><%= image_tag "resque_web/#{worker.state}.png", :alt => worker.state, :title => worker.state %></td>
14
+
15
+ <% host, pid, queues = worker.to_s.split(':') %>
16
+ <td class="where"><%= host %>:<%= pid %></td>
17
+ <td class="queues">
18
+ <% queues.split(',').each do |queue_name| %>
19
+ <%= link_to queue_name, queue_path(queue_name), :class => 'label label-info' %>
20
+ <% end %>
21
+ </td>
22
+ <td class="process">
23
+ <% data = worker.processing || {} %>
24
+ <% if data['queue'] %>
25
+ <code><%= data['payload']['class'] %></code>
26
+ <small><%= data['run_at'] %></small>
27
+ <% else %>
28
+ <span class="waiting">Waiting for a job...</span>
29
+ <% end %>
30
+ </td>
31
+ </tr>
32
+ <% end %>
33
+ <% if @workers.empty? %>
34
+ <tr>
35
+ <td colspan="4" class="no-data">There are no registered workers</td>
36
+ </tr>
37
+ <% end %>
38
+ </table>