resque-pool-dynamic 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2187 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Resque::Pool::Dynamic
8
+
9
+ &mdash; Documentation by YARD 0.7.5
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '../..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../../_index.html">Index (D)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../../Resque.html" title="Resque (module)">Resque</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Pool.html" title="Resque::Pool (class)">Pool</a></span></span>
38
+ &raquo;
39
+ <span class="title">Dynamic</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Class: Resque::Pool::Dynamic
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+ <dt class="r1">Inherits:</dt>
68
+ <dd class="r1">
69
+ <span class="inheritName">Object</span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next">Resque::Pool::Dynamic</li>
75
+
76
+ </ul>
77
+ <a href="#" class="inheritanceTree">show all</a>
78
+
79
+ </dd>
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ <dt class="r2 last">Defined in:</dt>
90
+ <dd class="r2 last">lib/resque/pool/dynamic/shell.rb<span class="defines">,<br />
91
+ lib/resque/pool/dynamic.rb,<br /> lib/resque/pool/dynamic/version.rb,<br /> lib/resque/pool/dynamic/logfile.rb</span>
92
+ </dd>
93
+
94
+ </dl>
95
+ <div class="clear"></div>
96
+
97
+ <h2>Overview</h2><div class="docstring">
98
+ <div class="discussion">
99
+ <p>
100
+ Add-on to resque-pool to allow manually controlled, dynamic sessions
101
+ </p>
102
+
103
+
104
+ </div>
105
+ </div>
106
+ <div class="tags">
107
+
108
+
109
+ </div><h2>Defined Under Namespace</h2>
110
+ <p class="children">
111
+
112
+
113
+
114
+
115
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Dynamic/Logfile.html" title="Resque::Pool::Dynamic::Logfile (class)">Logfile</a></span>, <span class='object_link'><a href="Dynamic/Shell.html" title="Resque::Pool::Dynamic::Shell (class)">Shell</a></span>
116
+
117
+
118
+ </p>
119
+
120
+ <h2>Constant Summary</h2>
121
+
122
+ <dl class="constants">
123
+
124
+ <dt id="VERSION-constant" class="">VERSION =
125
+
126
+ </dt>
127
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
128
+
129
+ </dl>
130
+
131
+
132
+
133
+
134
+
135
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
136
+ <ul class="summary">
137
+
138
+ <li class="public ">
139
+ <span class="summary_signature">
140
+
141
+ <a href="#pid-instance_method" title="#pid (instance method)">- (Integer, NilClass) <strong>pid</strong> </a>
142
+
143
+
144
+
145
+ </span>
146
+
147
+
148
+ <span class="note title readonly">readonly</span>
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ <span class="summary_desc"><div class='inline'><p>
158
+ PID of the resque-pool process, or nil if it&#8217;s not running.
159
+ </p>
160
+ </div></span>
161
+
162
+ </li>
163
+
164
+
165
+ </ul>
166
+
167
+
168
+
169
+
170
+
171
+ <h2>
172
+ Class Method Summary
173
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
174
+ </h2>
175
+
176
+ <ul class="summary">
177
+
178
+ <li class="public ">
179
+ <span class="summary_signature">
180
+
181
+ <a href="#shell-class_method" title="shell (class method)">+ (void) <strong>shell</strong>(options = {}) </a>
182
+
183
+
184
+
185
+ </span>
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'><p>
195
+ Run a dynamic resque pool session.
196
+ </p>
197
+ </div></span>
198
+
199
+ </li>
200
+
201
+
202
+ </ul>
203
+
204
+ <h2>
205
+ Instance Method Summary
206
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
207
+ </h2>
208
+
209
+ <ul class="summary">
210
+
211
+ <li class="public ">
212
+ <span class="summary_signature">
213
+
214
+ <a href="#config-instance_method" title="#config (instance method)">- (void) <strong>config</strong>(args = nil) </a>
215
+
216
+
217
+
218
+ </span>
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+ <span class="summary_desc"><div class='inline'></div></span>
228
+
229
+ </li>
230
+
231
+
232
+ <li class="public ">
233
+ <span class="summary_signature">
234
+
235
+ <a href="#config_path-instance_method" title="#config_path (instance method)">- (String) <strong>config_path</strong> </a>
236
+
237
+
238
+
239
+ </span>
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'><p>
249
+ Path to the temporary config file.
250
+ </p>
251
+ </div></span>
252
+
253
+ </li>
254
+
255
+
256
+ <li class="public ">
257
+ <span class="summary_signature">
258
+
259
+ <a href="#config_tempfile-instance_method" title="#config_tempfile (instance method)">- (Tempfile) <strong>config_tempfile</strong> </a>
260
+
261
+
262
+
263
+ </span>
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+ <span class="summary_desc"><div class='inline'><p>
273
+ Tempfile instance for configuration file.
274
+ </p>
275
+ </div></span>
276
+
277
+ </li>
278
+
279
+
280
+ <li class="public ">
281
+ <span class="summary_signature">
282
+
283
+ <a href="#has_log%3F-instance_method" title="#has_log? (instance method)">- (Boolean) <strong>has_log?</strong> </a>
284
+
285
+
286
+
287
+ </span>
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+ <span class="summary_desc"><div class='inline'><p>
297
+ True if we have an open log file.
298
+ </p>
299
+ </div></span>
300
+
301
+ </li>
302
+
303
+
304
+ <li class="public ">
305
+ <span class="summary_signature">
306
+
307
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Dynamic) <strong>initialize</strong> </a>
308
+
309
+
310
+
311
+ </span>
312
+
313
+ <span class="note title constructor">constructor</span>
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+ <span class="summary_desc"><div class='inline'><p>
323
+ A new instance of Dynamic.
324
+ </p>
325
+ </div></span>
326
+
327
+ </li>
328
+
329
+
330
+ <li class="public ">
331
+ <span class="summary_signature">
332
+
333
+ <a href="#kill%21-instance_method" title="#kill! (instance method)">- (void) <strong>kill!</strong>(sig) </a>
334
+
335
+
336
+
337
+ </span>
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+ <span class="summary_desc"><div class='inline'><p>
347
+ Send signal to a running resque-pool.
348
+ </p>
349
+ </div></span>
350
+
351
+ </li>
352
+
353
+
354
+ <li class="public ">
355
+ <span class="summary_signature">
356
+
357
+ <a href="#log-instance_method" title="#log (instance method)">- (Logfile) <strong>log</strong> </a>
358
+
359
+
360
+
361
+ </span>
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+ <span class="summary_desc"><div class='inline'><p>
371
+ Open log of resque-pool process.
372
+ </p>
373
+ </div></span>
374
+
375
+ </li>
376
+
377
+
378
+ <li class="public ">
379
+ <span class="summary_signature">
380
+
381
+ <a href="#log_path-instance_method" title="#log_path (instance method)">- (String) <strong>log_path</strong> </a>
382
+
383
+
384
+
385
+ </span>
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+ <span class="summary_desc"><div class='inline'><p>
395
+ Logfile path.
396
+ </p>
397
+ </div></span>
398
+
399
+ </li>
400
+
401
+
402
+ <li class="public ">
403
+ <span class="summary_signature">
404
+
405
+ <a href="#loop_with_index-instance_method" title="#loop_with_index (instance method)">- (void) <strong>loop_with_index</strong> {|i| ... }</a>
406
+
407
+
408
+
409
+ </span>
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+ <span class="summary_desc"><div class='inline'><p>
419
+ Loop, providing index to the block.
420
+ </p>
421
+ </div></span>
422
+
423
+ </li>
424
+
425
+
426
+ <li class="public ">
427
+ <span class="summary_signature">
428
+
429
+ <a href="#parse_config_string-instance_method" title="#parse_config_string (instance method)">- (Hash) <strong>parse_config_string</strong>(spec) </a>
430
+
431
+
432
+
433
+ </span>
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+ <span class="summary_desc"><div class='inline'><p>
443
+ Parse workers configuration.
444
+ </p>
445
+ </div></span>
446
+
447
+ </li>
448
+
449
+
450
+ <li class="public ">
451
+ <span class="summary_signature">
452
+
453
+ <a href="#pid%21-instance_method" title="#pid! (instance method)">- (Integer) <strong>pid!</strong> </a>
454
+
455
+
456
+
457
+ </span>
458
+
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+ <span class="summary_desc"><div class='inline'><p>
467
+ Return pid of running resque-pool or raise an exception.
468
+ </p>
469
+ </div></span>
470
+
471
+ </li>
472
+
473
+
474
+ <li class="public ">
475
+ <span class="summary_signature">
476
+
477
+ <a href="#pstree-instance_method" title="#pstree (instance method)">- (void) <strong>pstree</strong> </a>
478
+
479
+
480
+
481
+ </span>
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+ <span class="summary_desc"><div class='inline'><p>
491
+ Show child process tree by calling `pstree` system command.
492
+ </p>
493
+ </div></span>
494
+
495
+ </li>
496
+
497
+
498
+ <li class="public ">
499
+ <span class="summary_signature">
500
+
501
+ <a href="#reload-instance_method" title="#reload (instance method)">- (void) <strong>reload</strong> </a>
502
+
503
+
504
+
505
+ </span>
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+ <span class="summary_desc"><div class='inline'><p>
515
+ Reload resque-pool configuration.
516
+ </p>
517
+ </div></span>
518
+
519
+ </li>
520
+
521
+
522
+ <li class="public ">
523
+ <span class="summary_signature">
524
+
525
+ <a href="#run_pool-instance_method" title="#run_pool (instance method)">- (void) <strong>run_pool</strong> </a>
526
+
527
+
528
+
529
+ </span>
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+
538
+ <span class="summary_desc"><div class='inline'><p>
539
+ Start resque-pool master This is executed in a forked child process.
540
+ </p>
541
+ </div></span>
542
+
543
+ </li>
544
+
545
+
546
+ <li class="public ">
547
+ <span class="summary_signature">
548
+
549
+ <a href="#start-instance_method" title="#start (instance method)">- (void) <strong>start</strong> </a>
550
+
551
+
552
+
553
+ </span>
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+ <span class="summary_desc"><div class='inline'><p>
563
+ Start resque-pool, showing startup logs.
564
+ </p>
565
+ </div></span>
566
+
567
+ </li>
568
+
569
+
570
+ <li class="public ">
571
+ <span class="summary_signature">
572
+
573
+ <a href="#start%21-instance_method" title="#start! (instance method)">- (Integer) <strong>start!</strong> </a>
574
+
575
+
576
+
577
+ </span>
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+ <span class="summary_desc"><div class='inline'><p>
587
+ Fork a child process for resque-pool master.
588
+ </p>
589
+ </div></span>
590
+
591
+ </li>
592
+
593
+
594
+ <li class="public ">
595
+ <span class="summary_signature">
596
+
597
+ <a href="#status-instance_method" title="#status (instance method)">- (void) <strong>status</strong> </a>
598
+
599
+
600
+
601
+ </span>
602
+
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+ <span class="summary_desc"><div class='inline'><p>
611
+ Show current status.
612
+ </p>
613
+ </div></span>
614
+
615
+ </li>
616
+
617
+
618
+ <li class="public ">
619
+ <span class="summary_signature">
620
+
621
+ <a href="#stop-instance_method" title="#stop (instance method)">- (void) <strong>stop</strong> </a>
622
+
623
+
624
+
625
+ </span>
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+ <span class="summary_desc"><div class='inline'><p>
635
+ Stop running resque-pool, show shutdown logs.
636
+ </p>
637
+ </div></span>
638
+
639
+ </li>
640
+
641
+
642
+ <li class="public ">
643
+ <span class="summary_signature">
644
+
645
+ <a href="#stop%21-instance_method" title="#stop! (instance method)">- (void) <strong>stop!</strong> </a>
646
+
647
+
648
+
649
+ </span>
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+ <span class="summary_desc"><div class='inline'><p>
659
+ Stop running resque-pool.
660
+ </p>
661
+ </div></span>
662
+
663
+ </li>
664
+
665
+
666
+ <li class="public ">
667
+ <span class="summary_signature">
668
+
669
+ <a href="#write_config-instance_method" title="#write_config (instance method)">- (void) <strong>write_config</strong> </a>
670
+
671
+
672
+
673
+ </span>
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+
682
+ <span class="summary_desc"><div class='inline'><p>
683
+ Write temporary configuration file.
684
+ </p>
685
+ </div></span>
686
+
687
+ </li>
688
+
689
+
690
+ </ul>
691
+
692
+
693
+ <div id="constructor_details" class="method_details_list">
694
+ <h2>Constructor Details</h2>
695
+
696
+ <div class="method_details first">
697
+ <p class="signature first" id="initialize-instance_method">
698
+
699
+ - (<tt><span class='object_link'><a href="" title="Resque::Pool::Dynamic (class)">Dynamic</a></span></tt>) <strong>initialize</strong>
700
+
701
+
702
+
703
+ </p><div class="docstring">
704
+ <div class="discussion">
705
+ <p>
706
+ A new instance of Dynamic
707
+ </p>
708
+
709
+
710
+ </div>
711
+ </div>
712
+ <div class="tags">
713
+
714
+
715
+ </div><table class="source_code">
716
+ <tr>
717
+ <td>
718
+ <pre class="lines">
719
+
720
+
721
+ 15
722
+ 16
723
+ 17
724
+ 18</pre>
725
+ </td>
726
+ <td>
727
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 15</span>
728
+
729
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
730
+ <span class='comment'># Make myself a project group leader
731
+ </span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_setpgid'>setpgid</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span>
732
+ <span class='kw'>end</span></pre>
733
+ </td>
734
+ </tr>
735
+ </table>
736
+ </div>
737
+
738
+ </div>
739
+
740
+ <div id="instance_attr_details" class="attr_details">
741
+ <h2>Instance Attribute Details</h2>
742
+
743
+
744
+ <span id=""></span>
745
+ <span id="pid-instance_method"></span>
746
+ <div class="method_details first">
747
+ <p class="signature first" id="pid-instance_method">
748
+
749
+ - (<tt>Integer</tt>, <tt>NilClass</tt>) <strong>pid</strong> <span class="extras">(readonly)</span>
750
+
751
+
752
+
753
+ </p><div class="docstring">
754
+ <div class="discussion">
755
+ <p>
756
+ PID of the resque-pool process, or nil if it&#8217;s not running
757
+ </p>
758
+
759
+
760
+ </div>
761
+ </div>
762
+ <div class="tags">
763
+
764
+ <h3>Returns:</h3>
765
+ <ul class="return">
766
+
767
+ <li>
768
+
769
+
770
+ <span class='type'>(<tt>Integer</tt>, <tt>NilClass</tt>)</span>
771
+
772
+
773
+
774
+ </li>
775
+
776
+ </ul>
777
+
778
+ </div><table class="source_code">
779
+ <tr>
780
+ <td>
781
+ <pre class="lines">
782
+
783
+
784
+ 13
785
+ 14
786
+ 15</pre>
787
+ </td>
788
+ <td>
789
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 13</span>
790
+
791
+ <span class='kw'>def</span> <span class='id identifier rubyid_pid'>pid</span>
792
+ <span class='ivar'>@pid</span>
793
+ <span class='kw'>end</span></pre>
794
+ </td>
795
+ </tr>
796
+ </table>
797
+ </div>
798
+
799
+ </div>
800
+
801
+
802
+ <div id="class_method_details" class="method_details_list">
803
+ <h2>Class Method Details</h2>
804
+
805
+
806
+ <div class="method_details first">
807
+ <p class="signature first" id="shell-class_method">
808
+
809
+ + (<tt>void</tt>) <strong>shell</strong>(options = {})
810
+
811
+
812
+
813
+ </p><div class="docstring">
814
+ <div class="discussion">
815
+ <p>
816
+ Run a dynamic resque pool session.
817
+ </p>
818
+
819
+
820
+ </div>
821
+ </div>
822
+ <div class="tags">
823
+ <h3>Parameters:</h3>
824
+ <ul class="param">
825
+
826
+ <li>
827
+
828
+ <span class='name'>options</span>
829
+
830
+
831
+ <span class='type'>(<tt>Hash</tt>)</span>
832
+
833
+
834
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
835
+
836
+
837
+ &mdash;
838
+ <div class='inline'><p>
839
+ Options passed to the Shell instance
840
+ </p>
841
+ </div>
842
+
843
+ </li>
844
+
845
+ <li>
846
+
847
+ <span class='name'>opts</span>
848
+
849
+
850
+ <span class='type'>(<tt>Hash</tt>)</span>
851
+
852
+
853
+
854
+ &mdash;
855
+ <div class='inline'><p>
856
+ a customizable set of options
857
+ </p>
858
+ </div>
859
+
860
+ </li>
861
+
862
+ </ul>
863
+
864
+
865
+
866
+
867
+
868
+
869
+ </div><table class="source_code">
870
+ <tr>
871
+ <td>
872
+ <pre class="lines">
873
+
874
+
875
+ 15
876
+ 16
877
+ 17
878
+ 18
879
+ 19
880
+ 20
881
+ 21
882
+ 22
883
+ 23</pre>
884
+ </td>
885
+ <td>
886
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/shell.rb', line 15</span>
887
+
888
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_shell'>shell</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
889
+ <span class='id identifier rubyid_myself'>myself</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
890
+ <span class='id identifier rubyid_myself'>myself</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:no_start</span><span class='rbracket'>]</span>
891
+ <span class='id identifier rubyid_myself'>myself</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span>
892
+ <span class='const'>Shell</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_myself'>myself</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
893
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\nBye!</span><span class='tstring_end'>&quot;</span></span>
894
+ <span class='kw'>ensure</span>
895
+ <span class='id identifier rubyid_myself'>myself</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='kw'>if</span> <span class='id identifier rubyid_myself'>myself</span>
896
+ <span class='kw'>end</span></pre>
897
+ </td>
898
+ </tr>
899
+ </table>
900
+ </div>
901
+
902
+ </div>
903
+
904
+ <div id="instance_method_details" class="method_details_list">
905
+ <h2>Instance Method Details</h2>
906
+
907
+
908
+ <div class="method_details first">
909
+ <p class="signature first" id="config-instance_method">
910
+
911
+
912
+ <span class="overload">- (<tt>Hash</tt>) <strong>config</strong> </span>
913
+
914
+ <span class="overload">- (<tt>Hash</tt>) <strong>config</strong>(opts) </span>
915
+
916
+
917
+
918
+
919
+ </p><div class="docstring">
920
+ <div class="discussion">
921
+
922
+ <div class="note notetag">
923
+ <strong>Note:</strong>
924
+ <div class='inline'><p>
925
+ Default configuration is taken from environment variable
926
+ &#8220;WORKERS&#8221;, as interpreted by the #parse_config_string method.
927
+ </p>
928
+ </div>
929
+ </div>
930
+
931
+
932
+
933
+ </div>
934
+ </div>
935
+ <div class="tags">
936
+
937
+ <div class="examples">
938
+ <h3>Examples:</h3>
939
+
940
+ <h4><div class='inline'><p>
941
+ config
942
+ </p>
943
+ </div></h4>
944
+ <pre class="example code"><span class='comment'>#=&gt; {&quot;foo&quot;=&gt;1, &quot;bar&quot;=&gt;2}
945
+ </span><span class='id identifier rubyid_config'>config</span> <span class='symbol'>:foo</span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='comma'>,</span> <span class='symbol'>:baz</span> <span class='op'>=&gt;</span> <span class='int'>7</span>
946
+ <span class='comment'>#=&gt; {&quot;foo&quot;=&gt;2, &quot;baz&quot;=&gt;7, &quot;bar&quot;=&gt;2}
947
+ </span><span class='id identifier rubyid_config'>config</span> <span class='symbol'>:bar</span> <span class='op'>=&gt;</span> <span class='int'>0</span>
948
+ <span class='comment'>#=&gt; {&quot;foo&quot;=&gt;2, &quot;baz&quot;=&gt;7}</span></pre>
949
+
950
+ </div>
951
+
952
+ <h3>Overloads:</h3>
953
+ <ul class="overload">
954
+
955
+
956
+ <li class="overload_item">
957
+ <span class="signature">- (<tt>Hash</tt>) <strong>config</strong> </span>
958
+ <div class="docstring">
959
+ <div class="discussion">
960
+ <p>
961
+ Show current workers configuration
962
+ </p>
963
+
964
+
965
+ </div>
966
+ </div>
967
+ <div class="tags">
968
+
969
+ <h3>Returns:</h3>
970
+ <ul class="return">
971
+
972
+ <li>
973
+
974
+
975
+ <span class='type'>(<tt>Hash</tt>)</span>
976
+
977
+
978
+
979
+ </li>
980
+
981
+ </ul>
982
+
983
+ </div>
984
+ </li>
985
+
986
+
987
+ <li class="overload_item">
988
+ <span class="signature">- (<tt>Hash</tt>) <strong>config</strong>(opts) </span>
989
+ <div class="docstring">
990
+ <div class="discussion">
991
+ <p>
992
+ Update workers configuration. If configuration has change and resque-pool
993
+ is running, it is reloaded.
994
+ </p>
995
+
996
+
997
+ </div>
998
+ </div>
999
+ <div class="tags">
1000
+ <h3>Parameters:</h3>
1001
+ <ul class="param">
1002
+
1003
+ <li>
1004
+
1005
+ <span class='name'>opts</span>
1006
+
1007
+
1008
+ <span class='type'>(<tt>Hash</tt>)</span>
1009
+
1010
+
1011
+
1012
+ &mdash;
1013
+ <div class='inline'><p>
1014
+ Dictionary of worker process counts to update (pass 0 or nil as value to
1015
+ delete all workers for a queue from pool)
1016
+ </p>
1017
+ </div>
1018
+
1019
+ </li>
1020
+
1021
+ </ul>
1022
+
1023
+ <h3>Returns:</h3>
1024
+ <ul class="return">
1025
+
1026
+ <li>
1027
+
1028
+
1029
+ <span class='type'>(<tt>Hash</tt>)</span>
1030
+
1031
+
1032
+
1033
+ &mdash;
1034
+ <div class='inline'><p>
1035
+ Updated config
1036
+ </p>
1037
+ </div>
1038
+
1039
+ </li>
1040
+
1041
+ </ul>
1042
+
1043
+ </div>
1044
+ </li>
1045
+
1046
+ </ul>
1047
+
1048
+
1049
+ </div><table class="source_code">
1050
+ <tr>
1051
+ <td>
1052
+ <pre class="lines">
1053
+
1054
+
1055
+ 66
1056
+ 67
1057
+ 68
1058
+ 69
1059
+ 70
1060
+ 71
1061
+ 72
1062
+ 73
1063
+ 74
1064
+ 75
1065
+ 76
1066
+ 77
1067
+ 78
1068
+ 79
1069
+ 80
1070
+ 81
1071
+ 82
1072
+ 83
1073
+ 84
1074
+ 85
1075
+ 86
1076
+ 87
1077
+ 88</pre>
1078
+ </td>
1079
+ <td>
1080
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 66</span>
1081
+
1082
+ <span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
1083
+ <span class='ivar'>@config</span> <span class='op'>||=</span> <span class='id identifier rubyid_parse_config_string'>parse_config_string</span><span class='lparen'>(</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>WORKERS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
1084
+
1085
+ <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span>
1086
+ <span class='id identifier rubyid_oldconfig'>oldconfig</span> <span class='op'>=</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span>
1087
+
1088
+ <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_w'>w</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
1089
+ <span class='id identifier rubyid_w'>w</span> <span class='op'>=</span> <span class='id identifier rubyid_w'>w</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
1090
+ <span class='kw'>if</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_n'>n</span><span class='op'>==</span><span class='int'>0</span>
1091
+ <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_w'>w</span>
1092
+ <span class='kw'>else</span>
1093
+ <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='id identifier rubyid_w'>w</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_n'>n</span>
1094
+ <span class='kw'>end</span>
1095
+ <span class='kw'>end</span>
1096
+
1097
+ <span class='kw'>if</span> <span class='id identifier rubyid_pid'>pid</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@config</span> <span class='op'>!=</span> <span class='id identifier rubyid_oldconfig'>oldconfig</span>
1098
+ <span class='id identifier rubyid_write_config'>write_config</span>
1099
+ <span class='id identifier rubyid_reload'>reload</span>
1100
+ <span class='kw'>end</span>
1101
+ <span class='kw'>end</span>
1102
+
1103
+ <span class='ivar'>@config</span>
1104
+ <span class='kw'>end</span></pre>
1105
+ </td>
1106
+ </tr>
1107
+ </table>
1108
+ </div>
1109
+
1110
+ <div class="method_details ">
1111
+ <p class="signature " id="config_path-instance_method">
1112
+
1113
+ - (<tt>String</tt>) <strong>config_path</strong>
1114
+
1115
+
1116
+
1117
+ </p><div class="docstring">
1118
+ <div class="discussion">
1119
+ <p>
1120
+ Path to the temporary config file
1121
+ </p>
1122
+
1123
+
1124
+ </div>
1125
+ </div>
1126
+ <div class="tags">
1127
+
1128
+ <h3>Returns:</h3>
1129
+ <ul class="return">
1130
+
1131
+ <li>
1132
+
1133
+
1134
+ <span class='type'>(<tt>String</tt>)</span>
1135
+
1136
+
1137
+
1138
+ </li>
1139
+
1140
+ </ul>
1141
+
1142
+ </div><table class="source_code">
1143
+ <tr>
1144
+ <td>
1145
+ <pre class="lines">
1146
+
1147
+
1148
+ 29
1149
+ 30
1150
+ 31</pre>
1151
+ </td>
1152
+ <td>
1153
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 29</span>
1154
+
1155
+ <span class='kw'>def</span> <span class='id identifier rubyid_config_path'>config_path</span>
1156
+ <span class='id identifier rubyid_config_tempfile'>config_tempfile</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
1157
+ <span class='kw'>end</span></pre>
1158
+ </td>
1159
+ </tr>
1160
+ </table>
1161
+ </div>
1162
+
1163
+ <div class="method_details ">
1164
+ <p class="signature " id="config_tempfile-instance_method">
1165
+
1166
+ - (<tt>Tempfile</tt>) <strong>config_tempfile</strong>
1167
+
1168
+
1169
+
1170
+ </p><div class="docstring">
1171
+ <div class="discussion">
1172
+ <p>
1173
+ Tempfile instance for configuration file
1174
+ </p>
1175
+
1176
+
1177
+ </div>
1178
+ </div>
1179
+ <div class="tags">
1180
+
1181
+ <h3>Returns:</h3>
1182
+ <ul class="return">
1183
+
1184
+ <li>
1185
+
1186
+
1187
+ <span class='type'>(<tt>Tempfile</tt>)</span>
1188
+
1189
+
1190
+
1191
+ </li>
1192
+
1193
+ </ul>
1194
+
1195
+ </div><table class="source_code">
1196
+ <tr>
1197
+ <td>
1198
+ <pre class="lines">
1199
+
1200
+
1201
+ 22
1202
+ 23
1203
+ 24</pre>
1204
+ </td>
1205
+ <td>
1206
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 22</span>
1207
+
1208
+ <span class='kw'>def</span> <span class='id identifier rubyid_config_tempfile'>config_tempfile</span>
1209
+ <span class='ivar'>@config_tempfile</span> <span class='op'>||=</span> <span class='const'>Tempfile</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='qwords_beg'>%w(</span><span class='tstring_content'>resque-pool-dynamic</span><span class='words_sep'> </span><span class='tstring_content'>.yaml</span><span class='words_sep'>)</span><span class='rparen'>)</span>
1210
+ <span class='kw'>end</span></pre>
1211
+ </td>
1212
+ </tr>
1213
+ </table>
1214
+ </div>
1215
+
1216
+ <div class="method_details ">
1217
+ <p class="signature " id="has_log?-instance_method">
1218
+
1219
+ - (<tt>Boolean</tt>) <strong>has_log?</strong>
1220
+
1221
+
1222
+
1223
+ </p><div class="docstring">
1224
+ <div class="discussion">
1225
+ <p>
1226
+ True if we have an open log file
1227
+ </p>
1228
+
1229
+
1230
+ </div>
1231
+ </div>
1232
+ <div class="tags">
1233
+
1234
+ <h3>Returns:</h3>
1235
+ <ul class="return">
1236
+
1237
+ <li>
1238
+
1239
+
1240
+ <span class='type'>(<tt>Boolean</tt>)</span>
1241
+
1242
+
1243
+
1244
+ </li>
1245
+
1246
+ </ul>
1247
+
1248
+ </div><table class="source_code">
1249
+ <tr>
1250
+ <td>
1251
+ <pre class="lines">
1252
+
1253
+
1254
+ 24
1255
+ 25
1256
+ 26</pre>
1257
+ </td>
1258
+ <td>
1259
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 24</span>
1260
+
1261
+ <span class='kw'>def</span> <span class='id identifier rubyid_has_log?'>has_log?</span>
1262
+ <span class='op'>!</span><span class='op'>!</span><span class='ivar'>@log</span>
1263
+ <span class='kw'>end</span></pre>
1264
+ </td>
1265
+ </tr>
1266
+ </table>
1267
+ </div>
1268
+
1269
+ <div class="method_details ">
1270
+ <p class="signature " id="kill!-instance_method">
1271
+
1272
+ - (<tt>void</tt>) <strong>kill!</strong>(sig)
1273
+
1274
+
1275
+
1276
+ </p><div class="docstring">
1277
+ <div class="discussion">
1278
+ <p>
1279
+ Send signal to a running resque-pool
1280
+ </p>
1281
+
1282
+
1283
+ </div>
1284
+ </div>
1285
+ <div class="tags">
1286
+ <h3>Parameters:</h3>
1287
+ <ul class="param">
1288
+
1289
+ <li>
1290
+
1291
+ <span class='name'>sig</span>
1292
+
1293
+
1294
+ <span class='type'>(<tt>String</tt>, <tt>Integer</tt>)</span>
1295
+
1296
+
1297
+
1298
+ &mdash;
1299
+ <div class='inline'><p>
1300
+ Signal name or number
1301
+ </p>
1302
+ </div>
1303
+
1304
+ </li>
1305
+
1306
+ </ul>
1307
+
1308
+
1309
+ </div><table class="source_code">
1310
+ <tr>
1311
+ <td>
1312
+ <pre class="lines">
1313
+
1314
+
1315
+ 154
1316
+ 155
1317
+ 156</pre>
1318
+ </td>
1319
+ <td>
1320
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 154</span>
1321
+
1322
+ <span class='kw'>def</span> <span class='id identifier rubyid_kill!'>kill!</span><span class='lparen'>(</span><span class='id identifier rubyid_sig'>sig</span><span class='rparen'>)</span>
1323
+ <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span><span class='lparen'>(</span><span class='id identifier rubyid_sig'>sig</span><span class='comma'>,</span> <span class='id identifier rubyid_pid!'>pid!</span><span class='rparen'>)</span>
1324
+ <span class='kw'>end</span></pre>
1325
+ </td>
1326
+ </tr>
1327
+ </table>
1328
+ </div>
1329
+
1330
+ <div class="method_details ">
1331
+ <p class="signature " id="log-instance_method">
1332
+
1333
+ - (<tt><span class='object_link'><a href="Dynamic/Logfile.html" title="Resque::Pool::Dynamic::Logfile (class)">Logfile</a></span></tt>) <strong>log</strong>
1334
+
1335
+
1336
+
1337
+ </p><div class="docstring">
1338
+ <div class="discussion">
1339
+ <p>
1340
+ Open log of resque-pool process
1341
+ </p>
1342
+
1343
+
1344
+ </div>
1345
+ </div>
1346
+ <div class="tags">
1347
+
1348
+ <h3>Returns:</h3>
1349
+ <ul class="return">
1350
+
1351
+ <li>
1352
+
1353
+
1354
+ <span class='type'>(<tt><span class='object_link'><a href="Dynamic/Logfile.html" title="Resque::Pool::Dynamic::Logfile (class)">Logfile</a></span></tt>)</span>
1355
+
1356
+
1357
+
1358
+ &mdash;
1359
+ <div class='inline'><p>
1360
+ Logfile instance
1361
+ </p>
1362
+ </div>
1363
+
1364
+ </li>
1365
+
1366
+ </ul>
1367
+
1368
+ </div><table class="source_code">
1369
+ <tr>
1370
+ <td>
1371
+ <pre class="lines">
1372
+
1373
+
1374
+ 17
1375
+ 18
1376
+ 19
1377
+ 20</pre>
1378
+ </td>
1379
+ <td>
1380
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 17</span>
1381
+
1382
+ <span class='kw'>def</span> <span class='id identifier rubyid_log'>log</span>
1383
+ <span class='comment'># pid! call will raise an exception if process is not running yet
1384
+ </span> <span class='ivar'>@log</span> <span class='op'>||=</span> <span class='const'>Logfile</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_log_path'>log_path</span><span class='comma'>,</span> <span class='symbol'>:pid</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_pid!'>pid!</span><span class='rparen'>)</span>
1385
+ <span class='kw'>end</span></pre>
1386
+ </td>
1387
+ </tr>
1388
+ </table>
1389
+ </div>
1390
+
1391
+ <div class="method_details ">
1392
+ <p class="signature " id="log_path-instance_method">
1393
+
1394
+ - (<tt>String</tt>) <strong>log_path</strong>
1395
+
1396
+
1397
+
1398
+ </p><div class="docstring">
1399
+ <div class="discussion">
1400
+ <p>
1401
+ Logfile path
1402
+ </p>
1403
+
1404
+
1405
+ </div>
1406
+ </div>
1407
+ <div class="tags">
1408
+
1409
+ <h3>Returns:</h3>
1410
+ <ul class="return">
1411
+
1412
+ <li>
1413
+
1414
+
1415
+ <span class='type'>(<tt>String</tt>)</span>
1416
+
1417
+
1418
+
1419
+ &mdash;
1420
+ <div class='inline'><p>
1421
+ Path to the log file
1422
+ </p>
1423
+ </div>
1424
+
1425
+ </li>
1426
+
1427
+ </ul>
1428
+
1429
+ </div><table class="source_code">
1430
+ <tr>
1431
+ <td>
1432
+ <pre class="lines">
1433
+
1434
+
1435
+ 9
1436
+ 10
1437
+ 11
1438
+ 12</pre>
1439
+ </td>
1440
+ <td>
1441
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 9</span>
1442
+
1443
+ <span class='kw'>def</span> <span class='id identifier rubyid_log_path'>log_path</span>
1444
+ <span class='comment'># pid! call will raise an exception if process is not running yet
1445
+ </span> <span class='ivar'>@log_path</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RESQUE_POOL_LOG</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>resque-pool.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid!'>pid!</span><span class='rbrace'>}</span><span class='tstring_content'>.log</span><span class='tstring_end'>&quot;</span></span>
1446
+ <span class='kw'>end</span></pre>
1447
+ </td>
1448
+ </tr>
1449
+ </table>
1450
+ </div>
1451
+
1452
+ <div class="method_details ">
1453
+ <p class="signature " id="loop_with_index-instance_method">
1454
+
1455
+ - (<tt>void</tt>) <strong>loop_with_index</strong> {|i| ... }
1456
+
1457
+
1458
+
1459
+ </p><div class="docstring">
1460
+ <div class="discussion">
1461
+ <p>
1462
+ Loop, providing index to the block
1463
+ </p>
1464
+
1465
+
1466
+ </div>
1467
+ </div>
1468
+ <div class="tags">
1469
+
1470
+ <h3>Yields:</h3>
1471
+ <ul class="yield">
1472
+
1473
+ <li>
1474
+
1475
+
1476
+ <span class='type'>(<tt>i</tt>)</span>
1477
+
1478
+
1479
+
1480
+ &mdash;
1481
+ <div class='inline'><p>
1482
+ Ever increasing index
1483
+ </p>
1484
+ </div>
1485
+
1486
+ </li>
1487
+
1488
+ </ul>
1489
+
1490
+ </div><table class="source_code">
1491
+ <tr>
1492
+ <td>
1493
+ <pre class="lines">
1494
+
1495
+
1496
+ 97
1497
+ 98
1498
+ 99
1499
+ 100
1500
+ 101
1501
+ 102
1502
+ 103</pre>
1503
+ </td>
1504
+ <td>
1505
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/shell.rb', line 97</span>
1506
+
1507
+ <span class='kw'>def</span> <span class='id identifier rubyid_loop_with_index'>loop_with_index</span>
1508
+ <span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='int'>0</span>
1509
+ <span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span>
1510
+ <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1511
+ <span class='id identifier rubyid_index'>index</span> <span class='op'>+=</span> <span class='int'>1</span>
1512
+ <span class='kw'>end</span>
1513
+ <span class='kw'>end</span></pre>
1514
+ </td>
1515
+ </tr>
1516
+ </table>
1517
+ </div>
1518
+
1519
+ <div class="method_details ">
1520
+ <p class="signature " id="parse_config_string-instance_method">
1521
+
1522
+ - (<tt>Hash</tt>) <strong>parse_config_string</strong>(spec)
1523
+
1524
+
1525
+
1526
+ </p><div class="docstring">
1527
+ <div class="discussion">
1528
+ <p>
1529
+ Parse workers configuration
1530
+ </p>
1531
+
1532
+
1533
+ </div>
1534
+ </div>
1535
+ <div class="tags">
1536
+
1537
+ <div class="examples">
1538
+ <h3>Examples:</h3>
1539
+
1540
+ <h4><div class='inline'></div></h4>
1541
+ <pre class="example code"><span class='id identifier rubyid_parse_config_string'>parse_config_string</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo=1:bar=2:baz,quux=4</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
1542
+ <span class='comment'>#=&gt; {&quot;baz,quux&quot;=&gt;4, &quot;foo&quot;=&gt;1, &quot;bar&quot;=&gt;2}</span></pre>
1543
+
1544
+ </div>
1545
+ <h3>Parameters:</h3>
1546
+ <ul class="param">
1547
+
1548
+ <li>
1549
+
1550
+ <span class='name'>spec</span>
1551
+
1552
+
1553
+ <span class='type'>(<tt>String</tt>)</span>
1554
+
1555
+
1556
+
1557
+ &mdash;
1558
+ <div class='inline'><p>
1559
+ Workers specification string Format:
1560
+ queue2=number:queue2=number2:queue3,queue5=number4:*=number5
1561
+ </p>
1562
+ </div>
1563
+
1564
+ </li>
1565
+
1566
+ </ul>
1567
+
1568
+ <h3>Returns:</h3>
1569
+ <ul class="return">
1570
+
1571
+ <li>
1572
+
1573
+
1574
+ <span class='type'>(<tt>Hash</tt>)</span>
1575
+
1576
+
1577
+
1578
+ &mdash;
1579
+ <div class='inline'><p>
1580
+ Configuration dictionary
1581
+ </p>
1582
+ </div>
1583
+
1584
+ </li>
1585
+
1586
+ </ul>
1587
+
1588
+ </div><table class="source_code">
1589
+ <tr>
1590
+ <td>
1591
+ <pre class="lines">
1592
+
1593
+
1594
+ 40
1595
+ 41
1596
+ 42
1597
+ 43
1598
+ 44
1599
+ 45
1600
+ 46</pre>
1601
+ </td>
1602
+ <td>
1603
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 40</span>
1604
+
1605
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse_config_string'>parse_config_string</span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='rparen'>)</span>
1606
+ <span class='kw'>return</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_spec'>spec</span>
1607
+ <span class='const'>Hash</span><span class='lbracket'>[</span>
1608
+ <span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_w'>w</span><span class='op'>|</span>
1609
+ <span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='id identifier rubyid_w'>w</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='lbracket'>[</span> <span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='rbracket'>]</span> <span class='rbrace'>}</span>
1610
+ <span class='rbracket'>]</span>
1611
+ <span class='kw'>end</span></pre>
1612
+ </td>
1613
+ </tr>
1614
+ </table>
1615
+ </div>
1616
+
1617
+ <div class="method_details ">
1618
+ <p class="signature " id="pid!-instance_method">
1619
+
1620
+ - (<tt>Integer</tt>) <strong>pid!</strong>
1621
+
1622
+
1623
+
1624
+ </p><div class="docstring">
1625
+ <div class="discussion">
1626
+ <p>
1627
+ Return pid of running resque-pool or raise an exception
1628
+ </p>
1629
+
1630
+
1631
+ </div>
1632
+ </div>
1633
+ <div class="tags">
1634
+
1635
+ <h3>Returns:</h3>
1636
+ <ul class="return">
1637
+
1638
+ <li>
1639
+
1640
+
1641
+ <span class='type'>(<tt>Integer</tt>)</span>
1642
+
1643
+
1644
+
1645
+ </li>
1646
+
1647
+ </ul>
1648
+ <h3>Raises:</h3>
1649
+ <ul class="raise">
1650
+
1651
+ <li>
1652
+
1653
+
1654
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
1655
+
1656
+
1657
+
1658
+ </li>
1659
+
1660
+ </ul>
1661
+
1662
+ </div><table class="source_code">
1663
+ <tr>
1664
+ <td>
1665
+ <pre class="lines">
1666
+
1667
+
1668
+ 147
1669
+ 148
1670
+ 149</pre>
1671
+ </td>
1672
+ <td>
1673
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 147</span>
1674
+
1675
+ <span class='kw'>def</span> <span class='id identifier rubyid_pid!'>pid!</span>
1676
+ <span class='id identifier rubyid_pid'>pid</span> <span class='kw'>or</span> <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Not started!</span><span class='tstring_end'>&quot;</span></span>
1677
+ <span class='kw'>end</span></pre>
1678
+ </td>
1679
+ </tr>
1680
+ </table>
1681
+ </div>
1682
+
1683
+ <div class="method_details ">
1684
+ <p class="signature " id="pstree-instance_method">
1685
+
1686
+ - (<tt>void</tt>) <strong>pstree</strong>
1687
+
1688
+
1689
+
1690
+ </p><div class="docstring">
1691
+ <div class="discussion">
1692
+ <p>
1693
+ Show child process tree by calling `pstree` system command
1694
+ </p>
1695
+
1696
+
1697
+ </div>
1698
+ </div>
1699
+ <div class="tags">
1700
+
1701
+
1702
+ </div><table class="source_code">
1703
+ <tr>
1704
+ <td>
1705
+ <pre class="lines">
1706
+
1707
+
1708
+ 189
1709
+ 190
1710
+ 191
1711
+ 192
1712
+ 193
1713
+ 194
1714
+ 195
1715
+ 196
1716
+ 197
1717
+ 198
1718
+ 199</pre>
1719
+ </td>
1720
+ <td>
1721
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 189</span>
1722
+
1723
+ <span class='kw'>def</span> <span class='id identifier rubyid_pstree'>pstree</span>
1724
+ <span class='id identifier rubyid_system'>system</span> <span class='kw'>case</span> <span class='const'>RUBY_PLATFORM</span>
1725
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>darwin</span><span class='regexp_end'>/</span></span>
1726
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pstree -w </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid!'>pid!</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1727
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>linux</span><span class='regexp_end'>/</span></span>
1728
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pstree -l -a -p </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid!'>pid!</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1729
+ <span class='kw'>else</span>
1730
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pstree </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid!'>pid!</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1731
+ <span class='kw'>end</span>
1732
+ <span class='kw'>nil</span>
1733
+ <span class='kw'>end</span></pre>
1734
+ </td>
1735
+ </tr>
1736
+ </table>
1737
+ </div>
1738
+
1739
+ <div class="method_details ">
1740
+ <p class="signature " id="reload-instance_method">
1741
+
1742
+ - (<tt>void</tt>) <strong>reload</strong>
1743
+
1744
+
1745
+
1746
+ </p><div class="docstring">
1747
+ <div class="discussion">
1748
+ <p>
1749
+ Reload resque-pool configuration
1750
+ </p>
1751
+
1752
+
1753
+ </div>
1754
+ </div>
1755
+ <div class="tags">
1756
+
1757
+
1758
+ </div><table class="source_code">
1759
+ <tr>
1760
+ <td>
1761
+ <pre class="lines">
1762
+
1763
+
1764
+ 181
1765
+ 182
1766
+ 183
1767
+ 184
1768
+ 185</pre>
1769
+ </td>
1770
+ <td>
1771
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 181</span>
1772
+
1773
+ <span class='kw'>def</span> <span class='id identifier rubyid_reload'>reload</span>
1774
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Reloading resque-pool-master </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid!'>pid!</span><span class='rbrace'>}</span><span class='tstring_content'> configuration</span><span class='tstring_end'>&quot;</span></span>
1775
+ <span class='id identifier rubyid_write_config'>write_config</span>
1776
+ <span class='id identifier rubyid_kill!'>kill!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HUP</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
1777
+ <span class='kw'>end</span></pre>
1778
+ </td>
1779
+ </tr>
1780
+ </table>
1781
+ </div>
1782
+
1783
+ <div class="method_details ">
1784
+ <p class="signature " id="run_pool-instance_method">
1785
+
1786
+ - (<tt>void</tt>) <strong>run_pool</strong>
1787
+
1788
+
1789
+
1790
+ </p><div class="docstring">
1791
+ <div class="discussion">
1792
+ <p>
1793
+ Start resque-pool master This is executed in a forked child process.
1794
+ </p>
1795
+
1796
+
1797
+ </div>
1798
+ </div>
1799
+ <div class="tags">
1800
+
1801
+
1802
+ </div><table class="source_code">
1803
+ <tr>
1804
+ <td>
1805
+ <pre class="lines">
1806
+
1807
+
1808
+ 100
1809
+ 101
1810
+ 102
1811
+ 103
1812
+ 104
1813
+ 105
1814
+ 106
1815
+ 107
1816
+ 108
1817
+ 109
1818
+ 110
1819
+ 111
1820
+ 112</pre>
1821
+ </td>
1822
+ <td>
1823
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 100</span>
1824
+
1825
+ <span class='kw'>def</span> <span class='id identifier rubyid_run_pool'>run_pool</span>
1826
+ <span class='ivar'>@pid</span> <span class='op'>=</span> <span class='gvar'>$$</span>
1827
+ <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>RESQUE_POOL_CONFIG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_config_path'>config_path</span>
1828
+
1829
+ <span class='gvar'>$stdin</span><span class='period'>.</span><span class='id identifier rubyid_reopen'>reopen</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/dev/null</span><span class='tstring_end'>'</span></span>
1830
+ <span class='id identifier rubyid_log'>log</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_log_path'>log_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>a</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1831
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_reopen'>reopen</span> <span class='id identifier rubyid_log'>log</span>
1832
+ <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_reopen'>reopen</span> <span class='id identifier rubyid_log'>log</span>
1833
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_sync'>sync</span> <span class='op'>=</span> <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_sync'>sync</span> <span class='op'>=</span> <span class='kw'>true</span>
1834
+
1835
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rake</span><span class='tstring_end'>'</span></span>
1836
+ <span class='const'>Rake</span><span class='op'>::</span><span class='const'>Task</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>resque:pool</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_invoke'>invoke</span>
1837
+ <span class='kw'>end</span></pre>
1838
+ </td>
1839
+ </tr>
1840
+ </table>
1841
+ </div>
1842
+
1843
+ <div class="method_details ">
1844
+ <p class="signature " id="start-instance_method">
1845
+
1846
+ - (<tt>void</tt>) <strong>start</strong>
1847
+
1848
+
1849
+
1850
+ </p><div class="docstring">
1851
+ <div class="discussion">
1852
+ <p>
1853
+ Start resque-pool, showing startup logs
1854
+ </p>
1855
+
1856
+
1857
+ </div>
1858
+ </div>
1859
+ <div class="tags">
1860
+
1861
+
1862
+ </div><table class="source_code">
1863
+ <tr>
1864
+ <td>
1865
+ <pre class="lines">
1866
+
1867
+
1868
+ 134
1869
+ 135
1870
+ 136
1871
+ 137
1872
+ 138
1873
+ 139
1874
+ 140
1875
+ 141
1876
+ 142</pre>
1877
+ </td>
1878
+ <td>
1879
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 134</span>
1880
+
1881
+ <span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span>
1882
+ <span class='kw'>unless</span> <span class='id identifier rubyid_pid'>pid</span>
1883
+ <span class='id identifier rubyid_start!'>start!</span>
1884
+ <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_rewind'>rewind</span>
1885
+ <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_tail_until'>tail_until</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>started manager</span><span class='regexp_end'>/</span></span>
1886
+ <span class='kw'>else</span>
1887
+ <span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Already started as </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid'>pid</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1888
+ <span class='kw'>end</span>
1889
+ <span class='kw'>end</span></pre>
1890
+ </td>
1891
+ </tr>
1892
+ </table>
1893
+ </div>
1894
+
1895
+ <div class="method_details ">
1896
+ <p class="signature " id="start!-instance_method">
1897
+
1898
+ - (<tt>Integer</tt>) <strong>start!</strong>
1899
+
1900
+
1901
+
1902
+ </p><div class="docstring">
1903
+ <div class="discussion">
1904
+ <p>
1905
+ Fork a child process for resque-pool master
1906
+ </p>
1907
+
1908
+
1909
+ </div>
1910
+ </div>
1911
+ <div class="tags">
1912
+
1913
+ <h3>Returns:</h3>
1914
+ <ul class="return">
1915
+
1916
+ <li>
1917
+
1918
+
1919
+ <span class='type'>(<tt>Integer</tt>)</span>
1920
+
1921
+
1922
+
1923
+ &mdash;
1924
+ <div class='inline'><p>
1925
+ PID of the child process
1926
+ </p>
1927
+ </div>
1928
+
1929
+ </li>
1930
+
1931
+ </ul>
1932
+
1933
+ </div><table class="source_code">
1934
+ <tr>
1935
+ <td>
1936
+ <pre class="lines">
1937
+
1938
+
1939
+ 117
1940
+ 118
1941
+ 119
1942
+ 120
1943
+ 121
1944
+ 122
1945
+ 123
1946
+ 124
1947
+ 125
1948
+ 126
1949
+ 127
1950
+ 128
1951
+ 129
1952
+ 130</pre>
1953
+ </td>
1954
+ <td>
1955
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 117</span>
1956
+
1957
+ <span class='kw'>def</span> <span class='id identifier rubyid_start!'>start!</span>
1958
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Already running: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid'>pid</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_pid'>pid</span>
1959
+ <span class='id identifier rubyid_write_config'>write_config</span>
1960
+ <span class='ivar'>@pid</span> <span class='op'>=</span> <span class='id identifier rubyid_fork'>fork</span> <span class='lbrace'>{</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_run_pool'>run_pool</span> <span class='rbrace'>}</span>
1961
+ <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_setpgid'>setpgid</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='comment'># don't broadcast ^C to child
1962
+ </span>
1963
+ <span class='kw'>if</span> <span class='int'>30</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_sleep'>sleep</span> <span class='int'>1</span> <span class='semicolon'>;</span> <span class='kw'>break</span> <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span> <span class='id identifier rubyid_log_path'>log_path</span> <span class='rbrace'>}</span>
1964
+ <span class='comment'># Loop will return nil if broken. If value is returned, file does not exist.
1965
+ </span> <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Log file </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_log_path'>log_path</span><span class='rbrace'>}</span><span class='tstring_content'> still not present after </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='rbrace'>}</span><span class='tstring_content'> seconds, giving up</span><span class='tstring_end'>&quot;</span></span>
1966
+ <span class='id identifier rubyid_stop!'>stop!</span>
1967
+ <span class='kw'>end</span>
1968
+
1969
+ <span class='id identifier rubyid_pid'>pid</span>
1970
+ <span class='kw'>end</span></pre>
1971
+ </td>
1972
+ </tr>
1973
+ </table>
1974
+ </div>
1975
+
1976
+ <div class="method_details ">
1977
+ <p class="signature " id="status-instance_method">
1978
+
1979
+ - (<tt>void</tt>) <strong>status</strong>
1980
+
1981
+
1982
+
1983
+ </p><div class="docstring">
1984
+ <div class="discussion">
1985
+ <p>
1986
+ Show current status
1987
+ </p>
1988
+
1989
+
1990
+ </div>
1991
+ </div>
1992
+ <div class="tags">
1993
+
1994
+
1995
+ </div><table class="source_code">
1996
+ <tr>
1997
+ <td>
1998
+ <pre class="lines">
1999
+
2000
+
2001
+ 203
2002
+ 204
2003
+ 205
2004
+ 206
2005
+ 207
2006
+ 208
2007
+ 209
2008
+ 210
2009
+ 211
2010
+ 212
2011
+ 213
2012
+ 214</pre>
2013
+ </td>
2014
+ <td>
2015
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 203</span>
2016
+
2017
+ <span class='kw'>def</span> <span class='id identifier rubyid_status'>status</span>
2018
+ <span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
2019
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Status: </span><span class='tstring_end'>&quot;</span></span> <span class='op'>&lt;&lt;</span> <span class='lparen'>(</span> <span class='id identifier rubyid_pid'>pid</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>running, pid: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid'>pid</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>not running</span><span class='tstring_end'>&quot;</span></span> <span class='rparen'>)</span><span class='comma'>,</span>
2020
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Configuration:</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
2021
+ <span class='const'>YAML</span><span class='op'>::</span><span class='id identifier rubyid_dump'>dump</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_grep'>grep</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(?!---\s*$)</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span>
2022
+ <span class='rparen'>)</span>
2023
+ <span class='kw'>if</span> <span class='id identifier rubyid_pid'>pid</span>
2024
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Process tree:</span><span class='tstring_end'>&quot;</span></span>
2025
+ <span class='id identifier rubyid_pstree'>pstree</span>
2026
+ <span class='kw'>end</span>
2027
+ <span class='id identifier rubyid_puts'>puts</span>
2028
+ <span class='kw'>end</span></pre>
2029
+ </td>
2030
+ </tr>
2031
+ </table>
2032
+ </div>
2033
+
2034
+ <div class="method_details ">
2035
+ <p class="signature " id="stop-instance_method">
2036
+
2037
+ - (<tt>void</tt>) <strong>stop</strong>
2038
+
2039
+
2040
+
2041
+ </p><div class="docstring">
2042
+ <div class="discussion">
2043
+ <p>
2044
+ Stop running resque-pool, show shutdown logs
2045
+ </p>
2046
+
2047
+
2048
+ </div>
2049
+ </div>
2050
+ <div class="tags">
2051
+
2052
+
2053
+ </div><table class="source_code">
2054
+ <tr>
2055
+ <td>
2056
+ <pre class="lines">
2057
+
2058
+
2059
+ 171
2060
+ 172
2061
+ 173
2062
+ 174
2063
+ 175
2064
+ 176
2065
+ 177</pre>
2066
+ </td>
2067
+ <td>
2068
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 171</span>
2069
+
2070
+ <span class='kw'>def</span> <span class='id identifier rubyid_stop'>stop</span>
2071
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Shutting down resque-pool-master </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pid'>pid</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
2072
+ <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_ff'>ff</span> <span class='kw'>if</span> <span class='id identifier rubyid_has_log?'>has_log?</span>
2073
+ <span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='id identifier rubyid_stop!'>stop!</span>
2074
+ <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_tail'>tail</span> <span class='kw'>if</span> <span class='id identifier rubyid_has_log?'>has_log?</span>
2075
+ <span class='kw'>return</span> <span class='id identifier rubyid_status'>status</span>
2076
+ <span class='kw'>end</span></pre>
2077
+ </td>
2078
+ </tr>
2079
+ </table>
2080
+ </div>
2081
+
2082
+ <div class="method_details ">
2083
+ <p class="signature " id="stop!-instance_method">
2084
+
2085
+ - (<tt>void</tt>) <strong>stop!</strong>
2086
+
2087
+
2088
+
2089
+ </p><div class="docstring">
2090
+ <div class="discussion">
2091
+ <p>
2092
+ Stop running resque-pool
2093
+ </p>
2094
+
2095
+
2096
+ </div>
2097
+ </div>
2098
+ <div class="tags">
2099
+
2100
+
2101
+ </div><table class="source_code">
2102
+ <tr>
2103
+ <td>
2104
+ <pre class="lines">
2105
+
2106
+
2107
+ 160
2108
+ 161
2109
+ 162
2110
+ 163
2111
+ 164
2112
+ 165
2113
+ 166
2114
+ 167</pre>
2115
+ </td>
2116
+ <td>
2117
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 160</span>
2118
+
2119
+ <span class='kw'>def</span> <span class='id identifier rubyid_stop!'>stop!</span>
2120
+ <span class='kw'>if</span> <span class='id identifier rubyid_pid'>pid</span>
2121
+ <span class='id identifier rubyid_kill!'>kill!</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INT</span><span class='tstring_end'>&quot;</span></span>
2122
+ <span class='id identifier rubyid_wpid'>wpid</span><span class='comma'>,</span> <span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_wait2'>wait2</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
2123
+ <span class='ivar'>@pid</span> <span class='op'>=</span> <span class='kw'>nil</span>
2124
+ <span class='id identifier rubyid_status'>status</span>
2125
+ <span class='kw'>end</span>
2126
+ <span class='kw'>end</span></pre>
2127
+ </td>
2128
+ </tr>
2129
+ </table>
2130
+ </div>
2131
+
2132
+ <div class="method_details ">
2133
+ <p class="signature " id="write_config-instance_method">
2134
+
2135
+ - (<tt>void</tt>) <strong>write_config</strong>
2136
+
2137
+
2138
+
2139
+ </p><div class="docstring">
2140
+ <div class="discussion">
2141
+ <p>
2142
+ Write temporary configuration file
2143
+ </p>
2144
+
2145
+
2146
+ </div>
2147
+ </div>
2148
+ <div class="tags">
2149
+
2150
+
2151
+ </div><table class="source_code">
2152
+ <tr>
2153
+ <td>
2154
+ <pre class="lines">
2155
+
2156
+
2157
+ 92
2158
+ 93
2159
+ 94
2160
+ 95
2161
+ 96</pre>
2162
+ </td>
2163
+ <td>
2164
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic.rb', line 92</span>
2165
+
2166
+ <span class='kw'>def</span> <span class='id identifier rubyid_write_config'>write_config</span>
2167
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_config_path'>config_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cf'>cf</span><span class='op'>|</span>
2168
+ <span class='id identifier rubyid_cf'>cf</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>YAML</span><span class='op'>::</span><span class='id identifier rubyid_dump'>dump</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span><span class='rparen'>)</span>
2169
+ <span class='kw'>end</span>
2170
+ <span class='kw'>end</span></pre>
2171
+ </td>
2172
+ </tr>
2173
+ </table>
2174
+ </div>
2175
+
2176
+ </div>
2177
+
2178
+ </div>
2179
+
2180
+ <div id="footer">
2181
+ Generated on Wed Apr 25 21:03:03 2012 by
2182
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2183
+ 0.7.5 (ruby-1.9.2).
2184
+ </div>
2185
+
2186
+ </body>
2187
+ </html>