sidekiq-failures 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +4 -4
- data/README.md +3 -7
- data/lib/sidekiq/failures/middleware.rb +2 -2
- data/lib/sidekiq/failures/version.rb +1 -1
- data/lib/sidekiq/failures/views/failures.erb +60 -0
- data/lib/sidekiq/failures/web_extension.rb +5 -1
- data/sidekiq-failures.gemspec +1 -1
- data/test/middleware_test.rb +66 -11
- metadata +7 -6
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sidekiq-failures (0.2.
|
5
|
-
sidekiq (>= 2.
|
4
|
+
sidekiq-failures (0.2.2)
|
5
|
+
sidekiq (>= 2.9.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -20,9 +20,9 @@ GEM
|
|
20
20
|
rack (>= 1.0)
|
21
21
|
rake (0.9.2.2)
|
22
22
|
redis (3.0.4)
|
23
|
-
redis-namespace (1.3.
|
23
|
+
redis-namespace (1.3.1)
|
24
24
|
redis (~> 3.0.0)
|
25
|
-
sidekiq (2.
|
25
|
+
sidekiq (2.13.0)
|
26
26
|
celluloid (>= 0.14.1)
|
27
27
|
connection_pool (>= 1.0.0)
|
28
28
|
json
|
data/README.md
CHANGED
@@ -24,8 +24,8 @@ jobs will be visible via a Failures tab in the Web UI.
|
|
24
24
|
|
25
25
|
### Maximum Tracked Failures
|
26
26
|
|
27
|
-
Since each failed job/retry creates a new failure entry that will only be removed
|
28
|
-
by you manually, your failures list might consume more resources than you have
|
27
|
+
Since each failed job/retry creates a new failure entry that will only be removed
|
28
|
+
by you manually, your failures list might consume more resources than you have
|
29
29
|
available.
|
30
30
|
|
31
31
|
To avoid this sidekiq-failures adopts a default of 1000 maximum tracked failures.
|
@@ -115,11 +115,7 @@ The valid modes are `:all`, `:exhausted` or `:off`.
|
|
115
115
|
|
116
116
|
## Dependencies
|
117
117
|
|
118
|
-
Depends on Sidekiq >= 2.
|
119
|
-
|
120
|
-
## TODO
|
121
|
-
|
122
|
-
* Allow triggering retry of specific failed jobs via Web UI.
|
118
|
+
Depends on Sidekiq >= 2.9.0
|
123
119
|
|
124
120
|
## Contributing
|
125
121
|
|
@@ -25,9 +25,9 @@ module Sidekiq
|
|
25
25
|
}
|
26
26
|
|
27
27
|
Sidekiq.redis do |conn|
|
28
|
-
conn.
|
28
|
+
conn.lpush(:failed, Sidekiq.dump_json(data))
|
29
29
|
unless Sidekiq.failures_max_count == false
|
30
|
-
conn.ltrim(:failed,
|
30
|
+
conn.ltrim(:failed, 0, Sidekiq.failures_max_count - 1)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<header class="row">
|
2
|
+
<div class="span5">
|
3
|
+
<h3>Failed Jobs</h3>
|
4
|
+
</div>
|
5
|
+
<div class="span4">
|
6
|
+
<% if @messages.size > 0 %>
|
7
|
+
<%= erb :_paging, :locals => { :url => "#{root_path}failures#@name" } %>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
</header>
|
11
|
+
|
12
|
+
<% if @messages.size > 0 %>
|
13
|
+
<table class="table table-striped table-bordered table-white" style="width: 100%; margin: 0; table-layout:fixed;">
|
14
|
+
<thead>
|
15
|
+
<th style="width: 25%">Worker, Args</th>
|
16
|
+
<th style="width: 10%">Queue</th>
|
17
|
+
<th style="width: 15%">Failed At</th>
|
18
|
+
<th style="width: 50%">Exception</th>
|
19
|
+
</thead>
|
20
|
+
<% @messages.each do |msg| %>
|
21
|
+
<tr>
|
22
|
+
<td style="overflow: hidden; text-overflow: ellipsis;">
|
23
|
+
<%= msg['worker'] %>
|
24
|
+
<br />
|
25
|
+
<%= msg['payload']['args'].inspect[0..100] %>
|
26
|
+
</td>
|
27
|
+
<td><%= msg['queue'] %></td>
|
28
|
+
<td>
|
29
|
+
<time datetime="<%= "#{Time.parse(msg['failed_at']).getutc.iso8601}" %>">
|
30
|
+
<%= msg['failed_at'] %>
|
31
|
+
</time>
|
32
|
+
</td>
|
33
|
+
<td style="overflow: auto; padding: 10px;">
|
34
|
+
<a class="backtrace" href="#" onclick="$(this).next().toggle(); return false">
|
35
|
+
<%= msg['exception'] %>: <%= msg['error'] %>
|
36
|
+
</a>
|
37
|
+
<pre style="display: none; background: none; border: 0; width: 100%; max-height: 30em; font-size: 0.8em; white-space: nowrap;">
|
38
|
+
<%= msg['backtrace'].join("<br />") %>
|
39
|
+
</pre>
|
40
|
+
<p>
|
41
|
+
<span>Processor: <%= msg['processor'] %></span>
|
42
|
+
</p>
|
43
|
+
</td>
|
44
|
+
</tr>
|
45
|
+
<% end %>
|
46
|
+
</table>
|
47
|
+
<div class="row">
|
48
|
+
<div class="span5">
|
49
|
+
<form class="form-inline" action="<%= "#{root_path}failures/remove" %>" method="post" style="margin: 20px 0">
|
50
|
+
<input class="btn btn-danger btn-small" type="submit" name="delete" value="Clear All" />
|
51
|
+
<label class="checkbox">
|
52
|
+
<input type="checkbox" name="counter" value="true" />
|
53
|
+
reset failed counter
|
54
|
+
</label>
|
55
|
+
</form>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<% else %>
|
59
|
+
<div class="alert alert-success">No failed jobs found.</div>
|
60
|
+
<% end %>
|
@@ -10,7 +10,11 @@ module Sidekiq
|
|
10
10
|
(@current_page, @total_size, @messages) = page("failed", params[:page], @count)
|
11
11
|
@messages = @messages.map { |msg| Sidekiq.load_json(msg) }
|
12
12
|
|
13
|
-
|
13
|
+
if Sidekiq::VERSION < "2.14.0"
|
14
|
+
render(:slim, File.read(File.join(view_path, "failures.slim")))
|
15
|
+
else
|
16
|
+
render(:erb, File.read(File.join(view_path, "failures.erb")))
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
app.post "/failures/remove" do
|
data/sidekiq-failures.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Sidekiq::Failures::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "sidekiq", ">= 2.
|
18
|
+
gem.add_dependency "sidekiq", ">= 2.9.0"
|
19
19
|
|
20
20
|
gem.add_development_dependency "rake"
|
21
21
|
gem.add_development_dependency "rack-test"
|
data/test/middleware_test.rb
CHANGED
@@ -41,6 +41,11 @@ module Sidekiq
|
|
41
41
|
|
42
42
|
assert_equal 0, failures_count
|
43
43
|
|
44
|
+
actor = MiniTest::Mock.new
|
45
|
+
actor.expect(:processor_done, nil, [@processor])
|
46
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
47
|
+
2.times { @boss.expect(:async, actor, []) }
|
48
|
+
|
44
49
|
assert_raises TestException do
|
45
50
|
@processor.process(msg)
|
46
51
|
end
|
@@ -54,6 +59,11 @@ module Sidekiq
|
|
54
59
|
|
55
60
|
assert_equal 0, failures_count
|
56
61
|
|
62
|
+
actor = MiniTest::Mock.new
|
63
|
+
actor.expect(:processor_done, nil, [@processor])
|
64
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
65
|
+
2.times { @boss.expect(:async, actor, []) }
|
66
|
+
|
57
67
|
assert_raises TestException do
|
58
68
|
@processor.process(msg)
|
59
69
|
end
|
@@ -69,7 +79,9 @@ module Sidekiq
|
|
69
79
|
|
70
80
|
actor = MiniTest::Mock.new
|
71
81
|
actor.expect(:processor_done, nil, [@processor])
|
72
|
-
|
82
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
83
|
+
2.times { @boss.expect(:async, actor, []) }
|
84
|
+
|
73
85
|
@processor.process(msg)
|
74
86
|
@boss.verify
|
75
87
|
|
@@ -82,6 +94,11 @@ module Sidekiq
|
|
82
94
|
|
83
95
|
assert_equal 0, failures_count
|
84
96
|
|
97
|
+
actor = MiniTest::Mock.new
|
98
|
+
actor.expect(:processor_done, nil, [@processor])
|
99
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
100
|
+
2.times { @boss.expect(:async, actor, []) }
|
101
|
+
|
85
102
|
assert_raises TestException do
|
86
103
|
@processor.process(msg)
|
87
104
|
end
|
@@ -97,6 +114,11 @@ module Sidekiq
|
|
97
114
|
|
98
115
|
assert_equal 0, failures_count
|
99
116
|
|
117
|
+
actor = MiniTest::Mock.new
|
118
|
+
actor.expect(:processor_done, nil, [@processor])
|
119
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
120
|
+
2.times { @boss.expect(:async, actor, []) }
|
121
|
+
|
100
122
|
assert_raises TestException do
|
101
123
|
@processor.process(msg)
|
102
124
|
end
|
@@ -111,6 +133,11 @@ module Sidekiq
|
|
111
133
|
|
112
134
|
assert_equal 0, failures_count
|
113
135
|
|
136
|
+
actor = MiniTest::Mock.new
|
137
|
+
actor.expect(:processor_done, nil, [@processor])
|
138
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
139
|
+
2.times { @boss.expect(:async, actor, []) }
|
140
|
+
|
114
141
|
assert_raises TestException do
|
115
142
|
@processor.process(msg)
|
116
143
|
end
|
@@ -124,6 +151,11 @@ module Sidekiq
|
|
124
151
|
|
125
152
|
assert_equal 0, failures_count
|
126
153
|
|
154
|
+
actor = MiniTest::Mock.new
|
155
|
+
actor.expect(:processor_done, nil, [@processor])
|
156
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
157
|
+
2.times { @boss.expect(:async, actor, []) }
|
158
|
+
|
127
159
|
assert_raises TestException do
|
128
160
|
@processor.process(msg)
|
129
161
|
end
|
@@ -133,16 +165,21 @@ module Sidekiq
|
|
133
165
|
end
|
134
166
|
|
135
167
|
it "records failure if retry disabled and configured to track exhaustion" do
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
168
|
+
msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry' => false, 'failures' => 'exhausted')
|
169
|
+
|
170
|
+
assert_equal 0, failures_count
|
171
|
+
|
172
|
+
actor = MiniTest::Mock.new
|
173
|
+
actor.expect(:processor_done, nil, [@processor])
|
174
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
175
|
+
2.times { @boss.expect(:async, actor, []) }
|
176
|
+
|
177
|
+
assert_raises TestException do
|
178
|
+
@processor.process(msg)
|
179
|
+
end
|
143
180
|
|
144
|
-
|
145
|
-
|
181
|
+
assert_equal 1, failures_count
|
182
|
+
assert_equal 1, $invokes
|
146
183
|
end
|
147
184
|
|
148
185
|
it "records failure if retry disabled and configured to track exhaustion by default" do
|
@@ -152,6 +189,11 @@ module Sidekiq
|
|
152
189
|
|
153
190
|
assert_equal 0, failures_count
|
154
191
|
|
192
|
+
actor = MiniTest::Mock.new
|
193
|
+
actor.expect(:processor_done, nil, [@processor])
|
194
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
195
|
+
2.times { @boss.expect(:async, actor, []) }
|
196
|
+
|
155
197
|
assert_raises TestException do
|
156
198
|
@processor.process(msg)
|
157
199
|
end
|
@@ -167,6 +209,11 @@ module Sidekiq
|
|
167
209
|
|
168
210
|
assert_equal 0, failures_count
|
169
211
|
|
212
|
+
actor = MiniTest::Mock.new
|
213
|
+
actor.expect(:processor_done, nil, [@processor])
|
214
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
215
|
+
2.times { @boss.expect(:async, actor, []) }
|
216
|
+
|
170
217
|
assert_raises TestException do
|
171
218
|
@processor.process(msg)
|
172
219
|
end
|
@@ -184,8 +231,16 @@ module Sidekiq
|
|
184
231
|
assert_equal 0, failures_count
|
185
232
|
|
186
233
|
3.times do
|
234
|
+
boss = MiniTest::Mock.new
|
235
|
+
processor = ::Sidekiq::Processor.new(boss)
|
236
|
+
|
237
|
+
actor = MiniTest::Mock.new
|
238
|
+
actor.expect(:processor_done, nil, [processor])
|
239
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
240
|
+
2.times { boss.expect(:async, actor, []) }
|
241
|
+
|
187
242
|
assert_raises TestException do
|
188
|
-
|
243
|
+
processor.process(msg)
|
189
244
|
end
|
190
245
|
end
|
191
246
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-failures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
21
|
+
version: 2.9.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.
|
29
|
+
version: 2.9.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/sidekiq/failures.rb
|
126
126
|
- lib/sidekiq/failures/middleware.rb
|
127
127
|
- lib/sidekiq/failures/version.rb
|
128
|
+
- lib/sidekiq/failures/views/failures.erb
|
128
129
|
- lib/sidekiq/failures/views/failures.slim
|
129
130
|
- lib/sidekiq/failures/web_extension.rb
|
130
131
|
- sidekiq-failures.gemspec
|
@@ -145,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
segments:
|
147
148
|
- 0
|
148
|
-
hash: -
|
149
|
+
hash: -612683227478286431
|
149
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
151
|
none: false
|
151
152
|
requirements:
|
@@ -154,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
155
|
version: '0'
|
155
156
|
segments:
|
156
157
|
- 0
|
157
|
-
hash: -
|
158
|
+
hash: -612683227478286431
|
158
159
|
requirements: []
|
159
160
|
rubyforge_project:
|
160
161
|
rubygems_version: 1.8.23
|