nfo-resque-mongo 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.md +259 -0
- data/LICENSE +20 -0
- data/README.markdown +828 -0
- data/Rakefile +73 -0
- data/bin/resque +75 -0
- data/bin/resque-web +23 -0
- data/lib/resque/errors.rb +10 -0
- data/lib/resque/failure/base.rb +74 -0
- data/lib/resque/failure/hoptoad.rb +139 -0
- data/lib/resque/failure/mongo.rb +92 -0
- data/lib/resque/failure/multiple.rb +60 -0
- data/lib/resque/failure.rb +82 -0
- data/lib/resque/helpers.rb +79 -0
- data/lib/resque/job.rb +228 -0
- data/lib/resque/plugin.rb +51 -0
- data/lib/resque/queue_stats.rb +58 -0
- data/lib/resque/server/public/idle.png +0 -0
- data/lib/resque/server/public/jquery-1.3.2.min.js +19 -0
- data/lib/resque/server/public/jquery.relatize_date.js +95 -0
- data/lib/resque/server/public/poll.png +0 -0
- data/lib/resque/server/public/ranger.js +73 -0
- data/lib/resque/server/public/reset.css +48 -0
- data/lib/resque/server/public/style.css +86 -0
- data/lib/resque/server/public/working.png +0 -0
- data/lib/resque/server/test_helper.rb +19 -0
- data/lib/resque/server/views/error.erb +1 -0
- data/lib/resque/server/views/failed.erb +75 -0
- data/lib/resque/server/views/key_sets.erb +19 -0
- data/lib/resque/server/views/key_string.erb +11 -0
- data/lib/resque/server/views/layout.erb +38 -0
- data/lib/resque/server/views/next_more.erb +19 -0
- data/lib/resque/server/views/overview.erb +4 -0
- data/lib/resque/server/views/queues.erb +49 -0
- data/lib/resque/server/views/stats.erb +62 -0
- data/lib/resque/server/views/workers.erb +109 -0
- data/lib/resque/server/views/working.erb +68 -0
- data/lib/resque/server.rb +222 -0
- data/lib/resque/stat.rb +55 -0
- data/lib/resque/tasks.rb +42 -0
- data/lib/resque/version.rb +3 -0
- data/lib/resque/worker.rb +524 -0
- data/lib/resque.rb +384 -0
- data/tasks/redis.rake +161 -0
- data/tasks/resque.rake +2 -0
- data/test/dump.rdb +0 -0
- data/test/job_hooks_test.rb +323 -0
- data/test/job_plugins_test.rb +230 -0
- data/test/plugin_test.rb +116 -0
- data/test/queue_stats_test.rb +57 -0
- data/test/redis-test.conf +115 -0
- data/test/resque-web_test.rb +48 -0
- data/test/resque_test.rb +256 -0
- data/test/test_helper.rb +151 -0
- data/test/worker_test.rb +356 -0
- metadata +166 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rack/test'
|
2
|
+
require 'resque/server'
|
3
|
+
|
4
|
+
module Resque
|
5
|
+
module TestHelper
|
6
|
+
class Test::Unit::TestCase
|
7
|
+
include Rack::Test::Methods
|
8
|
+
def app
|
9
|
+
Resque::Server.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.should_respond_with_success
|
13
|
+
test "should respond with success" do
|
14
|
+
assert last_response.ok?, last_response.errors
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1 style="font-size:110%;font-family:Arial, sans-serif;"><%= error %></h1>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<%start = params[:start].to_i %>
|
2
|
+
<%count = params[:count] ? params[:count].to_i : 50 %>
|
3
|
+
|
4
|
+
<%if params[:q].nil?%>
|
5
|
+
<% failed = [Resque::Failure.all(start, count)].flatten %>
|
6
|
+
<% size = Resque::Failure.count %>
|
7
|
+
<h1>Failed Jobs</h1>
|
8
|
+
<%else%>
|
9
|
+
<% failed = [Resque::Failure.search_results(params[:q], start, count)].flatten %>
|
10
|
+
<% size = Resque::Failure.search_count %>
|
11
|
+
<h1>Search Results</h1>
|
12
|
+
<%end%>
|
13
|
+
<% index = 0 %>
|
14
|
+
|
15
|
+
<%unless failed.empty?%>
|
16
|
+
<form method="POST" action="<%=u 'failed/clear'%>" class="clear-failed" style="display: none">
|
17
|
+
<input type='submit' name='' value='Clear Failed Jobs' />
|
18
|
+
</form>
|
19
|
+
<form method="GET" action="<%=u 'failed'%>">
|
20
|
+
<input type='text' name='q'>
|
21
|
+
<input type='submit' name='' value='Search' />
|
22
|
+
</form>
|
23
|
+
<%end%>
|
24
|
+
|
25
|
+
<p class='sub'>Showing <%=start%> to <%= start + failed.size %> of <b><%= size %></b> jobs</p>
|
26
|
+
|
27
|
+
<ul class='failed'>
|
28
|
+
<%for job in failed%>
|
29
|
+
<% index += 1 %>
|
30
|
+
<li>
|
31
|
+
<dl>
|
32
|
+
<% if job.nil? %>
|
33
|
+
<dt>Error</dt>
|
34
|
+
<dd>Job <%= index%> could not be parsed; perhaps it contains invalid JSON?</dd>
|
35
|
+
<% else %>
|
36
|
+
<dt>Worker</dt>
|
37
|
+
<dd>
|
38
|
+
<a href="<%= u(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= job['failed_at'] %></span></b>
|
39
|
+
<% if job['retried_at'] %>
|
40
|
+
<div class='retried'>
|
41
|
+
Retried <b><span class="time"><%= job['retried_at'] %></span></b>
|
42
|
+
<a href="<%= u "failed/remove/#{start + index - 1}" %>" class="remove" rel="remove">Remove</a>
|
43
|
+
</div>
|
44
|
+
<% else %>
|
45
|
+
<div class='controls'>
|
46
|
+
<a href="<%= u "failed/requeue/#{start + index - 1}" %>" rel="retry">Retry</a>
|
47
|
+
or
|
48
|
+
<a href="<%= u "failed/remove/#{start + index - 1}" %>" rel="remove">Remove</a>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
51
|
+
</dd>
|
52
|
+
<dt>Class</dt>
|
53
|
+
<dd><code><%= job['payload'] ? job['payload']['class'] : 'nil' %></code></dd>
|
54
|
+
<dt>Arguments</dt>
|
55
|
+
<dd><pre><%=h job['payload'] ? show_args(job['payload']['args']) : 'nil' %></pre></dd>
|
56
|
+
<dt>Exception</dt>
|
57
|
+
<dd><code><%= job['exception'] %></code></dd>
|
58
|
+
<dt>Error</dt>
|
59
|
+
<dd class='error'>
|
60
|
+
<% if job['backtrace'] %>
|
61
|
+
<a href="#" class="backtrace"><%= h(job['error']) %></a>
|
62
|
+
<pre style='display:none'><%=h job['backtrace'].join("\n") %></pre>
|
63
|
+
<% else %>
|
64
|
+
<%=h job['error'] %>
|
65
|
+
<% end %>
|
66
|
+
</dd>
|
67
|
+
<% end %>
|
68
|
+
</dl>
|
69
|
+
<div class='r'>
|
70
|
+
</div>
|
71
|
+
</li>
|
72
|
+
<%end%>
|
73
|
+
</ul>
|
74
|
+
|
75
|
+
<%= partial :next_more, :start => start, :count => count, :size => size, :params => params %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% if key = params[:key] %>
|
2
|
+
|
3
|
+
<p class='sub'>
|
4
|
+
Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = redis_get_size(key) %></b>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<h1>Key "<%= key %>" is a <%= resque.redis.type key %></h1>
|
8
|
+
<table>
|
9
|
+
<% for row in redis_get_value_as_array(key, start) %>
|
10
|
+
<tr>
|
11
|
+
<td>
|
12
|
+
<%= row %>
|
13
|
+
</td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
</table>
|
17
|
+
|
18
|
+
<%= partial :next_more, :start => start, :size => size %>
|
19
|
+
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Resque</title>
|
5
|
+
<link href="<%=u 'reset.css' %>" media="screen" rel="stylesheet" type="text/css">
|
6
|
+
<link href="<%=u 'style.css' %>" media="screen" rel="stylesheet" type="text/css">
|
7
|
+
<script src="<%=u 'jquery-1.3.2.min.js' %>" type="text/javascript"></script>
|
8
|
+
<script src="<%=u 'jquery.relatize_date.js' %>" type="text/javascript"></script>
|
9
|
+
<script src="<%=u 'ranger.js' %>" type="text/javascript"></script>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div class="header">
|
13
|
+
<ul class='nav'>
|
14
|
+
<% tabs.each do |tab_name| %>
|
15
|
+
<%= tab tab_name %>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<% if @subtabs %>
|
21
|
+
<ul class='subnav'>
|
22
|
+
<% for subtab in @subtabs %>
|
23
|
+
<li <%= class_if_current "#{current_section}/#{subtab}" %>><a href="<%= current_section %>/<%= subtab %>"><span><%= subtab %></span></a></li>
|
24
|
+
<% end %>
|
25
|
+
</ul>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<div id="main">
|
29
|
+
<%= yield %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div id="footer">
|
33
|
+
<p>Powered by a fork of <a href="http://github.com/defunkt/resque">Resque</a> v<%=Resque::Version%></p>
|
34
|
+
<p>Connected to MongoDB on <%= "#{Resque.mongo.db.connection.primary[0]}:#{Resque.mongo.db.connection.primary[1]}/#{Resque.mongo.db.name}/#{Resque.mongo.name}" if Resque.mongo %> </p>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%count = count || 50 %>
|
2
|
+
<%if start - count >= 0 || start + count <= size%>
|
3
|
+
<p class='pagination'>
|
4
|
+
<% if start - count >= 0 %>
|
5
|
+
<% if params[:q].nil? %>
|
6
|
+
<a href="<%= current_page %>?start=<%= start - count %>" class='less'>« less</a>
|
7
|
+
<% else %>
|
8
|
+
<a href="<%= current_page %>?start=<%= start - count %>&q=<%= params[:q] %>" class='less'>« less</a>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% if start + count <= size %>
|
12
|
+
<% if params[:q].nil? %>
|
13
|
+
<a href="<%= current_page %>?start=<%= start + count %>" class='more'>more »</a>
|
14
|
+
<% else %>
|
15
|
+
<a href="<%= current_page %>?start=<%= start + count %>&q=<%= params[:q] %>" class='more'>more »</a>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
</p>
|
19
|
+
<%end%>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<% @subtabs = resque.queues unless partial? || params[:id].nil? %>
|
2
|
+
|
3
|
+
<% if queue = params[:id] %>
|
4
|
+
|
5
|
+
<h1>Pending jobs on <span class='hl'><%= queue %></span></h1>
|
6
|
+
<form method="POST" action="<%=u "/queues/#{queue}/remove" %>" class='remove-queue'>
|
7
|
+
<input type='submit' name='' value='Remove Queue' />
|
8
|
+
</form>
|
9
|
+
<p class='sub'>Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = resque.size(queue)%></b> jobs</p>
|
10
|
+
<table class='jobs'>
|
11
|
+
<tr>
|
12
|
+
<th>Class</th>
|
13
|
+
<th>Args</th>
|
14
|
+
</tr>
|
15
|
+
<% for job in (jobs = resque.peek(queue, start, 20)) %>
|
16
|
+
<tr>
|
17
|
+
<td class='class'><%= job['class'] %></td>
|
18
|
+
<td class='args'><%=h job['args'].inspect %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
<% if jobs.empty? %>
|
22
|
+
<tr>
|
23
|
+
<td class='no-data' colspan='2'>There are no pending jobs in this queue</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</table>
|
27
|
+
<%= partial :next_more, :start => start, :size => size %>
|
28
|
+
<% else %>
|
29
|
+
|
30
|
+
<h1 class='wi'>Queues</h1>
|
31
|
+
<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>
|
32
|
+
<table class='queues'>
|
33
|
+
<tr>
|
34
|
+
<th>Name</th>
|
35
|
+
<th>Jobs</th>
|
36
|
+
</tr>
|
37
|
+
<% for queue in resque.queues.sort_by { |q| q.to_s } %>
|
38
|
+
<tr>
|
39
|
+
<td class='queue'><a class="queue" href="<%= u "queues/#{queue}" %>"><%= queue %></a></td>
|
40
|
+
<td class='size'><%= resque.size queue %></td>
|
41
|
+
</tr>
|
42
|
+
<% end %>
|
43
|
+
<tr class="<%= Resque::Failure.count.zero? ? "failed" : "failure" %>">
|
44
|
+
<td class='queue failed'><a class="queue" href="<%= u :failed %>">failed</a></td>
|
45
|
+
<td class='size'><%= Resque::Failure.count %></td>
|
46
|
+
</tr>
|
47
|
+
</table>
|
48
|
+
|
49
|
+
<% end %>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<% @subtabs = %w( resque ) %>
|
2
|
+
|
3
|
+
<% if params[:key] %>
|
4
|
+
|
5
|
+
<%= partial resque.redis.type(params[:key]).eql?("string") ? :key_string : :key_sets %>
|
6
|
+
|
7
|
+
<% elsif params[:id] == "resque" %>
|
8
|
+
|
9
|
+
<h1><%= resque %></h1>
|
10
|
+
<table class='stats'>
|
11
|
+
<% for key, value in resque.info.to_a.sort_by { |i| i[0].to_s } %>
|
12
|
+
<tr>
|
13
|
+
<th>
|
14
|
+
<%= key %>
|
15
|
+
</th>
|
16
|
+
<td>
|
17
|
+
<%= value %>
|
18
|
+
</td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<% elsif params[:id] == 'redis' %>
|
24
|
+
|
25
|
+
<h1><%= resque.redis_id %></h1>
|
26
|
+
<table class='stats'>
|
27
|
+
<% for key, value in resque.redis.info.to_a.sort_by { |i| i[0].to_s } %>
|
28
|
+
<tr>
|
29
|
+
<th>
|
30
|
+
<%= key %>
|
31
|
+
</th>
|
32
|
+
<td>
|
33
|
+
<%= value %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
<% end %>
|
37
|
+
</table>
|
38
|
+
|
39
|
+
<% elsif params[:id] == 'keys' %>
|
40
|
+
|
41
|
+
<h1>Keys owned by <%= resque %></h1>
|
42
|
+
<p class='sub'>(All keys are actually prefixed with "<%= Resque.redis.namespace %>:")</p>
|
43
|
+
<table class='stats'>
|
44
|
+
<tr>
|
45
|
+
<th>key</th>
|
46
|
+
<th>type</th>
|
47
|
+
<th>size</th>
|
48
|
+
</tr>
|
49
|
+
<% for key in resque.keys.sort %>
|
50
|
+
<tr>
|
51
|
+
<th>
|
52
|
+
<a href="<%=u "/stats/keys/#{key}" %>"><%= key %></a>
|
53
|
+
</th>
|
54
|
+
<td><%= resque.redis.type key %></td>
|
55
|
+
<td><%= redis_get_size key %></td>
|
56
|
+
</tr>
|
57
|
+
<% end %>
|
58
|
+
</table>
|
59
|
+
|
60
|
+
<% else %>
|
61
|
+
|
62
|
+
<% end %>
|
@@ -0,0 +1,109 @@
|
|
1
|
+
<% @subtabs = worker_hosts.keys.sort unless worker_hosts.size == 1 %>
|
2
|
+
|
3
|
+
<% if params[:id] && worker = Resque::Worker.find(params[:id]) %>
|
4
|
+
|
5
|
+
<h1>Worker <%= worker %></h1>
|
6
|
+
<table class='workers'>
|
7
|
+
<tr>
|
8
|
+
<th> </th>
|
9
|
+
<th>Host</th>
|
10
|
+
<th>Pid</th>
|
11
|
+
<th>Started</th>
|
12
|
+
<th>Queues</th>
|
13
|
+
<th>Processed</th>
|
14
|
+
<th>Failed</th>
|
15
|
+
<th>Processing</th>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td class='icon'><img src="<%=u state = worker.state %>.png" alt="<%= state %>" title="<%= state %>"></td>
|
19
|
+
|
20
|
+
<% host, pid, queues = worker.to_s.split(':') %>
|
21
|
+
<td><%= host %></td>
|
22
|
+
<td><%= pid %></td>
|
23
|
+
<td><span class="time"><%= worker.started %></span></td>
|
24
|
+
<td class='queues'><%= queues.split(',').map { |q| '<a class="queue-tag" href="' + u("/queues/#{q}") + '">' + q + '</a>'}.join('') %></td>
|
25
|
+
<td><%= worker.processed %></td>
|
26
|
+
<td><%= worker.failed %></td>
|
27
|
+
<td class='process'>
|
28
|
+
<% data = worker.processing || {} %>
|
29
|
+
<% if data['queue'] %>
|
30
|
+
<code><%= data['payload']['class'] %></code>
|
31
|
+
<small><a class="queue time" href="<%=u "/working/#{worker}" %>"><%= data['run_at'] %></a></small>
|
32
|
+
<% else %>
|
33
|
+
<span class='waiting'>Waiting for a job...</span>
|
34
|
+
<% end %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
</table>
|
38
|
+
|
39
|
+
<% elsif params[:id] && !worker_hosts.keys.include?(params[:id]) && params[:id] != 'all' %>
|
40
|
+
|
41
|
+
<h1>Worker doesn't exist</h1>
|
42
|
+
|
43
|
+
<% elsif worker_hosts.size == 1 || params[:id] %>
|
44
|
+
|
45
|
+
<% if worker_hosts.size == 1 || params[:id] == 'all' %>
|
46
|
+
<% workers = Resque.workers %>
|
47
|
+
<% else %>
|
48
|
+
<% workers = worker_hosts[params[:id]].map { |id| Resque::Worker.find(id) } %>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<h1 class='wi'><%= workers.size %> Workers</h1>
|
52
|
+
<p class='intro'>The workers listed below are all registered as active on your system.</p>
|
53
|
+
<table class='workers'>
|
54
|
+
<tr>
|
55
|
+
<th> </th>
|
56
|
+
<th>Where</th>
|
57
|
+
<th>Queues</th>
|
58
|
+
<th>Processing</th>
|
59
|
+
</tr>
|
60
|
+
<% for worker in (workers = workers.sort_by { |w| w.to_s }) %>
|
61
|
+
<tr class="<%=state = worker.state%>">
|
62
|
+
<td class='icon'><img src="<%=u state %>.png" alt="<%= state %>" title="<%= state %>"></td>
|
63
|
+
|
64
|
+
<% host, pid, queues = worker.to_s.split(':') %>
|
65
|
+
<td class='where'><a href="<%=u "workers/#{worker}"%>"><%= host %>:<%= pid %></a></td>
|
66
|
+
<td class='queues'><%= queues.split(',').map { |q| '<a class="queue-tag" href="' + u("/queues/#{q}") + '">' + q + '</a>'}.join('') %></td>
|
67
|
+
|
68
|
+
<td class='process'>
|
69
|
+
<% data = worker.processing || {} %>
|
70
|
+
<% if data['queue'] %>
|
71
|
+
<code><%= data['payload']['class'] %></code>
|
72
|
+
<small><a class="queue time" href="<%=u "/working/#{worker}" %>"><%= data['run_at'] %></a></small>
|
73
|
+
<% else %>
|
74
|
+
<span class='waiting'>Waiting for a job...</span>
|
75
|
+
<% end %>
|
76
|
+
</td>
|
77
|
+
</tr>
|
78
|
+
<% end %>
|
79
|
+
<% if workers.empty? %>
|
80
|
+
<tr>
|
81
|
+
<td colspan='4' class='no-data'>There are no registered workers</td>
|
82
|
+
</tr>
|
83
|
+
<% end %>
|
84
|
+
</table>
|
85
|
+
<%=poll%>
|
86
|
+
|
87
|
+
<% else %>
|
88
|
+
<% @subtabs = [] %>
|
89
|
+
<h1 class='wi'>Workers</h1>
|
90
|
+
<p class='intro'>The hostnames below all have registered workers. Select a hostname to view its workers, or "all" to see all workers.</p>
|
91
|
+
<table class='queues'>
|
92
|
+
<tr>
|
93
|
+
<th>Hostname</th>
|
94
|
+
<th>Workers</th>
|
95
|
+
</tr>
|
96
|
+
<% for hostname, workers in worker_hosts.sort_by { |h,w| h } %>
|
97
|
+
<tr>
|
98
|
+
<td class='queue'><a class="queue" href="<%= u "workers/#{hostname}" %>"><%= hostname %></a></td>
|
99
|
+
<td class='size'><%= workers.size %></td>
|
100
|
+
</tr>
|
101
|
+
<% end %>
|
102
|
+
<tr class="failed">
|
103
|
+
<td class='queue failed'><a class="queue" href="<%= u "workers/all" %>">all workers</a></td>
|
104
|
+
<td class='size'><%= Resque.workers.size %></td>
|
105
|
+
</tr>
|
106
|
+
</table>
|
107
|
+
|
108
|
+
|
109
|
+
<% end %>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<% if params[:id] && (worker = Resque::Worker.find(params[:id])) && worker.job %>
|
2
|
+
<h1><%= worker %>'s job</h1>
|
3
|
+
|
4
|
+
<table>
|
5
|
+
<tr>
|
6
|
+
<th> </th>
|
7
|
+
<th>Where</th>
|
8
|
+
<th>Queue</th>
|
9
|
+
<th>Started</th>
|
10
|
+
<th>Class</th>
|
11
|
+
<th>Args</th>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td><img src="<%=u 'working.png' %>" alt="working" title="working"></td>
|
15
|
+
<% host, pid, _ = worker.to_s.split(':') %>
|
16
|
+
<td><a href="<%=u "/workers/#{worker}" %>"><%= host %>:<%= pid %></a></td>
|
17
|
+
<% data = worker.job %>
|
18
|
+
<% queue = data['queue'] %>
|
19
|
+
<td><a class="queue" href="<%=u "/queues/#{queue}" %>"><%= queue %></a></td>
|
20
|
+
<td><span class="time"><%= data['run_at'] %></span></td>
|
21
|
+
<td>
|
22
|
+
<code><%= data['payload']['class'] %></code>
|
23
|
+
</td>
|
24
|
+
<td><%=h data['payload']['args'].inspect %></td>
|
25
|
+
</tr>
|
26
|
+
</table>
|
27
|
+
|
28
|
+
<% else %>
|
29
|
+
|
30
|
+
<% workers = resque.working.reject { |w| w.idle? } %>
|
31
|
+
<h1 class='wi'><%= workers.size %> of <%= resque.workers.size %> Workers Working</h1>
|
32
|
+
<p class='intro'>The list below contains all workers which are currently running a job.</p>
|
33
|
+
<table class='workers'>
|
34
|
+
<tr>
|
35
|
+
<th> </th>
|
36
|
+
<th>Where</th>
|
37
|
+
<th>Queue</th>
|
38
|
+
<th>Processing</th>
|
39
|
+
</tr>
|
40
|
+
<% if workers.empty? %>
|
41
|
+
<tr>
|
42
|
+
<td colspan="4" class='no-data'>Nothing is happening right now...</td>
|
43
|
+
</tr>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<% for worker in workers.sort_by { |w| (w && w.job && w.job['run_at']) ? w.job['run_at'] : '' } %>
|
47
|
+
<% job = worker.job %>
|
48
|
+
|
49
|
+
<tr>
|
50
|
+
<td class='icon'><img src="<%=u state = worker.state %>.png" alt="<%= state %>" title="<%= state %>"></td>
|
51
|
+
<% host, pid, queues = worker.to_s.split(':') %>
|
52
|
+
<td class='where'><a href="<%=u "/workers/#{worker}" %>"><%= host %>:<%= pid %></a></td>
|
53
|
+
<td class='queues queue'>
|
54
|
+
<a class="queue-tag" href="<%=u "/queues/#{job['queue']}" %>"><%= job['queue'] %></a>
|
55
|
+
</td>
|
56
|
+
<td class='process'>
|
57
|
+
<% if job['queue'] %>
|
58
|
+
<code><%= job['payload']['class'] %></code>
|
59
|
+
<small><a class="queue time" href="<%=u "/working/#{worker}" %>"><%= job['run_at'] %></a></small>
|
60
|
+
<% else %>
|
61
|
+
<span class='waiting'>Waiting for a job...</span>
|
62
|
+
<% end %>
|
63
|
+
</td>
|
64
|
+
</tr>
|
65
|
+
<% end %>
|
66
|
+
</table>
|
67
|
+
|
68
|
+
<% end %>
|