resque_ui 3.0.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/Gemfile +6 -0
- data/Gemfile.lock +102 -0
- data/History.txt +5 -0
- data/MIT-LICENSE +21 -0
- data/README.markdown +279 -0
- data/Rakefile +49 -0
- data/VERSION.yml +5 -0
- data/app/assets/images/idle.png +0 -0
- data/app/assets/images/poll.png +0 -0
- data/app/assets/images/working.png +0 -0
- data/app/assets/javascripts/resque/jquery-1.3.2.min.js +19 -0
- data/app/assets/javascripts/resque/jquery.relatize_date.js +95 -0
- data/app/assets/javascripts/resque/ranger.js +24 -0
- data/app/assets/stylesheets/resque/resque.css +93 -0
- data/app/assets/stylesheets/resque/resque_reset.css +48 -0
- data/app/controllers/resque_controller.rb +236 -0
- data/app/helpers/resque_helper.rb +107 -0
- data/app/views/layouts/resque.html.erb +39 -0
- data/app/views/resque/_key.html.erb +17 -0
- data/app/views/resque/_next_more.html.erb +10 -0
- data/app/views/resque/_queues.html.erb +52 -0
- data/app/views/resque/_status_styles.erb +98 -0
- data/app/views/resque/_workers.html.erb +110 -0
- data/app/views/resque/_working.html.erb +69 -0
- data/app/views/resque/delayed.html.erb +35 -0
- data/app/views/resque/delayed_timestamp.html.erb +26 -0
- data/app/views/resque/error.erb +1 -0
- data/app/views/resque/failed.html.erb +54 -0
- data/app/views/resque/overview.html.erb +4 -0
- data/app/views/resque/schedule.html.erb +96 -0
- data/app/views/resque/stats.html.erb +62 -0
- data/app/views/resque/status.html.erb +57 -0
- data/app/views/resque/statuses.html.erb +72 -0
- data/app/views/resque/workers.html.erb +1 -0
- data/lib/resque_ui/cap.rb +6 -0
- data/lib/resque_ui/cap_recipes.rb +106 -0
- data/lib/resque_ui/overrides/resque/failure/failure.rb +22 -0
- data/lib/resque_ui/overrides/resque/job.rb +12 -0
- data/lib/resque_ui/overrides/resque/resque.rb +8 -0
- data/lib/resque_ui/overrides/resque/worker.rb +230 -0
- data/lib/resque_ui/overrides/resque_scheduler/resque_scheduler.rb +58 -0
- data/lib/resque_ui/overrides/resque_status/chained_job_with_status.rb +24 -0
- data/lib/resque_ui/overrides/resque_status/job_with_status.rb +59 -0
- data/lib/resque_ui/overrides/resque_status/status.rb +53 -0
- data/lib/resque_ui.rb +26 -0
- data/lib/tasks/failure.rake +8 -0
- data/lib/tasks/scheduler.rake +11 -0
- data/lib/tasks/worker.rake +80 -0
- data/rdoc/Resque/ChainedJobWithStatus.html +284 -0
- data/rdoc/Resque/Failure/Base.html +229 -0
- data/rdoc/Resque/Failure.html +202 -0
- data/rdoc/Resque/Job.html +202 -0
- data/rdoc/Resque/JobWithStatus.html +410 -0
- data/rdoc/Resque/Status.html +368 -0
- data/rdoc/Resque/Worker.html +1104 -0
- data/rdoc/Resque.html +232 -0
- data/rdoc/ResqueScheduler.html +434 -0
- data/rdoc/ResqueUi/Cap.html +150 -0
- data/rdoc/ResqueUi/Engine.html +150 -0
- data/rdoc/ResqueUi.html +157 -0
- data/rdoc/created.rid +13 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +163 -0
- data/rdoc/js/darkfish.js +116 -0
- data/rdoc/js/jquery.js +32 -0
- data/rdoc/js/quicksearch.js +114 -0
- data/rdoc/js/thickbox-compressed.js +10 -0
- data/rdoc/lib/resque_overrides_rb.html +54 -0
- data/rdoc/lib/resque_scheduler_overrides_rb.html +52 -0
- data/rdoc/lib/resque_status_overrides_rb.html +52 -0
- data/rdoc/lib/resque_ui/cap_rb.html +52 -0
- data/rdoc/lib/resque_ui/cap_recipes_rb.html +58 -0
- data/rdoc/lib/resque_ui/engine_rb.html +52 -0
- data/rdoc/lib/resque_ui/overrides/resque/failure/failure_rb.html +54 -0
- data/rdoc/lib/resque_ui/overrides/resque/job_rb.html +52 -0
- data/rdoc/lib/resque_ui/overrides/resque/resque_rb.html +52 -0
- data/rdoc/lib/resque_ui/overrides/resque/worker_rb.html +54 -0
- data/rdoc/lib/resque_ui/overrides/resque_scheduler/resque_scheduler_rb.html +52 -0
- data/rdoc/lib/resque_ui/overrides/resque_status/chained_job_with_status_rb.html +52 -0
- data/rdoc/lib/resque_ui/overrides/resque_status/job_with_status_rb.html +52 -0
- data/rdoc/lib/resque_ui/overrides/resque_status/status_rb.html +52 -0
- data/rdoc/lib/resque_ui/resque_ui_rb.html +52 -0
- data/rdoc/lib/resque_ui/tasks_rb.html +64 -0
- data/rdoc/lib/resque_ui_rb.html +76 -0
- data/rdoc/rdoc.css +763 -0
- data/resque_ui.gemspec +153 -0
- data/test/resque_ui_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- metadata +205 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
|
7
|
+
|
|
8
|
+
<title>Class: Resque::JobWithStatus</title>
|
|
9
|
+
|
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
|
11
|
+
|
|
12
|
+
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
|
13
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
|
14
|
+
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
|
15
|
+
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
|
16
|
+
|
|
17
|
+
</head>
|
|
18
|
+
<body id="top" class="class">
|
|
19
|
+
|
|
20
|
+
<div id="metadata">
|
|
21
|
+
<div id="home-metadata">
|
|
22
|
+
<div id="home-section" class="section">
|
|
23
|
+
<h3 class="section-header">
|
|
24
|
+
<a href="../index.html">Home</a>
|
|
25
|
+
<a href="../index.html#classes">Classes</a>
|
|
26
|
+
<a href="../index.html#methods">Methods</a>
|
|
27
|
+
</h3>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div id="file-metadata">
|
|
32
|
+
<div id="file-list-section" class="section">
|
|
33
|
+
<h3 class="section-header">In Files</h3>
|
|
34
|
+
<div class="section-body">
|
|
35
|
+
<ul>
|
|
36
|
+
|
|
37
|
+
<li><a href="../lib/resque_ui/overrides/resque_status/job_with_status_rb.html?TB_iframe=true&height=550&width=785"
|
|
38
|
+
class="thickbox" title="lib/resque_ui/overrides/resque_status/job_with_status.rb">lib/resque_ui/overrides/resque_status/job_with_status.rb</a></li>
|
|
39
|
+
|
|
40
|
+
</ul>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div id="class-metadata">
|
|
48
|
+
|
|
49
|
+
<!-- Parent Class -->
|
|
50
|
+
<div id="parent-class-section" class="section">
|
|
51
|
+
<h3 class="section-header">Parent</h3>
|
|
52
|
+
|
|
53
|
+
<p class="link">Object</p>
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<!-- Method Quickref -->
|
|
64
|
+
<div id="method-list-section" class="section">
|
|
65
|
+
<h3 class="section-header">Methods</h3>
|
|
66
|
+
<ul class="link-list">
|
|
67
|
+
|
|
68
|
+
<li><a href="#method-c-enqueue">::enqueue</a></li>
|
|
69
|
+
|
|
70
|
+
<li><a href="#method-i-counter">#counter</a></li>
|
|
71
|
+
|
|
72
|
+
<li><a href="#method-i-incr_counter">#incr_counter</a></li>
|
|
73
|
+
|
|
74
|
+
<li><a href="#method-i-name">#name</a></li>
|
|
75
|
+
|
|
76
|
+
<li><a href="#method-i-safe_perform-21">#safe_perform!</a></li>
|
|
77
|
+
|
|
78
|
+
<li><a href="#method-i-tick">#tick</a></li>
|
|
79
|
+
|
|
80
|
+
</ul>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div id="project-metadata">
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
<div id="classindex-section" class="section project-section">
|
|
92
|
+
<h3 class="section-header">Class/Module Index
|
|
93
|
+
<span class="search-toggle"><img src="../images/find.png"
|
|
94
|
+
height="16" width="16" alt="[+]"
|
|
95
|
+
title="show/hide quicksearch" /></span></h3>
|
|
96
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
|
97
|
+
<fieldset>
|
|
98
|
+
<legend>Quicksearch</legend>
|
|
99
|
+
<input type="text" name="quicksearch" value=""
|
|
100
|
+
class="quicksearch-field" />
|
|
101
|
+
</fieldset>
|
|
102
|
+
</form>
|
|
103
|
+
|
|
104
|
+
<ul class="link-list">
|
|
105
|
+
|
|
106
|
+
<li><a href="../Resque.html">Resque</a></li>
|
|
107
|
+
|
|
108
|
+
<li><a href="../Resque/ChainedJobWithStatus.html">Resque::ChainedJobWithStatus</a></li>
|
|
109
|
+
|
|
110
|
+
<li><a href="../Resque/Failure.html">Resque::Failure</a></li>
|
|
111
|
+
|
|
112
|
+
<li><a href="../Resque/Job.html">Resque::Job</a></li>
|
|
113
|
+
|
|
114
|
+
<li><a href="../Resque/JobWithStatus.html">Resque::JobWithStatus</a></li>
|
|
115
|
+
|
|
116
|
+
<li><a href="../Resque/Status.html">Resque::Status</a></li>
|
|
117
|
+
|
|
118
|
+
<li><a href="../Resque/Worker.html">Resque::Worker</a></li>
|
|
119
|
+
|
|
120
|
+
<li><a href="../ResqueUi.html">ResqueUi</a></li>
|
|
121
|
+
|
|
122
|
+
<li><a href="../ResqueUi/Cap.html">ResqueUi::Cap</a></li>
|
|
123
|
+
|
|
124
|
+
<li><a href="../ResqueUi/Engine.html">ResqueUi::Engine</a></li>
|
|
125
|
+
|
|
126
|
+
<li><a href="../ResqueScheduler.html">ResqueScheduler</a></li>
|
|
127
|
+
|
|
128
|
+
</ul>
|
|
129
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div id="documentation">
|
|
137
|
+
<h1 class="class">Resque::JobWithStatus</h1>
|
|
138
|
+
|
|
139
|
+
<div id="description" class="description">
|
|
140
|
+
|
|
141
|
+
</div><!-- description -->
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<!-- Methods -->
|
|
156
|
+
|
|
157
|
+
<div id="public-class-method-details" class="method-section section">
|
|
158
|
+
<h3 class="section-header">Public Class Methods</h3>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<div id="enqueue-method" class="method-detail ">
|
|
162
|
+
<a name="method-c-enqueue"></a>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
<div class="method-heading">
|
|
166
|
+
<span class="method-name">enqueue</span><span
|
|
167
|
+
class="method-args">(klass, options = {})</span>
|
|
168
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
<div class="method-description">
|
|
173
|
+
|
|
174
|
+
<p>Adds a job of type <tt>klass<tt> to the queue with
|
|
175
|
+
<tt>options<tt>. Returns the UUID of the job override to pass
|
|
176
|
+
actual parameters instead of a single hash, to make backward compatible
|
|
177
|
+
with existing resque jobs.</p>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
<div class="method-source-code" id="enqueue-source">
|
|
182
|
+
<pre>
|
|
183
|
+
<span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/job_with_status.rb, line 6</span>
|
|
184
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">enqueue</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">options</span> = {})
|
|
185
|
+
<span class="ruby-identifier">uuid</span> = <span class="ruby-constant">Resque</span><span class="ruby-operator">::</span><span class="ruby-constant">Status</span>.<span class="ruby-identifier">create</span> <span class="ruby-value">:name</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{self.name}: #{options.inspect}"</span>
|
|
186
|
+
<span class="ruby-constant">Resque</span>.<span class="ruby-identifier">enqueue</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">uuid</span>, <span class="ruby-identifier">options</span>)
|
|
187
|
+
<span class="ruby-identifier">uuid</span>
|
|
188
|
+
<span class="ruby-keyword">end</span></pre>
|
|
189
|
+
</div><!-- enqueue-source -->
|
|
190
|
+
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
</div><!-- enqueue-method -->
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
</div><!-- public-class-method-details -->
|
|
200
|
+
|
|
201
|
+
<div id="public-instance-method-details" class="method-section section">
|
|
202
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
<div id="counter-method" class="method-detail ">
|
|
206
|
+
<a name="method-i-counter"></a>
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
<div class="method-heading">
|
|
210
|
+
<span class="method-name">counter</span><span
|
|
211
|
+
class="method-args">(counter)</span>
|
|
212
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<div class="method-description">
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<div class="method-source-code" id="counter-source">
|
|
223
|
+
<pre>
|
|
224
|
+
<span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/job_with_status.rb, line 55</span>
|
|
225
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">counter</span>(<span class="ruby-identifier">counter</span>)
|
|
226
|
+
<span class="ruby-constant">Resque</span><span class="ruby-operator">::</span><span class="ruby-constant">Status</span>.<span class="ruby-identifier">counter</span>(<span class="ruby-identifier">counter</span>, <span class="ruby-identifier">uuid</span>)
|
|
227
|
+
<span class="ruby-keyword">end</span></pre>
|
|
228
|
+
</div><!-- counter-source -->
|
|
229
|
+
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
</div><!-- counter-method -->
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<div id="incr_counter-method" class="method-detail ">
|
|
239
|
+
<a name="method-i-incr_counter"></a>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
<div class="method-heading">
|
|
243
|
+
<span class="method-name">incr_counter</span><span
|
|
244
|
+
class="method-args">(counter)</span>
|
|
245
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
<div class="method-description">
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
<div class="method-source-code" id="incr_counter-source">
|
|
256
|
+
<pre>
|
|
257
|
+
<span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/job_with_status.rb, line 51</span>
|
|
258
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">incr_counter</span>(<span class="ruby-identifier">counter</span>)
|
|
259
|
+
<span class="ruby-constant">Resque</span><span class="ruby-operator">::</span><span class="ruby-constant">Status</span>.<span class="ruby-identifier">incr_counter</span>(<span class="ruby-identifier">counter</span>, <span class="ruby-identifier">uuid</span>)
|
|
260
|
+
<span class="ruby-keyword">end</span></pre>
|
|
261
|
+
</div><!-- incr_counter-source -->
|
|
262
|
+
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
</div><!-- incr_counter-method -->
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
<div id="name-method" class="method-detail ">
|
|
272
|
+
<a name="method-i-name"></a>
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
<div class="method-heading">
|
|
276
|
+
<span class="method-name">name</span><span
|
|
277
|
+
class="method-args">()</span>
|
|
278
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<div class="method-description">
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
<div class="method-source-code" id="name-source">
|
|
289
|
+
<pre>
|
|
290
|
+
<span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/job_with_status.rb, line 47</span>
|
|
291
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>
|
|
292
|
+
<span class="ruby-node">"#{self.class.name}: #{options.inspect}"</span>
|
|
293
|
+
<span class="ruby-keyword">end</span></pre>
|
|
294
|
+
</div><!-- name-source -->
|
|
295
|
+
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
</div><!-- name-method -->
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
<div id="safe_perform-21-method" class="method-detail ">
|
|
305
|
+
<a name="method-i-safe_perform-21"></a>
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
<div class="method-heading">
|
|
309
|
+
<span class="method-name">safe_perform!</span><span
|
|
310
|
+
class="method-args">()</span>
|
|
311
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
<div class="method-description">
|
|
316
|
+
|
|
317
|
+
<p>Run by the <a href="Worker.html">Resque::Worker</a> when processing this
|
|
318
|
+
job. It wraps the <tt>perform</tt> method ensuring that the final status of
|
|
319
|
+
the job is set regardless of error. If an error occurs within the job’s
|
|
320
|
+
work, it will set the status as failed and re-raise the error.</p>
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
<div class="method-source-code" id="safe_perform-21-source">
|
|
325
|
+
<pre>
|
|
326
|
+
<span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/job_with_status.rb, line 25</span>
|
|
327
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">safe_perform!</span>
|
|
328
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">should_kill?</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">status</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">killed?</span>)
|
|
329
|
+
<span class="ruby-identifier">set_status</span>({<span class="ruby-string">'status'</span> =<span class="ruby-operator">></span> <span class="ruby-string">'working'</span>})
|
|
330
|
+
<span class="ruby-identifier">perform</span>
|
|
331
|
+
<span class="ruby-identifier">kill!</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">should_kill?</span>
|
|
332
|
+
<span class="ruby-identifier">completed</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">completed?</span>
|
|
333
|
+
<span class="ruby-identifier">on_success</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:on_success</span>)
|
|
334
|
+
<span class="ruby-keyword">end</span>
|
|
335
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Killed</span>
|
|
336
|
+
<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">"Job #{self} Killed at #{Time.now}"</span>
|
|
337
|
+
<span class="ruby-constant">Resque</span><span class="ruby-operator">::</span><span class="ruby-constant">Status</span>.<span class="ruby-identifier">killed</span>(<span class="ruby-identifier">uuid</span>)
|
|
338
|
+
<span class="ruby-identifier">on_killed</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:on_killed</span>)
|
|
339
|
+
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
|
340
|
+
<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-identifier">e</span>
|
|
341
|
+
<span class="ruby-identifier">failed</span>(<span class="ruby-node">"The task failed because of an error: #{e}"</span>)
|
|
342
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:on_failure</span>)
|
|
343
|
+
<span class="ruby-identifier">on_failure</span>(<span class="ruby-identifier">e</span>)
|
|
344
|
+
<span class="ruby-keyword">else</span>
|
|
345
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
|
346
|
+
<span class="ruby-keyword">end</span>
|
|
347
|
+
<span class="ruby-keyword">end</span></pre>
|
|
348
|
+
</div><!-- safe_perform-21-source -->
|
|
349
|
+
|
|
350
|
+
</div>
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
</div><!-- safe_perform-21-method -->
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
<div id="tick-method" class="method-detail ">
|
|
359
|
+
<a name="method-i-tick"></a>
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
<div class="method-heading">
|
|
363
|
+
<span class="method-name">tick</span><span
|
|
364
|
+
class="method-args">(*messages)</span>
|
|
365
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
<div class="method-description">
|
|
370
|
+
|
|
371
|
+
<p>sets the status of the job for the current iteration. You should use the
|
|
372
|
+
<tt>at</tt> method if you have actual numbers to track the iteration count.
|
|
373
|
+
This will kill the job if it has been added to the kill list with
|
|
374
|
+
<tt>Resque::Status.kill()</tt></p>
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
<div class="method-source-code" id="tick-source">
|
|
379
|
+
<pre>
|
|
380
|
+
<span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/job_with_status.rb, line 16</span>
|
|
381
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tick</span>(*<span class="ruby-identifier">messages</span>)
|
|
382
|
+
<span class="ruby-identifier">kill!</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">should_kill?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">killed?</span>
|
|
383
|
+
<span class="ruby-identifier">set_status</span>({<span class="ruby-string">'status'</span> =<span class="ruby-operator">></span> <span class="ruby-string">'working'</span>}, *<span class="ruby-identifier">messages</span>)
|
|
384
|
+
<span class="ruby-keyword">end</span></pre>
|
|
385
|
+
</div><!-- tick-source -->
|
|
386
|
+
|
|
387
|
+
</div>
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
</div><!-- tick-method -->
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
</div><!-- public-instance-method-details -->
|
|
396
|
+
|
|
397
|
+
</div><!-- 5Buntitled-5D -->
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
</div><!-- documentation -->
|
|
401
|
+
|
|
402
|
+
<div id="validator-badges">
|
|
403
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
404
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
405
|
+
Rdoc Generator</a> 2</small>.</p>
|
|
406
|
+
</div>
|
|
407
|
+
|
|
408
|
+
</body>
|
|
409
|
+
</html>
|
|
410
|
+
|