workerholic 0.0.9 → 0.0.10
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/workerholic/cli.rb +1 -1
- data/lib/workerholic/job_processor.rb +0 -1
- data/lib/workerholic/job_wrapper.rb +1 -1
- data/lib/workerholic/statistics_api.rb +22 -24
- data/lib/workerholic/version.rb +1 -1
- data/pkg/workerholic-0.0.9.gem +0 -0
- data/spec/spec_helper.rb +1 -0
- data/web/application.rb +55 -13
- data/web/public/javascripts/application.js +246 -85
- data/web/public/stylesheets/application.css +2 -26
- data/web/views/details.erb +10 -34
- data/web/views/index.erb +12 -6
- data/web/views/layout.erb +2 -2
- data/web/views/queues.erb +7 -18
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c60653e684ca425eb8e9b2c43031d6d3562622e1
|
4
|
+
data.tar.gz: d86d6698bac0d51a5eb60d93ca452dec46ce84f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02ef85bfd3e961554296487a0eb2bfe5552c6f182a932193c75c8ef64c778ecd68df86b905fea9d45b297e9180aadc7cfbdf0b51b5bd485451115b863bd71e65
|
7
|
+
data.tar.gz: da36f9f48ce7615f6e2e029d04d717403babfb3630111c2c909144124c4b6f478aac93968c467c3c9a72a93b5367a146f272e4287c0a71906116ed1accec1f3c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
workerholic (0.0.
|
4
|
+
workerholic (0.0.9)
|
5
5
|
connection_pool (~> 2.2, >= 2.2.0)
|
6
6
|
redis (~> 3.3, >= 3.3.3)
|
7
7
|
sinatra
|
@@ -45,7 +45,7 @@ GEM
|
|
45
45
|
rack-protection (= 2.0.0)
|
46
46
|
tilt (~> 2.0)
|
47
47
|
slop (3.6.0)
|
48
|
-
tilt (2.0.
|
48
|
+
tilt (2.0.8)
|
49
49
|
|
50
50
|
PLATFORMS
|
51
51
|
ruby
|
data/lib/workerholic/cli.rb
CHANGED
@@ -24,7 +24,7 @@ module Workerholic
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def perform
|
27
|
-
if wrapper == ActiveJob::QueueAdapters::WorkerholicAdapter::JobWrapper
|
27
|
+
if wrapper && wrapper.name == 'ActiveJob::QueueAdapters::WorkerholicAdapter::JobWrapper'
|
28
28
|
wrapper.new.perform(
|
29
29
|
'job_class' => klass,
|
30
30
|
'arguments' => arguments
|
@@ -26,14 +26,14 @@ module Workerholic
|
|
26
26
|
parsed_classes.empty? ? 'No class data is available yet.' : parsed_classes
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.
|
29
|
+
def self.queued_jobs
|
30
30
|
fetched_queues = storage.fetch_queue_names
|
31
31
|
parsed_queues = fetched_queues.map do |queue|
|
32
|
-
|
33
|
-
queues << queue_data
|
32
|
+
[queue, storage.list_length(queue)]
|
34
33
|
end
|
35
34
|
|
36
|
-
(parsed_queues.empty? ? 'No queues data is available yet.': parsed_queues)
|
35
|
+
# (parsed_queues.empty? ? 'No queues data is available yet.': parsed_queues)
|
36
|
+
parsed_queues
|
37
37
|
end
|
38
38
|
|
39
39
|
class << self
|
@@ -46,32 +46,30 @@ module Workerholic
|
|
46
46
|
def logger(message)
|
47
47
|
@log ||= LogManager.new
|
48
48
|
end
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
49
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
def parse_job_classes(job_classes, count_only = true)
|
51
|
+
job_classes.map do |job_class|
|
52
|
+
if count_only
|
53
|
+
self.jobs_per_class(job_class)
|
54
|
+
else
|
55
|
+
self.get_jobs_for_class(job_class)
|
56
|
+
end
|
59
57
|
end
|
60
58
|
end
|
61
|
-
end
|
62
59
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
60
|
+
def get_jobs_for_class(job_class)
|
61
|
+
serialized_jobs = storage.peek_namespace(job_class)
|
62
|
+
deserialized_stats = serialized_jobs.map do |serialized_job|
|
63
|
+
JobSerializer.deserialize_stats(serialized_job)
|
64
|
+
end
|
68
65
|
|
69
|
-
|
70
|
-
|
66
|
+
deserialized_stats << deserialized_stats.size
|
67
|
+
end
|
71
68
|
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
def jobs_per_class(job_class)
|
70
|
+
clean_class_name = job_class.split(':').last
|
71
|
+
[clean_class_name, storage.list_length(job_class)]
|
72
|
+
end
|
75
73
|
end
|
76
74
|
end
|
77
75
|
end
|
data/lib/workerholic/version.rb
CHANGED
Binary file
|
data/spec/spec_helper.rb
CHANGED
data/web/application.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
require 'redis'
|
2
1
|
require 'sinatra'
|
3
|
-
|
2
|
+
|
3
|
+
# require 'sinatra/reloader'
|
4
|
+
require 'json'
|
5
|
+
require 'workerholic'
|
4
6
|
|
5
7
|
get '/' do
|
6
8
|
redirect '/overview'
|
@@ -11,27 +13,67 @@ get '/overview' do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
get '/details' do
|
16
|
+
completed_jobs = Workerholic::StatsAPI.job_statistics( {category: 'completed_jobs', count_only: true} )
|
17
|
+
failed_jobs = Workerholic::StatsAPI.job_statistics( {category: 'failed_jobs', count_only: true} )
|
18
|
+
|
19
|
+
@job_stats = {}
|
20
|
+
@completed_total = 0
|
21
|
+
@failed_total = 0
|
22
|
+
|
23
|
+
completed_jobs.each do |job|
|
24
|
+
@job_stats[job[0]] = { completed: job[1] }
|
25
|
+
@completed_total += job[1]
|
26
|
+
end
|
27
|
+
|
28
|
+
failed_jobs.each do |job|
|
29
|
+
@job_stats[job[0]].merge( { failed: job[1] })
|
30
|
+
@failed_total += job[1]
|
31
|
+
end
|
32
|
+
|
14
33
|
erb :details
|
15
34
|
end
|
16
35
|
|
17
36
|
get '/queues' do
|
37
|
+
binding.pry
|
38
|
+
@queues = Workerholic::StatsAPI.queued_jobs
|
39
|
+
@total = 0
|
40
|
+
@queues.each do |queue|
|
41
|
+
@total += queue[1]
|
42
|
+
end
|
43
|
+
|
18
44
|
erb :queues
|
19
45
|
end
|
20
46
|
|
21
|
-
get '/workers' do
|
22
|
-
|
23
|
-
end
|
47
|
+
# get '/workers' do
|
48
|
+
# erb :workers
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# get '/failed' do
|
52
|
+
# erb :failed
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# get '/scheduled' do
|
56
|
+
# erb :scheduled
|
57
|
+
# end
|
24
58
|
|
25
|
-
get '/
|
26
|
-
|
59
|
+
get '/overview-data' do
|
60
|
+
JSON.generate({
|
61
|
+
completed_jobs: Workerholic::StatsAPI.job_statistics( {category: 'completed_jobs', count_only: true} ),
|
62
|
+
failed_jobs: Workerholic::StatsAPI.job_statistics( {category: 'failed_jobs', count_only: true} ),
|
63
|
+
queued_jobs: Workerholic::StatsAPI.queued_jobs,
|
64
|
+
workers_count: Workerholic.workers_count
|
65
|
+
})
|
27
66
|
end
|
28
67
|
|
29
|
-
get '/
|
30
|
-
|
68
|
+
get '/detail-data' do
|
69
|
+
JSON.generate({
|
70
|
+
completed_jobs: Workerholic::StatsAPI.job_statistics( {category: 'completed_jobs', count_only: true} ),
|
71
|
+
failed_jobs: Workerholic::StatsAPI.job_statistics( {category: 'failed_jobs', count_only: true} )
|
72
|
+
})
|
31
73
|
end
|
32
74
|
|
33
|
-
get '/
|
34
|
-
|
35
|
-
|
36
|
-
|
75
|
+
get '/queue-data' do
|
76
|
+
JSON.generate({
|
77
|
+
queued_jobs: Workerholic::StatsAPI.queued_jobs
|
78
|
+
})
|
37
79
|
end
|
@@ -1,14 +1,127 @@
|
|
1
|
+
var queuedJobsCountHistory = [];
|
2
|
+
var failedJobsCountHistory = [];
|
3
|
+
var jobsCompletedHistory = [];
|
4
|
+
|
1
5
|
$(document).ready(function() {
|
2
6
|
var tab = $(location).attr('href').split('/').pop();
|
3
7
|
var $active = $('a[href=' + tab + ']');
|
8
|
+
|
4
9
|
$active.css('background', '#a2a2a2');
|
5
10
|
$active.css('color', '#fff');
|
6
11
|
|
7
|
-
|
12
|
+
if (tab === 'overview') {
|
13
|
+
getOverviewData();
|
14
|
+
|
15
|
+
setInterval(function() {
|
16
|
+
getOverviewData();
|
17
|
+
}, 5000);
|
18
|
+
}
|
19
|
+
|
20
|
+
if (tab === 'queues') {
|
21
|
+
setInterval(function() {
|
22
|
+
getQueueData();
|
23
|
+
}, 5000);
|
24
|
+
}
|
25
|
+
|
26
|
+
if (tab === 'details') {
|
27
|
+
setInterval(function() {
|
28
|
+
getDetailData();
|
29
|
+
}, 1000);
|
30
|
+
}
|
31
|
+
});
|
32
|
+
|
33
|
+
function getOverviewData() {
|
34
|
+
$.ajax({
|
35
|
+
url: '/overview-data',
|
36
|
+
success: function(data) {
|
37
|
+
var deserializedData = JSON.parse(data);
|
38
|
+
|
39
|
+
var completedJobs = deserializedData.completed_jobs.reduce(function(sum, subArray) {
|
40
|
+
return sum + subArray[1];
|
41
|
+
}, 0);
|
42
|
+
|
43
|
+
var failedJobsCount= deserializedData.failed_jobs.reduce(function(sum, subArray) {
|
44
|
+
return sum + subArray[1];
|
45
|
+
}, 0);
|
46
|
+
|
47
|
+
var queuedJobs = deserializedData.queued_jobs;
|
48
|
+
|
49
|
+
var queuedJobsCount = queuedJobs.reduce(function(sum, queue) {
|
50
|
+
return sum + queue[1];
|
51
|
+
}, 0);
|
52
|
+
|
53
|
+
queuedJobsCountHistory.unshift(queuedJobsCount);
|
54
|
+
failedJobsCountHistory.unshift(failedJobsCount);
|
55
|
+
jobsCompletedHistory.unshift(completedJobs);
|
56
|
+
|
57
|
+
if (queuedJobsCountHistory.length > 13) {
|
58
|
+
queuedJobsCountHistory.pop();
|
59
|
+
failedJobsCountHistory.pop();
|
60
|
+
jobsCompletedHistory.pop();
|
61
|
+
}
|
62
|
+
|
63
|
+
drawChart();
|
64
|
+
|
65
|
+
var workersCount = deserializedData.workers_count;
|
66
|
+
|
67
|
+
$('.completed_jobs').text(completedJobs);
|
68
|
+
$('.failed_jobs').text(failedJobsCount);
|
69
|
+
$('.queue_count').text(queuedJobs.length);
|
70
|
+
$('.queued_jobs_count').text(queuedJobsCount);
|
71
|
+
$('.workers_count').text(workersCount);
|
72
|
+
}
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
function getQueueData() {
|
77
|
+
$.ajax({
|
78
|
+
url: '/queue-data',
|
79
|
+
success: function(data) {
|
80
|
+
var deserializedData = JSON.parse(data);
|
81
|
+
var queuedJobs = deserializedData.queued_jobs;
|
82
|
+
var total = 0;
|
83
|
+
|
84
|
+
for (var i = 0; i < queuedJobs.length; i++) {
|
85
|
+
$('#queue_name_' + queuedJobs[i][0].split(':').pop()).text(queuedJobs[i][0]);
|
86
|
+
$('#queue_count_' + queuedJobs[i][0].split(':').pop()).text(queuedJobs[i][1]);
|
87
|
+
total = total + queuedJobs[i][1];
|
88
|
+
}
|
89
|
+
|
90
|
+
$('#queue_total').text(total);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
}
|
94
|
+
|
95
|
+
function getDetailData() {
|
96
|
+
$.ajax({
|
97
|
+
url: '/detail-data',
|
98
|
+
success: function(data) {
|
99
|
+
var deserializedData = JSON.parse(data);
|
100
|
+
var completedJobs = deserializedData.completed_jobs;
|
101
|
+
var failedJobs = deserializedData.failed_jobs;
|
102
|
+
var completedTotal = 0;
|
103
|
+
var failedTotal = 0;
|
104
|
+
|
105
|
+
completedJobs.forEach(function(job) {
|
106
|
+
$('#completed_' + job[0]).text(job[1]);
|
107
|
+
completedTotal = completedTotal + job[1];
|
108
|
+
});
|
8
109
|
|
9
|
-
|
110
|
+
failedJobs.forEach(function(job) {
|
111
|
+
$('#failed_' + job[0]).text(job[1]);
|
112
|
+
failedTotal = failedTotal + job[1];
|
113
|
+
});
|
114
|
+
|
115
|
+
$('#failed_total').text(failedTotal);
|
116
|
+
$('#completed_total').text(completedTotal);
|
117
|
+
}
|
118
|
+
})
|
119
|
+
}
|
120
|
+
|
121
|
+
function drawChart() {
|
122
|
+
var processedJobsChart = new CanvasJS.Chart('jobs_processed_container', {
|
10
123
|
title: {
|
11
|
-
text: '
|
124
|
+
text: 'Jobs Processed',
|
12
125
|
fontSize: 24,
|
13
126
|
},
|
14
127
|
axisX: {
|
@@ -17,93 +130,141 @@ $(document).ready(function() {
|
|
17
130
|
tickColor: 'silver',
|
18
131
|
animationEnabled: true,
|
19
132
|
title: 'Time ago (s)',
|
20
|
-
|
21
|
-
maximum: 65
|
133
|
+
maximum: 60
|
22
134
|
},
|
23
135
|
toolTip: {
|
24
136
|
shared: true
|
25
137
|
},
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
]
|
57
|
-
},
|
58
|
-
{
|
59
|
-
type: "line",
|
60
|
-
showInLegend: true,
|
61
|
-
name: "Finished Jobs",
|
62
|
-
color: "#20B2AA",
|
63
|
-
lineThickness: 2,
|
64
|
-
|
65
|
-
dataPoints: [
|
66
|
-
{ x: '0', y: 430 },
|
67
|
-
{ x: '5', y: 580 },
|
68
|
-
{ x: '10', y: 420 },
|
69
|
-
{ x: '15', y: 110 },
|
70
|
-
{ x: '20', y: 180 },
|
71
|
-
{ x: '25', y: 900 },
|
72
|
-
{ x: '30', y: 510 },
|
73
|
-
{ x: '35', y: 510 },
|
74
|
-
{ x: '40', y: 510 },
|
75
|
-
{ x: '45', y: 510 },
|
76
|
-
{ x: '50', y: 670 },
|
77
|
-
{ x: '55', y: 990 },
|
78
|
-
{ x: '60', y: 240 },
|
79
|
-
]
|
80
|
-
}
|
81
|
-
|
82
|
-
|
83
|
-
],
|
84
|
-
legend: {
|
85
|
-
cursor: "pointer",
|
86
|
-
itemclick: function(e){
|
87
|
-
if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
|
88
|
-
e.dataSeries.visible = false;
|
89
|
-
}
|
90
|
-
else{
|
91
|
-
e.dataSeries.visible = true;
|
92
|
-
}
|
93
|
-
chart.render();
|
94
|
-
}
|
95
|
-
}
|
96
|
-
});
|
138
|
+
theme: "theme2",
|
139
|
+
axisY: {
|
140
|
+
gridColor: "Silver",
|
141
|
+
tickColor: "silver",
|
142
|
+
title: 'Jobs'
|
143
|
+
},
|
144
|
+
data: [{
|
145
|
+
type: "line",
|
146
|
+
showInLegend: true,
|
147
|
+
name: "Jobs completed",
|
148
|
+
color: "blue",
|
149
|
+
markerType: 'circle',
|
150
|
+
lineThickness: 2,
|
151
|
+
dataPoints: [
|
152
|
+
{ x: '0', y: jobsCompletedHistory[0] },
|
153
|
+
{ x: '5', y: jobsCompletedHistory[1] },
|
154
|
+
{ x: '10', y: jobsCompletedHistory[2] },
|
155
|
+
{ x: '15', y: jobsCompletedHistory[3] },
|
156
|
+
{ x: '20', y: jobsCompletedHistory[4] },
|
157
|
+
{ x: '25', y: jobsCompletedHistory[5] },
|
158
|
+
{ x: '30', y: jobsCompletedHistory[6] },
|
159
|
+
{ x: '35', y: jobsCompletedHistory[7] },
|
160
|
+
{ x: '40', y: jobsCompletedHistory[8] },
|
161
|
+
{ x: '45', y: jobsCompletedHistory[9] },
|
162
|
+
{ x: '50', y: jobsCompletedHistory[10] },
|
163
|
+
{ x: '55', y: jobsCompletedHistory[11] },
|
164
|
+
{ x: '60', y: jobsCompletedHistory[12] },
|
165
|
+
]
|
166
|
+
}]
|
167
|
+
});
|
97
168
|
|
98
|
-
|
99
|
-
|
169
|
+
var queuedJobsChart = new CanvasJS.Chart('queued_jobs_container', {
|
170
|
+
title: {
|
171
|
+
text: 'Queued Jobs',
|
172
|
+
fontSize: 24,
|
173
|
+
},
|
174
|
+
axisX: {
|
175
|
+
reversed: true,
|
176
|
+
gridColor: 'Silver',
|
177
|
+
tickColor: 'silver',
|
178
|
+
animationEnabled: true,
|
179
|
+
title: 'Time ago (s)',
|
180
|
+
// minimum: 0,
|
181
|
+
maximum: 60
|
182
|
+
},
|
183
|
+
toolTip: {
|
184
|
+
shared: true
|
185
|
+
},
|
186
|
+
theme: "theme2",
|
187
|
+
axisY: {
|
188
|
+
gridColor: "Silver",
|
189
|
+
tickColor: "silver",
|
190
|
+
title: 'Jobs'
|
191
|
+
},
|
192
|
+
data: [{
|
193
|
+
type: "line",
|
194
|
+
showInLegend: true,
|
195
|
+
lineThickness: 2,
|
196
|
+
name: "Queued Jobs",
|
197
|
+
markerType: "circle",
|
198
|
+
color: "#F08080",
|
199
|
+
dataPoints: [
|
200
|
+
{ x: '0', y: queuedJobsCountHistory[0] },
|
201
|
+
{ x: '5', y: queuedJobsCountHistory[1] },
|
202
|
+
{ x: '10', y: queuedJobsCountHistory[2] },
|
203
|
+
{ x: '15', y: queuedJobsCountHistory[3] },
|
204
|
+
{ x: '20', y: queuedJobsCountHistory[4] },
|
205
|
+
{ x: '25', y: queuedJobsCountHistory[5] },
|
206
|
+
{ x: '30', y: queuedJobsCountHistory[6] },
|
207
|
+
{ x: '35', y: queuedJobsCountHistory[7] },
|
208
|
+
{ x: '40', y: queuedJobsCountHistory[8] },
|
209
|
+
{ x: '45', y: queuedJobsCountHistory[9] },
|
210
|
+
{ x: '50', y: queuedJobsCountHistory[10] },
|
211
|
+
{ x: '55', y: queuedJobsCountHistory[11] },
|
212
|
+
{ x: '60', y: queuedJobsCountHistory[12] },
|
213
|
+
]
|
214
|
+
},
|
215
|
+
],
|
216
|
+
});
|
100
217
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
218
|
+
var failedJobsChart = new CanvasJS.Chart('failed_jobs_container', {
|
219
|
+
title: {
|
220
|
+
text: 'Failed Jobs',
|
221
|
+
fontSize: 24,
|
222
|
+
},
|
223
|
+
axisX: {
|
224
|
+
reversed: true,
|
225
|
+
gridColor: 'Silver',
|
226
|
+
tickColor: 'silver',
|
227
|
+
animationEnabled: true,
|
228
|
+
title: 'Time ago (s)',
|
229
|
+
// minimum: 0,
|
230
|
+
maximum: 60
|
231
|
+
},
|
232
|
+
toolTip: {
|
233
|
+
shared: true
|
234
|
+
},
|
235
|
+
theme: "theme2",
|
236
|
+
axisY: {
|
237
|
+
gridColor: "Silver",
|
238
|
+
tickColor: "silver",
|
239
|
+
title: 'Jobs'
|
240
|
+
},
|
241
|
+
data: [{
|
242
|
+
type: "line",
|
243
|
+
showInLegend: true,
|
244
|
+
name: "Failed Jobs",
|
245
|
+
color: "#20B2AA",
|
246
|
+
markerType: 'circle',
|
247
|
+
lineThickness: 2,
|
248
|
+
dataPoints: [
|
249
|
+
{ x: '0', y: failedJobsCountHistory[0] },
|
250
|
+
{ x: '5', y: failedJobsCountHistory[1] },
|
251
|
+
{ x: '10', y: failedJobsCountHistory[2] },
|
252
|
+
{ x: '15', y: failedJobsCountHistory[3] },
|
253
|
+
{ x: '20', y: failedJobsCountHistory[4] },
|
254
|
+
{ x: '25', y: failedJobsCountHistory[5] },
|
255
|
+
{ x: '30', y: failedJobsCountHistory[6] },
|
256
|
+
{ x: '35', y: failedJobsCountHistory[7] },
|
257
|
+
{ x: '40', y: failedJobsCountHistory[8] },
|
258
|
+
{ x: '45', y: failedJobsCountHistory[9] },
|
259
|
+
{ x: '50', y: failedJobsCountHistory[10] },
|
260
|
+
{ x: '55', y: failedJobsCountHistory[11] },
|
261
|
+
{ x: '60', y: failedJobsCountHistory[12] },
|
262
|
+
]
|
263
|
+
},
|
264
|
+
]
|
108
265
|
});
|
266
|
+
|
267
|
+
queuedJobsChart.render();
|
268
|
+
failedJobsChart.render();
|
269
|
+
processedJobsChart.render();
|
109
270
|
}
|
@@ -66,30 +66,6 @@ nav a:hover {
|
|
66
66
|
width: 200px;
|
67
67
|
}
|
68
68
|
|
69
|
-
#
|
70
|
-
|
71
|
-
width: 1000px;
|
72
|
-
padding: 25px;
|
73
|
-
margin: 50px auto;
|
74
|
-
border: 2px dotted #000;
|
75
|
-
border-radius: 10px;
|
76
|
-
background: #fff;
|
77
|
-
}
|
78
|
-
|
79
|
-
#statistics h2 {
|
80
|
-
font-size: 32px;
|
81
|
-
}
|
82
|
-
|
83
|
-
#statistics p {
|
84
|
-
font-size: 24px;
|
85
|
-
margin-top: 20px;
|
86
|
-
}
|
87
|
-
|
88
|
-
#completed {
|
89
|
-
color: green;
|
90
|
-
}
|
91
|
-
|
92
|
-
#failed {
|
93
|
-
color: red;
|
94
|
-
font-weight: bold;
|
69
|
+
#queued_jobs_container, #failed_jobs_container, #jobs_processed_container {
|
70
|
+
margin-top: 50px;
|
95
71
|
}
|
data/web/views/details.erb
CHANGED
@@ -2,48 +2,24 @@
|
|
2
2
|
<thead>
|
3
3
|
<tr>
|
4
4
|
<th>Class</th>
|
5
|
-
<th>Enqueued</th>
|
6
5
|
<th>Failed</th>
|
7
6
|
<th>Completed</th>
|
8
|
-
<th>Total</th>
|
9
7
|
</tr>
|
10
8
|
</thead>
|
11
9
|
|
12
10
|
<tbody>
|
13
|
-
|
14
|
-
<
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<td>JobTestSlow</td>
|
22
|
-
<td>1,833,222</td>
|
23
|
-
<td>171,882</td>
|
24
|
-
<td>22,198,122</td>
|
25
|
-
<td>24,123,233</td>
|
26
|
-
</tr>
|
27
|
-
<tr>
|
28
|
-
<td>GetPrime</td>
|
29
|
-
<td>1,833,222</td>
|
30
|
-
<td>171,882</td>
|
31
|
-
<td>22,198,122</td>
|
32
|
-
<td>24,123,233</td>
|
33
|
-
</tr>
|
34
|
-
<tr>
|
35
|
-
<td>SendWelcomeEmail</td>
|
36
|
-
<td>1,833,222</td>
|
37
|
-
<td>171,882</td>
|
38
|
-
<td>22,198,122</td>
|
39
|
-
<td>24,123,233</td>
|
40
|
-
</tr>
|
11
|
+
<% @job_stats.each_with_index do |(name, info), i| %>
|
12
|
+
<tr>
|
13
|
+
<td id='job_<%= name %>'><%= name %></td>
|
14
|
+
<td id='failed_<%= name %>'><%= info[:failed] || 0 %></td>
|
15
|
+
<td id='completed_<%= name %>'><%= info[:completed] || 0 %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
|
41
19
|
<tr class='last_row'>
|
42
20
|
<th>Total:</td>
|
43
|
-
<td
|
44
|
-
<td
|
45
|
-
<td>22,198,122</td>
|
46
|
-
<td>24,123,233</td>
|
21
|
+
<td id="failed_total"><%= @failed_total %></td>
|
22
|
+
<td id="completed_total"><%= @completed_total %></td>
|
47
23
|
</tr>
|
48
24
|
</tbody>
|
49
25
|
</table>
|
data/web/views/index.erb
CHANGED
@@ -15,26 +15,32 @@
|
|
15
15
|
<tbody>
|
16
16
|
<tr>
|
17
17
|
<td>Finished Jobs</td>
|
18
|
-
<td class='
|
18
|
+
<td class='completed_jobs'></td>
|
19
19
|
</tr>
|
20
20
|
<tr>
|
21
21
|
<td>Queued Jobs</td>
|
22
|
-
<td class='
|
22
|
+
<td class='queued_jobs_count'></td>
|
23
23
|
</tr>
|
24
24
|
<tr>
|
25
25
|
<td>Failed Jobs</td>
|
26
|
-
<td class='
|
26
|
+
<td class='failed_jobs'></td>
|
27
27
|
</tr>
|
28
28
|
<tr>
|
29
29
|
<td>Number of Queues</td>
|
30
|
-
<td
|
30
|
+
<td class='queue_count'></td>
|
31
31
|
</tr>
|
32
32
|
<tr>
|
33
33
|
<td>Number of Workers</td>
|
34
|
-
<td
|
34
|
+
<td class='workers_count'></td>
|
35
35
|
</tr>
|
36
36
|
</tbody>
|
37
37
|
</table>
|
38
38
|
|
39
|
-
<div id="
|
39
|
+
<div id="queued_jobs_container" style="height: 300px; width: 100%">
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div id="failed_jobs_container" style="height: 300px; width: 100%">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="jobs_processed_container" style="height: 300px; width: 100%">
|
40
46
|
</div>
|
data/web/views/layout.erb
CHANGED
@@ -19,9 +19,9 @@
|
|
19
19
|
<li class='column'><a href='overview'>Overview</a></li>
|
20
20
|
<li class='column'><a href='details'>Job Details</a></li>
|
21
21
|
<li class='column'><a href='queues'>Queues</a></li>
|
22
|
-
<li class='column'><a href='workers'>Workers</a></li>
|
22
|
+
<!-- <li class='column'><a href='workers'>Workers</a></li>
|
23
23
|
<li class='column'><a href='failed'>Failed</a></li>
|
24
|
-
<li class='column'><a href='scheduled'>Scheduled</a></li>
|
24
|
+
<li class='column'><a href='scheduled'>Scheduled</a></li> -->
|
25
25
|
</ul>
|
26
26
|
</nav>
|
27
27
|
|
data/web/views/queues.erb
CHANGED
@@ -3,29 +3,18 @@
|
|
3
3
|
<tr>
|
4
4
|
<th>Queue Name</th>
|
5
5
|
<th>Job Load</th>
|
6
|
-
<th>Worker Count</th>
|
7
|
-
<th>Jobs Processed per second</th>
|
8
6
|
</tr>
|
9
7
|
</thead>
|
10
8
|
|
11
|
-
|
12
|
-
<
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<tr>
|
19
|
-
<td>workerholic:queue:api</td>
|
20
|
-
<td>75,912,999</td>
|
21
|
-
<td>13</td>
|
22
|
-
<td>1233</td>
|
23
|
-
</tr>
|
9
|
+
<% @queues.each_with_index do |queue, i| %>
|
10
|
+
<tr>
|
11
|
+
<td id='queue_name_<%= queue[0].split(':').last %>'><%= queue[0] %></td>
|
12
|
+
<td id='queue_count_<%= queue[0].split(':').last %>'><%= queue[1] %></td>
|
13
|
+
</tr>
|
14
|
+
<% end %>
|
24
15
|
|
25
16
|
<tr class='last_row'>
|
26
17
|
<th>Total:</td>
|
27
|
-
<td
|
28
|
-
<td>25</td>
|
29
|
-
<td>2675</td>
|
18
|
+
<td id="queue_total"><%= @total %></td>
|
30
19
|
</tr>
|
31
20
|
</table>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workerholic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Leclercq
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: redis
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- pkg/workerholic-0.0.6.gem
|
148
148
|
- pkg/workerholic-0.0.7.gem
|
149
149
|
- pkg/workerholic-0.0.8.gem
|
150
|
+
- pkg/workerholic-0.0.9.gem
|
150
151
|
- spec/helpers/helper_methods.rb
|
151
152
|
- spec/helpers/job_tests.rb
|
152
153
|
- spec/integration/dequeuing_and_job_processing_spec.rb
|