job_boss 0.2
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/README.markdown +43 -0
- data/Rakefile +15 -0
- data/bin/job_boss +27 -0
- data/doc/ActiveRecord/Base.html +343 -0
- data/doc/ActiveRecord.html +185 -0
- data/doc/CreateJobs.html +256 -0
- data/doc/JobBoss/Boss.html +413 -0
- data/doc/JobBoss/Config.html +342 -0
- data/doc/JobBoss/Job.html +754 -0
- data/doc/JobBoss/Queuer.html +231 -0
- data/doc/JobBoss.html +480 -0
- data/doc/Mongrel/HttpServer.html +275 -0
- data/doc/Mongrel.html +185 -0
- data/doc/Passenger/Railz/RequestHandler.html +271 -0
- data/doc/Passenger/Railz.html +185 -0
- data/doc/Passenger.html +185 -0
- data/doc/PhusionPassenger/Rack/RequestHandler.html +271 -0
- data/doc/PhusionPassenger/Rack.html +185 -0
- data/doc/PhusionPassenger/Railz/RequestHandler.html +271 -0
- data/doc/PhusionPassenger/Railz.html +185 -0
- data/doc/PhusionPassenger.html +187 -0
- data/doc/Rakefile.html +115 -0
- data/doc/Spawn/SpawnId.html +276 -0
- data/doc/Spawn.html +742 -0
- data/doc/bin/job_boss.html +58 -0
- data/doc/created.rid +9 -0
- data/doc/index.html +126 -0
- data/doc/lib/job_boss/boss_rb.html +64 -0
- data/doc/lib/job_boss/capistrano_rb.html +60 -0
- data/doc/lib/job_boss/configuror_rb.html +54 -0
- data/doc/lib/job_boss/job_rb.html +56 -0
- data/doc/lib/job_boss/queuer_rb.html +56 -0
- data/doc/lib/migrate_rb.html +52 -0
- data/doc/rdoc.css +706 -0
- data/doc/vendor/spawn/CHANGELOG.html +275 -0
- data/doc/vendor/spawn/LICENSE.html +151 -0
- data/doc/vendor/spawn/init_rb.html +54 -0
- data/doc/vendor/spawn/lib/patches_rb.html +56 -0
- data/doc/vendor/spawn/lib/spawn_rb.html +52 -0
- data/job_boss.gemspec +26 -0
- data/lib/job_boss/boss.rb +153 -0
- data/lib/job_boss/capistrano.rb +8 -0
- data/lib/job_boss/configuror.rb +40 -0
- data/lib/job_boss/job.rb +155 -0
- data/lib/job_boss/queuer.rb +37 -0
- data/lib/migrate.rb +27 -0
- metadata +151 -0
@@ -0,0 +1,754 @@
|
|
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: JobBoss::Job</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="class">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="../index.html">Home</a>
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="../lib/job_boss/job_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/job_boss/job.rb">lib/job_boss/job.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
<div id="parent-class-section" class="section">
|
56
|
+
<h3 class="section-header">Parent</h3>
|
57
|
+
|
58
|
+
<p class="link">ActiveRecord::Base</p>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Namespace Contents -->
|
64
|
+
|
65
|
+
|
66
|
+
<!-- Method Quickref -->
|
67
|
+
|
68
|
+
<div id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
<ul class="link-list">
|
71
|
+
|
72
|
+
<li><a href="#method-c-call_path">::call_path</a></li>
|
73
|
+
|
74
|
+
<li><a href="#method-c-pending_paths">::pending_paths</a></li>
|
75
|
+
|
76
|
+
<li><a href="#method-i-cancel">#cancel</a></li>
|
77
|
+
|
78
|
+
<li><a href="#method-i-cancelled%3F">#cancelled?</a></li>
|
79
|
+
|
80
|
+
<li><a href="#method-i-completed%3F">#completed?</a></li>
|
81
|
+
|
82
|
+
<li><a href="#method-i-dispatch">#dispatch</a></li>
|
83
|
+
|
84
|
+
<li><a href="#method-i-mark_as_cancelled">#mark_as_cancelled</a></li>
|
85
|
+
|
86
|
+
<li><a href="#method-i-mark_as_completed">#mark_as_completed</a></li>
|
87
|
+
|
88
|
+
<li><a href="#method-i-mark_as_started">#mark_as_started</a></li>
|
89
|
+
|
90
|
+
<li><a href="#method-i-mark_employee">#mark_employee</a></li>
|
91
|
+
|
92
|
+
<li><a href="#method-i-mark_exception">#mark_exception</a></li>
|
93
|
+
|
94
|
+
<li><a href="#method-i-mark_for_redo">#mark_for_redo</a></li>
|
95
|
+
|
96
|
+
<li><a href="#method-i-succeeded%3F">#succeeded?</a></li>
|
97
|
+
|
98
|
+
<li><a href="#method-i-time_taken">#time_taken</a></li>
|
99
|
+
|
100
|
+
</ul>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
<!-- Included Modules -->
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div id="project-metadata">
|
109
|
+
|
110
|
+
|
111
|
+
<div id="fileindex-section" class="section project-section">
|
112
|
+
<h3 class="section-header">Files</h3>
|
113
|
+
<ul>
|
114
|
+
|
115
|
+
<li class="file"><a href="../Rakefile.html">Rakefile</a></li>
|
116
|
+
|
117
|
+
</ul>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
<div id="classindex-section" class="section project-section">
|
122
|
+
<h3 class="section-header">Class Index
|
123
|
+
<span class="search-toggle"><img src="../images/find.png"
|
124
|
+
height="16" width="16" alt="[+]"
|
125
|
+
title="show/hide quicksearch" /></span></h3>
|
126
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
127
|
+
<fieldset>
|
128
|
+
<legend>Quicksearch</legend>
|
129
|
+
<input type="text" name="quicksearch" value=""
|
130
|
+
class="quicksearch-field" />
|
131
|
+
</fieldset>
|
132
|
+
</form>
|
133
|
+
|
134
|
+
<ul class="link-list">
|
135
|
+
|
136
|
+
<li><a href="../JobBoss.html">JobBoss</a></li>
|
137
|
+
|
138
|
+
<li><a href="../JobBoss/Boss.html">JobBoss::Boss</a></li>
|
139
|
+
|
140
|
+
<li><a href="../JobBoss/Config.html">JobBoss::Config</a></li>
|
141
|
+
|
142
|
+
<li><a href="../JobBoss/Job.html">JobBoss::Job</a></li>
|
143
|
+
|
144
|
+
<li><a href="../JobBoss/Queuer.html">JobBoss::Queuer</a></li>
|
145
|
+
|
146
|
+
<li><a href="../CreateJobs.html">CreateJobs</a></li>
|
147
|
+
|
148
|
+
</ul>
|
149
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
<div id="documentation">
|
157
|
+
<h1 class="class">JobBoss::Job</h1>
|
158
|
+
|
159
|
+
<div id="description">
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<!-- Constants -->
|
164
|
+
|
165
|
+
|
166
|
+
<!-- Attributes -->
|
167
|
+
|
168
|
+
|
169
|
+
<!-- Methods -->
|
170
|
+
|
171
|
+
<div id="private-class-method-details" class="method-section section">
|
172
|
+
<h3 class="section-header">Private Class Methods</h3>
|
173
|
+
|
174
|
+
|
175
|
+
<div id="call-path-method" class="method-detail ">
|
176
|
+
<a name="method-c-call_path"></a>
|
177
|
+
|
178
|
+
<div class="method-heading">
|
179
|
+
|
180
|
+
<span class="method-name">call_path</span><span
|
181
|
+
class="method-args">(path, *args)</span>
|
182
|
+
<span class="method-click-advice">click to toggle source</span>
|
183
|
+
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div class="method-description">
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<div class="method-source-code"
|
193
|
+
id="call-path-source">
|
194
|
+
<pre>
|
195
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 115</span>
|
196
|
+
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call_path</span>(<span class="ruby-identifier">path</span>, *<span class="ruby-identifier">args</span>)
|
197
|
+
116: <span class="ruby-identifier">require</span> <span class="ruby-value str">'active_support'</span>
|
198
|
+
117:
|
199
|
+
118: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Invalid path (must have #)"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/.#./</span>)
|
200
|
+
119: <span class="ruby-identifier">controller</span>, <span class="ruby-identifier">action</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'#'</span>)
|
201
|
+
120:
|
202
|
+
121: <span class="ruby-identifier">controller_object</span> = <span class="ruby-keyword kw">begin</span>
|
203
|
+
122: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-node">"#{controller.classify}Jobs"</span>).<span class="ruby-identifier">new</span>
|
204
|
+
123: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span>
|
205
|
+
124: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Invalid controller"</span>
|
206
|
+
125: <span class="ruby-keyword kw">end</span>
|
207
|
+
126:
|
208
|
+
127: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Invalid path action"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">controller_object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">action</span>)
|
209
|
+
128:
|
210
|
+
129: <span class="ruby-identifier">controller_object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">action</span>, *<span class="ruby-identifier">args</span>)
|
211
|
+
130: <span class="ruby-keyword kw">end</span></pre>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
<div id="pending-paths-method" class="method-detail ">
|
223
|
+
<a name="method-c-pending_paths"></a>
|
224
|
+
|
225
|
+
<div class="method-heading">
|
226
|
+
|
227
|
+
<span class="method-name">pending_paths</span><span
|
228
|
+
class="method-args">()</span>
|
229
|
+
<span class="method-click-advice">click to toggle source</span>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div class="method-description">
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<div class="method-source-code"
|
240
|
+
id="pending-paths-source">
|
241
|
+
<pre>
|
242
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 132</span>
|
243
|
+
132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pending_paths</span>
|
244
|
+
133: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pending</span>.<span class="ruby-identifier">except</span>(<span class="ruby-value">:order</span>).<span class="ruby-identifier">select</span>(<span class="ruby-value str">'DISTINCT path'</span>).<span class="ruby-identifier">collect</span>(&<span class="ruby-value">:path</span>)
|
245
|
+
134: <span class="ruby-keyword kw">end</span></pre>
|
246
|
+
</div>
|
247
|
+
|
248
|
+
</div>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</div>
|
254
|
+
|
255
|
+
|
256
|
+
</div>
|
257
|
+
|
258
|
+
<div id="public-instance-method-details" class="method-section section">
|
259
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
260
|
+
|
261
|
+
|
262
|
+
<div id="cancel-method" class="method-detail ">
|
263
|
+
<a name="method-i-cancel"></a>
|
264
|
+
|
265
|
+
<div class="method-heading">
|
266
|
+
|
267
|
+
<span class="method-name">cancel</span><span
|
268
|
+
class="method-args">()</span>
|
269
|
+
<span class="method-click-advice">click to toggle source</span>
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<div class="method-description">
|
274
|
+
|
275
|
+
<p>
|
276
|
+
Mark the job as cancelled so that the boss won’t run the job and so
|
277
|
+
that the employee running the job gets stopped (if it’s been
|
278
|
+
dispatched)
|
279
|
+
</p>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<div class="method-source-code"
|
284
|
+
id="cancel-source">
|
285
|
+
<pre>
|
286
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 69</span>
|
287
|
+
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cancel</span>
|
288
|
+
70: <span class="ruby-identifier">mark_as_cancelled</span>
|
289
|
+
71: <span class="ruby-keyword kw">end</span></pre>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
<div id="cancelled--method" class="method-detail ">
|
301
|
+
<a name="method-i-cancelled%3F"></a>
|
302
|
+
|
303
|
+
<div class="method-heading">
|
304
|
+
|
305
|
+
<span class="method-name">cancelled?</span><span
|
306
|
+
class="method-args">()</span>
|
307
|
+
<span class="method-click-advice">click to toggle source</span>
|
308
|
+
|
309
|
+
</div>
|
310
|
+
|
311
|
+
<div class="method-description">
|
312
|
+
|
313
|
+
<p>
|
314
|
+
Has the job been cancelled?
|
315
|
+
</p>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
<div class="method-source-code"
|
320
|
+
id="cancelled--source">
|
321
|
+
<pre>
|
322
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 74</span>
|
323
|
+
74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cancelled?</span>
|
324
|
+
75: <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">cancelled_at</span>
|
325
|
+
76: <span class="ruby-keyword kw">end</span></pre>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
</div>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
</div>
|
334
|
+
|
335
|
+
|
336
|
+
<div id="completed--method" class="method-detail ">
|
337
|
+
<a name="method-i-completed%3F"></a>
|
338
|
+
|
339
|
+
<div class="method-heading">
|
340
|
+
|
341
|
+
<span class="method-name">completed?</span><span
|
342
|
+
class="method-args">()</span>
|
343
|
+
<span class="method-click-advice">click to toggle source</span>
|
344
|
+
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div class="method-description">
|
348
|
+
|
349
|
+
<p>
|
350
|
+
Is the job complete?
|
351
|
+
</p>
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
<div class="method-source-code"
|
356
|
+
id="completed--source">
|
357
|
+
<pre>
|
358
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 63</span>
|
359
|
+
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">completed?</span>
|
360
|
+
64: <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">completed_at</span>
|
361
|
+
65: <span class="ruby-keyword kw">end</span></pre>
|
362
|
+
</div>
|
363
|
+
|
364
|
+
</div>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
</div>
|
370
|
+
|
371
|
+
|
372
|
+
<div id="dispatch-method" class="method-detail ">
|
373
|
+
<a name="method-i-dispatch"></a>
|
374
|
+
|
375
|
+
<div class="method-heading">
|
376
|
+
|
377
|
+
<span class="method-name">dispatch</span><span
|
378
|
+
class="method-args">()</span>
|
379
|
+
<span class="method-click-advice">click to toggle source</span>
|
380
|
+
|
381
|
+
</div>
|
382
|
+
|
383
|
+
<div class="method-description">
|
384
|
+
|
385
|
+
<p>
|
386
|
+
Method used by the boss to dispatch an employee
|
387
|
+
</p>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<div class="method-source-code"
|
392
|
+
id="dispatch-source">
|
393
|
+
<pre>
|
394
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 15</span>
|
395
|
+
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>
|
396
|
+
16: <span class="ruby-identifier">mark_as_started</span>
|
397
|
+
17: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Dispatching Job ##{self.id}"</span>
|
398
|
+
18:
|
399
|
+
19: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">fork</span> <span class="ruby-keyword kw">do</span>
|
400
|
+
20: <span class="ruby-identifier">$0</span> = <span class="ruby-node">"job_boss - employee (job ##{self.id})"</span>
|
401
|
+
21: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">setpriority</span>(<span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">PRIO_PROCESS</span>, <span class="ruby-value">0</span>, <span class="ruby-value">19</span>)
|
402
|
+
22:
|
403
|
+
23: <span class="ruby-keyword kw">begin</span>
|
404
|
+
24: <span class="ruby-identifier">mark_employee</span>
|
405
|
+
25:
|
406
|
+
26: <span class="ruby-constant">Signal</span>.<span class="ruby-identifier">trap</span>(<span class="ruby-value str">"HUP"</span>) <span class="ruby-keyword kw">do</span>
|
407
|
+
27: <span class="ruby-identifier">mark_for_redo</span>
|
408
|
+
28: <span class="ruby-keyword kw">end</span>
|
409
|
+
29:
|
410
|
+
30: <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">call_path</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>, *<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">args</span>)
|
411
|
+
31: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">update_attribute</span>(<span class="ruby-value">:result</span>, <span class="ruby-identifier">result</span>)
|
412
|
+
32: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exception</span>
|
413
|
+
33: <span class="ruby-identifier">mark_exception</span>(<span class="ruby-identifier">exception</span>)
|
414
|
+
34: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Error running job ##{self.id}!"</span>
|
415
|
+
35: <span class="ruby-keyword kw">ensure</span>
|
416
|
+
36: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">mark_as_completed</span>
|
417
|
+
37: <span class="ruby-identifier">sleep</span>(<span class="ruby-value">1</span>)
|
418
|
+
38: <span class="ruby-keyword kw">end</span>
|
419
|
+
39:
|
420
|
+
40: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Job ##{self.id} completed, exiting..."</span>
|
421
|
+
41: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">exit</span>
|
422
|
+
42: <span class="ruby-keyword kw">end</span>
|
423
|
+
43: <span class="ruby-keyword kw">end</span>
|
424
|
+
44:
|
425
|
+
45: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">detach</span>(<span class="ruby-identifier">pid</span>)
|
426
|
+
46: <span class="ruby-keyword kw">end</span></pre>
|
427
|
+
</div>
|
428
|
+
|
429
|
+
</div>
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
</div>
|
435
|
+
|
436
|
+
|
437
|
+
<div id="mark-for-redo-method" class="method-detail ">
|
438
|
+
<a name="method-i-mark_for_redo"></a>
|
439
|
+
|
440
|
+
<div class="method-heading">
|
441
|
+
|
442
|
+
<span class="method-name">mark_for_redo</span><span
|
443
|
+
class="method-args">()</span>
|
444
|
+
<span class="method-click-advice">click to toggle source</span>
|
445
|
+
|
446
|
+
</div>
|
447
|
+
|
448
|
+
<div class="method-description">
|
449
|
+
|
450
|
+
<p>
|
451
|
+
Clear out the job and put it back onto the queue for processing
|
452
|
+
</p>
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
<div class="method-source-code"
|
457
|
+
id="mark-for-redo-source">
|
458
|
+
<pre>
|
459
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 49</span>
|
460
|
+
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mark_for_redo</span>
|
461
|
+
50: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reload</span>
|
462
|
+
51: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">started_at</span> = <span class="ruby-keyword kw">nil</span>
|
463
|
+
52: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">nil</span>
|
464
|
+
53: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">completed_at</span> = <span class="ruby-keyword kw">nil</span>
|
465
|
+
54: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> = <span class="ruby-keyword kw">nil</span>
|
466
|
+
55: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">error_message</span> = <span class="ruby-keyword kw">nil</span>
|
467
|
+
56: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">error_backtrace</span> = <span class="ruby-keyword kw">nil</span>
|
468
|
+
57: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">employee_host</span> = <span class="ruby-keyword kw">nil</span>
|
469
|
+
58: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">employee_pid</span> = <span class="ruby-keyword kw">nil</span>
|
470
|
+
59: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">save</span>
|
471
|
+
60: <span class="ruby-keyword kw">end</span></pre>
|
472
|
+
</div>
|
473
|
+
|
474
|
+
</div>
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
</div>
|
480
|
+
|
481
|
+
|
482
|
+
<div id="succeeded--method" class="method-detail ">
|
483
|
+
<a name="method-i-succeeded%3F"></a>
|
484
|
+
|
485
|
+
<div class="method-heading">
|
486
|
+
|
487
|
+
<span class="method-name">succeeded?</span><span
|
488
|
+
class="method-args">()</span>
|
489
|
+
<span class="method-click-advice">click to toggle source</span>
|
490
|
+
|
491
|
+
</div>
|
492
|
+
|
493
|
+
<div class="method-description">
|
494
|
+
|
495
|
+
<p>
|
496
|
+
Did the job succeed?
|
497
|
+
</p>
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
<div class="method-source-code"
|
502
|
+
id="succeeded--source">
|
503
|
+
<pre>
|
504
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 79</span>
|
505
|
+
79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">succeeded?</span>
|
506
|
+
80: <span class="ruby-identifier">completed_at</span> <span class="ruby-operator">&&</span> (<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'success'</span>)
|
507
|
+
81: <span class="ruby-keyword kw">end</span></pre>
|
508
|
+
</div>
|
509
|
+
|
510
|
+
</div>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
</div>
|
516
|
+
|
517
|
+
|
518
|
+
<div id="time-taken-method" class="method-detail ">
|
519
|
+
<a name="method-i-time_taken"></a>
|
520
|
+
|
521
|
+
<div class="method-heading">
|
522
|
+
|
523
|
+
<span class="method-name">time_taken</span><span
|
524
|
+
class="method-args">()</span>
|
525
|
+
<span class="method-click-advice">click to toggle source</span>
|
526
|
+
|
527
|
+
</div>
|
528
|
+
|
529
|
+
<div class="method-description">
|
530
|
+
|
531
|
+
<p>
|
532
|
+
How long did the job take?
|
533
|
+
</p>
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
<div class="method-source-code"
|
538
|
+
id="time-taken-source">
|
539
|
+
<pre>
|
540
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 84</span>
|
541
|
+
84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time_taken</span>
|
542
|
+
85: <span class="ruby-identifier">completed_at</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">started_at</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">completed_at</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">started_at</span>
|
543
|
+
86: <span class="ruby-keyword kw">end</span></pre>
|
544
|
+
</div>
|
545
|
+
|
546
|
+
</div>
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
</div>
|
552
|
+
|
553
|
+
|
554
|
+
</div>
|
555
|
+
|
556
|
+
<div id="private-instance-method-details" class="method-section section">
|
557
|
+
<h3 class="section-header">Private Instance Methods</h3>
|
558
|
+
|
559
|
+
|
560
|
+
<div id="mark-as-cancelled-method" class="method-detail ">
|
561
|
+
<a name="method-i-mark_as_cancelled"></a>
|
562
|
+
|
563
|
+
<div class="method-heading">
|
564
|
+
|
565
|
+
<span class="method-name">mark_as_cancelled</span><span
|
566
|
+
class="method-args">()</span>
|
567
|
+
<span class="method-click-advice">click to toggle source</span>
|
568
|
+
|
569
|
+
</div>
|
570
|
+
|
571
|
+
<div class="method-description">
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
<div class="method-source-code"
|
578
|
+
id="mark-as-cancelled-source">
|
579
|
+
<pre>
|
580
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 94</span>
|
581
|
+
94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mark_as_cancelled</span>
|
582
|
+
95: <span class="ruby-identifier">update_attributes</span>(<span class="ruby-value">:cancelled_at</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
583
|
+
96: <span class="ruby-keyword kw">end</span></pre>
|
584
|
+
</div>
|
585
|
+
|
586
|
+
</div>
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
</div>
|
592
|
+
|
593
|
+
|
594
|
+
<div id="mark-as-completed-method" class="method-detail ">
|
595
|
+
<a name="method-i-mark_as_completed"></a>
|
596
|
+
|
597
|
+
<div class="method-heading">
|
598
|
+
|
599
|
+
<span class="method-name">mark_as_completed</span><span
|
600
|
+
class="method-args">()</span>
|
601
|
+
<span class="method-click-advice">click to toggle source</span>
|
602
|
+
|
603
|
+
</div>
|
604
|
+
|
605
|
+
<div class="method-description">
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
<div class="method-source-code"
|
612
|
+
id="mark-as-completed-source">
|
613
|
+
<pre>
|
614
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 108</span>
|
615
|
+
108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mark_as_completed</span>
|
616
|
+
109: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'success'</span>
|
617
|
+
110: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">completed_at</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
618
|
+
111: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">save</span>
|
619
|
+
112: <span class="ruby-keyword kw">end</span></pre>
|
620
|
+
</div>
|
621
|
+
|
622
|
+
</div>
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
</div>
|
628
|
+
|
629
|
+
|
630
|
+
<div id="mark-as-started-method" class="method-detail ">
|
631
|
+
<a name="method-i-mark_as_started"></a>
|
632
|
+
|
633
|
+
<div class="method-heading">
|
634
|
+
|
635
|
+
<span class="method-name">mark_as_started</span><span
|
636
|
+
class="method-args">()</span>
|
637
|
+
<span class="method-click-advice">click to toggle source</span>
|
638
|
+
|
639
|
+
</div>
|
640
|
+
|
641
|
+
<div class="method-description">
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
<div class="method-source-code"
|
648
|
+
id="mark-as-started-source">
|
649
|
+
<pre>
|
650
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 90</span>
|
651
|
+
90: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mark_as_started</span>
|
652
|
+
91: <span class="ruby-identifier">update_attributes</span>(<span class="ruby-value">:started_at</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
653
|
+
92: <span class="ruby-keyword kw">end</span></pre>
|
654
|
+
</div>
|
655
|
+
|
656
|
+
</div>
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
</div>
|
662
|
+
|
663
|
+
|
664
|
+
<div id="mark-employee-method" class="method-detail ">
|
665
|
+
<a name="method-i-mark_employee"></a>
|
666
|
+
|
667
|
+
<div class="method-heading">
|
668
|
+
|
669
|
+
<span class="method-name">mark_employee</span><span
|
670
|
+
class="method-args">()</span>
|
671
|
+
<span class="method-click-advice">click to toggle source</span>
|
672
|
+
|
673
|
+
</div>
|
674
|
+
|
675
|
+
<div class="method-description">
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
<div class="method-source-code"
|
682
|
+
id="mark-employee-source">
|
683
|
+
<pre>
|
684
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 98</span>
|
685
|
+
98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mark_employee</span>
|
686
|
+
99: <span class="ruby-identifier">require</span> <span class="ruby-value str">'socket'</span>
|
687
|
+
100: <span class="ruby-identifier">update_attributes</span>(<span class="ruby-value">:employee_host</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Socket</span>.<span class="ruby-identifier">gethostname</span>,
|
688
|
+
101: <span class="ruby-value">:employee_pid</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Process</span>.<span class="ruby-identifier">pid</span>)
|
689
|
+
102: <span class="ruby-keyword kw">end</span></pre>
|
690
|
+
</div>
|
691
|
+
|
692
|
+
</div>
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
</div>
|
698
|
+
|
699
|
+
|
700
|
+
<div id="mark-exception-method" class="method-detail ">
|
701
|
+
<a name="method-i-mark_exception"></a>
|
702
|
+
|
703
|
+
<div class="method-heading">
|
704
|
+
|
705
|
+
<span class="method-name">mark_exception</span><span
|
706
|
+
class="method-args">(exception)</span>
|
707
|
+
<span class="method-click-advice">click to toggle source</span>
|
708
|
+
|
709
|
+
</div>
|
710
|
+
|
711
|
+
<div class="method-description">
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
<div class="method-source-code"
|
718
|
+
id="mark-exception-source">
|
719
|
+
<pre>
|
720
|
+
<span class="ruby-comment cmt"># File lib/job_boss/job.rb, line 104</span>
|
721
|
+
104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mark_exception</span>(<span class="ruby-identifier">exception</span>)
|
722
|
+
105: <span class="ruby-identifier">update_attributes</span>(<span class="ruby-value">:status</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'error'</span>, <span class="ruby-value">:error_message</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>, <span class="ruby-value">:error_backtrace</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>)
|
723
|
+
106: <span class="ruby-keyword kw">end</span></pre>
|
724
|
+
</div>
|
725
|
+
|
726
|
+
</div>
|
727
|
+
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
</div>
|
732
|
+
|
733
|
+
|
734
|
+
</div>
|
735
|
+
|
736
|
+
|
737
|
+
</div>
|
738
|
+
|
739
|
+
|
740
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
741
|
+
|
742
|
+
<p>Disabled; run with --debug to generate this.</p>
|
743
|
+
|
744
|
+
</div>
|
745
|
+
|
746
|
+
<div id="validator-badges">
|
747
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
748
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
749
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
750
|
+
</div>
|
751
|
+
|
752
|
+
</body>
|
753
|
+
</html>
|
754
|
+
|