resque_ui 3.2.3 → 3.2.4
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/History.txt +5 -0
- data/VERSION.yml +1 -1
- data/app/views/resque/cleaner_list.html.erb +1 -1
- data/lib/resque_ui.rb +1 -0
- data/lib/resque_ui/overrides/resque/failure/redis.rb +11 -0
- data/rdoc/Object.html +147 -160
- data/rdoc/Redis.html +185 -0
- data/rdoc/Resque.html +148 -186
- data/rdoc/Resque/ChainedJobWithStatus.html +195 -214
- data/rdoc/Resque/Failure.html +134 -0
- data/rdoc/Resque/Failure/Redis.html +187 -0
- data/rdoc/Resque/Job.html +149 -162
- data/rdoc/Resque/JobWithStatus.html +351 -390
- data/rdoc/Resque/Status.html +265 -293
- data/rdoc/Resque/Worker.html +758 -851
- data/rdoc/ResqueScheduler.html +277 -306
- data/rdoc/ResqueUi.html +114 -136
- data/rdoc/ResqueUi/Cap.html +118 -128
- data/rdoc/ResqueUi/Engine.html +118 -128
- data/rdoc/created.rid +3 -2
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/index.html +78 -166
- data/rdoc/js/darkfish.js +99 -62
- data/rdoc/js/jquery.js +15 -29
- data/rdoc/js/navigation.js +142 -0
- data/rdoc/js/search.js +94 -0
- data/rdoc/js/search_index.js +1 -0
- data/rdoc/js/searcher.js +228 -0
- data/rdoc/rdoc.css +119 -339
- data/rdoc/table_of_contents.html +196 -0
- data/resque_ui.gemspec +15 -2
- metadata +15 -2
data/rdoc/Resque/Worker.html
CHANGED
@@ -1,227 +1,217 @@
|
|
1
|
-
|
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" />
|
1
|
+
<!DOCTYPE html>
|
7
2
|
|
8
|
-
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
9
6
|
|
10
|
-
|
7
|
+
<title>Class: Resque::Worker</title>
|
11
8
|
|
12
|
-
|
13
|
-
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
-
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
-
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
16
10
|
|
17
|
-
|
18
|
-
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<a href="../index.html#methods">Methods</a>
|
27
|
-
</h3>
|
28
|
-
</div>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
<div id="file-metadata">
|
32
|
-
<div id="file-list-section" class="section">
|
33
|
-
<h3 class="section-header">In Files</h3>
|
34
|
-
<div class="section-body">
|
35
|
-
<ul>
|
36
|
-
|
37
|
-
<li><a href="../lib/resque_ui/overrides/resque/worker_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
-
class="thickbox" title="lib/resque_ui/overrides/resque/worker.rb">lib/resque_ui/overrides/resque/worker.rb</a></li>
|
39
|
-
|
40
|
-
</ul>
|
41
|
-
</div>
|
42
|
-
</div>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
43
21
|
|
44
|
-
|
45
|
-
</div>
|
46
22
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/resque_ui/overrides/resque/worker.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
57
53
|
|
58
|
-
|
54
|
+
|
55
|
+
</div>
|
59
56
|
|
60
|
-
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link"><a href="../Object.html">Object</a>
|
63
|
+
|
64
|
+
</nav>
|
61
65
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
<ul class="link-list">
|
67
|
-
|
68
|
-
<li><a href="#method-c-start">::start</a></li>
|
69
|
-
|
70
|
-
<li><a href="#method-c-working">::working</a></li>
|
71
|
-
|
72
|
-
<li><a href="#method-i-all_workers_in_pid_working">#all_workers_in_pid_working</a></li>
|
73
|
-
|
74
|
-
<li><a href="#method-i-continue">#continue</a></li>
|
75
|
-
|
76
|
-
<li><a href="#method-i-id">#id</a></li>
|
77
|
-
|
78
|
-
<li><a href="#method-i-ip">#ip</a></li>
|
79
|
-
|
80
|
-
<li><a href="#method-i-local_ip">#local_ip</a></li>
|
81
|
-
|
82
|
-
<li><a href="#method-i-pause">#pause</a></li>
|
83
|
-
|
84
|
-
<li><a href="#method-i-pause_key">#pause_key</a></li>
|
85
|
-
|
86
|
-
<li><a href="#method-i-pause_processing">#pause_processing</a></li>
|
87
|
-
|
88
|
-
<li><a href="#method-i-paused">#paused</a></li>
|
89
|
-
|
90
|
-
<li><a href="#method-i-paused-3F">#paused?</a></li>
|
91
|
-
|
92
|
-
<li><a href="#method-i-prune_dead_workers">#prune_dead_workers</a></li>
|
93
|
-
|
94
|
-
<li><a href="#method-i-queue">#queue</a></li>
|
95
|
-
|
96
|
-
<li><a href="#method-i-queues">#queues</a></li>
|
97
|
-
|
98
|
-
<li><a href="#method-i-queues_in_pid">#queues_in_pid</a></li>
|
99
|
-
|
100
|
-
<li><a href="#method-i-quit">#quit</a></li>
|
101
|
-
|
102
|
-
<li><a href="#method-i-restart">#restart</a></li>
|
103
|
-
|
104
|
-
<li><a href="#method-i-shutdown">#shutdown</a></li>
|
105
|
-
|
106
|
-
<li><a href="#method-i-startup">#startup</a></li>
|
107
|
-
|
108
|
-
<li><a href="#method-i-status">#status</a></li>
|
109
|
-
|
110
|
-
<li><a href="#method-i-status-3D">#status=</a></li>
|
111
|
-
|
112
|
-
<li><a href="#method-i-thread">#thread</a></li>
|
113
|
-
|
114
|
-
<li><a href="#method-i-to_s">#to_s</a></li>
|
115
|
-
|
116
|
-
<li><a href="#method-i-unpause_processing">#unpause_processing</a></li>
|
117
|
-
|
118
|
-
<li><a href="#method-i-unregister_worker">#unregister_worker</a></li>
|
119
|
-
|
120
|
-
<li><a href="#method-i-work">#work</a></li>
|
121
|
-
|
122
|
-
<li><a href="#method-i-workers_in_pid">#workers_in_pid</a></li>
|
123
|
-
|
124
|
-
</ul>
|
125
|
-
</div>
|
126
|
-
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
127
70
|
|
128
|
-
|
129
|
-
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-start">::start</a>
|
74
|
+
|
75
|
+
<li><a href="#method-c-working">::working</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-all_workers_in_pid_working">#all_workers_in_pid_working</a>
|
78
|
+
|
79
|
+
<li><a href="#method-i-continue">#continue</a>
|
80
|
+
|
81
|
+
<li><a href="#method-i-id">#id</a>
|
82
|
+
|
83
|
+
<li><a href="#method-i-ip">#ip</a>
|
84
|
+
|
85
|
+
<li><a href="#method-i-local_ip">#local_ip</a>
|
86
|
+
|
87
|
+
<li><a href="#method-i-pause">#pause</a>
|
88
|
+
|
89
|
+
<li><a href="#method-i-pause_key">#pause_key</a>
|
90
|
+
|
91
|
+
<li><a href="#method-i-pause_processing">#pause_processing</a>
|
92
|
+
|
93
|
+
<li><a href="#method-i-paused">#paused</a>
|
94
|
+
|
95
|
+
<li><a href="#method-i-paused-3F">#paused?</a>
|
96
|
+
|
97
|
+
<li><a href="#method-i-prune_dead_workers">#prune_dead_workers</a>
|
98
|
+
|
99
|
+
<li><a href="#method-i-queue">#queue</a>
|
100
|
+
|
101
|
+
<li><a href="#method-i-queues">#queues</a>
|
102
|
+
|
103
|
+
<li><a href="#method-i-queues_in_pid">#queues_in_pid</a>
|
104
|
+
|
105
|
+
<li><a href="#method-i-quit">#quit</a>
|
106
|
+
|
107
|
+
<li><a href="#method-i-restart">#restart</a>
|
108
|
+
|
109
|
+
<li><a href="#method-i-shutdown">#shutdown</a>
|
110
|
+
|
111
|
+
<li><a href="#method-i-startup">#startup</a>
|
112
|
+
|
113
|
+
<li><a href="#method-i-status">#status</a>
|
114
|
+
|
115
|
+
<li><a href="#method-i-status-3D">#status=</a>
|
116
|
+
|
117
|
+
<li><a href="#method-i-thread">#thread</a>
|
118
|
+
|
119
|
+
<li><a href="#method-i-to_s">#to_s</a>
|
120
|
+
|
121
|
+
<li><a href="#method-i-unpause_processing">#unpause_processing</a>
|
122
|
+
|
123
|
+
<li><a href="#method-i-unregister_worker">#unregister_worker</a>
|
124
|
+
|
125
|
+
<li><a href="#method-i-work">#work</a>
|
126
|
+
|
127
|
+
<li><a href="#method-i-workers_in_pid">#workers_in_pid</a>
|
128
|
+
|
129
|
+
</ul>
|
130
|
+
</nav>
|
130
131
|
|
131
|
-
|
132
|
-
|
133
|
-
|
132
|
+
</div>
|
134
133
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
title="show/hide quicksearch" /></span></h3>
|
140
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
141
|
-
<fieldset>
|
142
|
-
<legend>Quicksearch</legend>
|
143
|
-
<input type="text" name="quicksearch" value=""
|
144
|
-
class="quicksearch-field" />
|
145
|
-
</fieldset>
|
146
|
-
</form>
|
134
|
+
<div id="project-metadata">
|
135
|
+
|
136
|
+
<nav id="classindex-section" class="section project-section">
|
137
|
+
<h3 class="section-header">Class and Module Index</h3>
|
147
138
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
139
|
+
<ul class="link-list">
|
140
|
+
|
141
|
+
<li><a href="../Resque.html">Resque</a>
|
142
|
+
|
143
|
+
<li><a href="../Resque/ChainedJobWithStatus.html">Resque::ChainedJobWithStatus</a>
|
144
|
+
|
145
|
+
<li><a href="../Resque/Failure.html">Resque::Failure</a>
|
146
|
+
|
147
|
+
<li><a href="../Resque/Failure/Redis.html">Resque::Failure::Redis</a>
|
148
|
+
|
149
|
+
<li><a href="../Resque/Job.html">Resque::Job</a>
|
150
|
+
|
151
|
+
<li><a href="../Resque/JobWithStatus.html">Resque::JobWithStatus</a>
|
152
|
+
|
153
|
+
<li><a href="../Resque/Status.html">Resque::Status</a>
|
154
|
+
|
155
|
+
<li><a href="../Resque/Worker.html">Resque::Worker</a>
|
156
|
+
|
157
|
+
<li><a href="../ResqueUi.html">ResqueUi</a>
|
158
|
+
|
159
|
+
<li><a href="../ResqueUi/Cap.html">ResqueUi::Cap</a>
|
160
|
+
|
161
|
+
<li><a href="../ResqueUi/Engine.html">ResqueUi::Engine</a>
|
162
|
+
|
163
|
+
<li><a href="../Object.html">Object</a>
|
164
|
+
|
165
|
+
<li><a href="../ResqueScheduler.html">ResqueScheduler</a>
|
166
|
+
|
167
|
+
</ul>
|
168
|
+
</nav>
|
175
169
|
|
176
|
-
|
177
|
-
</div>
|
178
170
|
</div>
|
171
|
+
</nav>
|
179
172
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
<div id="description" class="description">
|
184
|
-
|
185
|
-
</div><!-- description -->
|
173
|
+
<div id="documentation">
|
174
|
+
<h1 class="class">class Resque::Worker</h1>
|
186
175
|
|
176
|
+
<div id="description" class="description">
|
187
177
|
|
178
|
+
</div><!-- description -->
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
188
184
|
|
189
|
-
|
190
|
-
<div id="5Buntitled-5D" class="documentation-section">
|
191
|
-
|
192
185
|
|
193
|
-
|
186
|
+
|
194
187
|
|
195
|
-
|
188
|
+
|
196
189
|
|
197
|
-
|
190
|
+
|
198
191
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
192
|
+
<!-- Methods -->
|
193
|
+
|
194
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
195
|
+
<h3 class="section-header">Public Class Methods</h3>
|
203
196
|
|
204
|
-
|
205
|
-
|
206
|
-
|
197
|
+
|
198
|
+
<div id="method-c-start" class="method-detail ">
|
199
|
+
|
200
|
+
<div class="method-heading">
|
201
|
+
<span class="method-name">start</span><span
|
202
|
+
class="method-args">(ips, queues)</span>
|
203
|
+
<span class="method-click-advice">click to toggle source</span>
|
204
|
+
</div>
|
205
|
+
|
207
206
|
|
207
|
+
<div class="method-description">
|
208
|
+
|
208
209
|
|
209
|
-
<div class="method-heading">
|
210
|
-
<span class="method-name">start</span><span
|
211
|
-
class="method-args">(ips, queues)</span>
|
212
|
-
<span class="method-click-advice">click to toggle source</span>
|
213
|
-
</div>
|
214
210
|
|
215
211
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
<div class="method-source-code" id="start-source">
|
223
|
-
<pre>
|
224
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 234</span>
|
212
|
+
|
213
|
+
<div class="method-source-code" id="start-source">
|
214
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 234</span>
|
225
215
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">ips</span>, <span class="ruby-identifier">queues</span>)
|
226
216
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/development|test/</span>
|
227
217
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">queues</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">queue</span><span class="ruby-operator">|</span> <span class="ruby-identifier">system</span>(<span class="ruby-node">"rake RAILS_ENV=#{Rails.env} QUEUE=#{queue} resque:work"</span>) }
|
@@ -229,37 +219,34 @@
|
|
229
219
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">queues</span>, <span class="ruby-identifier">ips</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">queue</span>, <span class="ruby-identifier">ip_list</span><span class="ruby-operator">|</span> <span class="ruby-identifier">system</span>(<span class="ruby-node">"cd #{Rails.root}; #{ResqueUi::Cap.path} #{Rails.env} resque:work host=#{ip_list} queue=#{queue}"</span>) }
|
230
220
|
<span class="ruby-keyword">end</span>
|
231
221
|
<span class="ruby-keyword">end</span></pre>
|
232
|
-
|
233
|
-
|
234
|
-
</div>
|
235
|
-
|
222
|
+
</div><!-- start-source -->
|
236
223
|
|
224
|
+
</div>
|
237
225
|
|
238
|
-
|
239
|
-
</div><!-- start-method -->
|
226
|
+
|
240
227
|
|
241
|
-
|
242
|
-
|
243
|
-
<a name="method-c-working"></a>
|
228
|
+
|
229
|
+
</div><!-- start-method -->
|
244
230
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
231
|
+
|
232
|
+
<div id="method-c-working" class="method-detail ">
|
233
|
+
|
234
|
+
<div class="method-heading">
|
235
|
+
<span class="method-name">working</span><span
|
236
|
+
class="method-args">()</span>
|
237
|
+
<span class="method-click-advice">click to toggle source</span>
|
238
|
+
</div>
|
239
|
+
|
252
240
|
|
253
|
-
|
254
|
-
|
255
|
-
|
241
|
+
<div class="method-description">
|
242
|
+
|
243
|
+
<p>logic for mappged_mget changed where it returns keys with nil values in
|
256
244
|
latest redis gem.</p>
|
257
|
-
|
245
|
+
|
258
246
|
|
259
|
-
|
260
|
-
|
261
|
-
<pre>
|
262
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 216</span>
|
247
|
+
|
248
|
+
<div class="method-source-code" id="working-source">
|
249
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 216</span>
|
263
250
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">working</span>
|
264
251
|
<span class="ruby-identifier">names</span> = <span class="ruby-identifier">all</span>
|
265
252
|
<span class="ruby-keyword">return</span> [] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">names</span>.<span class="ruby-identifier">any?</span>
|
@@ -268,75 +255,69 @@ latest redis gem.</p>
|
|
268
255
|
<span class="ruby-identifier">find</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-string">"worker:"</span>, <span class="ruby-string">''</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
269
256
|
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">compact</span>
|
270
257
|
<span class="ruby-keyword">end</span></pre>
|
271
|
-
|
272
|
-
|
273
|
-
</div>
|
274
|
-
|
258
|
+
</div><!-- working-source -->
|
275
259
|
|
260
|
+
</div>
|
276
261
|
|
277
|
-
|
278
|
-
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</div><!-- working-method -->
|
279
266
|
|
280
|
-
|
281
|
-
</div><!-- public-class-method-details -->
|
282
267
|
|
283
|
-
|
284
|
-
|
268
|
+
</section><!-- public-class-method-details -->
|
269
|
+
|
270
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
271
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
285
272
|
|
286
|
-
|
287
|
-
|
288
|
-
|
273
|
+
|
274
|
+
<div id="method-i-all_workers_in_pid_working" class="method-detail ">
|
275
|
+
|
276
|
+
<div class="method-heading">
|
277
|
+
<span class="method-name">all_workers_in_pid_working</span><span
|
278
|
+
class="method-args">()</span>
|
279
|
+
<span class="method-click-advice">click to toggle source</span>
|
280
|
+
</div>
|
281
|
+
|
289
282
|
|
283
|
+
<div class="method-description">
|
284
|
+
|
290
285
|
|
291
|
-
<div class="method-heading">
|
292
|
-
<span class="method-name">all_workers_in_pid_working</span><span
|
293
|
-
class="method-args">()</span>
|
294
|
-
<span class="method-click-advice">click to toggle source</span>
|
295
|
-
</div>
|
296
286
|
|
297
287
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
<div class="method-source-code" id="all_workers_in_pid_working-source">
|
305
|
-
<pre>
|
306
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 153</span>
|
288
|
+
|
289
|
+
<div class="method-source-code" id="all_workers_in_pid_working-source">
|
290
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 153</span>
|
307
291
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">all_workers_in_pid_working</span>
|
308
292
|
<span class="ruby-identifier">workers_in_pid</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">hash</span> = <span class="ruby-identifier">w</span>.<span class="ruby-identifier">processing</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">hash</span>.<span class="ruby-identifier">empty?</span> }
|
309
293
|
<span class="ruby-keyword">end</span></pre>
|
310
|
-
|
311
|
-
|
312
|
-
</div>
|
313
|
-
|
294
|
+
</div><!-- all_workers_in_pid_working-source -->
|
314
295
|
|
296
|
+
</div>
|
315
297
|
|
316
|
-
|
317
|
-
</div><!-- all_workers_in_pid_working-method -->
|
298
|
+
|
318
299
|
|
319
|
-
|
320
|
-
|
321
|
-
<a name="method-i-continue"></a>
|
300
|
+
|
301
|
+
</div><!-- all_workers_in_pid_working-method -->
|
322
302
|
|
303
|
+
|
304
|
+
<div id="method-i-continue" class="method-detail ">
|
305
|
+
|
306
|
+
<div class="method-heading">
|
307
|
+
<span class="method-name">continue</span><span
|
308
|
+
class="method-args">()</span>
|
309
|
+
<span class="method-click-advice">click to toggle source</span>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
<div class="method-description">
|
314
|
+
|
323
315
|
|
324
|
-
<div class="method-heading">
|
325
|
-
<span class="method-name">continue</span><span
|
326
|
-
class="method-args">()</span>
|
327
|
-
<span class="method-click-advice">click to toggle source</span>
|
328
|
-
</div>
|
329
316
|
|
330
317
|
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
<div class="method-source-code" id="continue-source">
|
338
|
-
<pre>
|
339
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 265</span>
|
318
|
+
|
319
|
+
<div class="method-source-code" id="continue-source">
|
320
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 265</span>
|
340
321
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">continue</span>
|
341
322
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/development|test/</span>
|
342
323
|
<span class="ruby-identifier">system</span>(<span class="ruby-node">"kill -CONT #{self.pid}"</span>)
|
@@ -344,98 +325,90 @@ latest redis gem.</p>
|
|
344
325
|
<span class="ruby-identifier">system</span>(<span class="ruby-node">"cd #{Rails.root}; #{ResqueUi::Cap.path} #{Rails.env} resque:continue_worker pid=#{self.pid} host=#{self.ip}"</span>)
|
345
326
|
<span class="ruby-keyword">end</span>
|
346
327
|
<span class="ruby-keyword">end</span></pre>
|
347
|
-
|
348
|
-
|
349
|
-
</div>
|
350
|
-
|
328
|
+
</div><!-- continue-source -->
|
351
329
|
|
330
|
+
</div>
|
352
331
|
|
353
|
-
|
354
|
-
</div><!-- continue-method -->
|
332
|
+
|
355
333
|
|
356
|
-
|
357
|
-
|
358
|
-
<a name="method-i-id"></a>
|
334
|
+
|
335
|
+
</div><!-- continue-method -->
|
359
336
|
|
337
|
+
|
338
|
+
<div id="method-i-id" class="method-detail method-alias">
|
339
|
+
|
340
|
+
<div class="method-heading">
|
341
|
+
<span class="method-name">id</span><span
|
342
|
+
class="method-args">()</span>
|
343
|
+
<span class="method-click-advice">click to toggle source</span>
|
344
|
+
</div>
|
345
|
+
|
346
|
+
|
347
|
+
<div class="method-description">
|
360
348
|
|
361
|
-
<div class="method-heading">
|
362
|
-
<span class="method-name">id</span><span
|
363
|
-
class="method-args">()</span>
|
364
|
-
<span class="method-click-advice">click to toggle source</span>
|
365
|
-
</div>
|
366
349
|
|
367
|
-
|
368
|
-
<div class="method-description">
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
</div>
|
375
|
-
|
376
350
|
|
377
351
|
|
378
352
|
|
379
|
-
|
380
|
-
Alias for: <a href="Worker.html#method-i-to_s">to_s</a>
|
381
|
-
</div>
|
382
|
-
|
383
|
-
</div><!-- id-method -->
|
353
|
+
</div>
|
384
354
|
|
385
|
-
|
386
|
-
<div id="ip-method" class="method-detail ">
|
387
|
-
<a name="method-i-ip"></a>
|
355
|
+
|
388
356
|
|
357
|
+
|
358
|
+
<div class="aliases">
|
359
|
+
Alias for: <a href="Worker.html#method-i-to_s">to_s</a>
|
360
|
+
</div>
|
361
|
+
|
362
|
+
</div><!-- id-method -->
|
363
|
+
|
364
|
+
|
365
|
+
<div id="method-i-ip" class="method-detail ">
|
366
|
+
|
367
|
+
<div class="method-heading">
|
368
|
+
<span class="method-name">ip</span><span
|
369
|
+
class="method-args">()</span>
|
370
|
+
<span class="method-click-advice">click to toggle source</span>
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
<div class="method-description">
|
375
|
+
|
389
376
|
|
390
|
-
<div class="method-heading">
|
391
|
-
<span class="method-name">ip</span><span
|
392
|
-
class="method-args">()</span>
|
393
|
-
<span class="method-click-advice">click to toggle source</span>
|
394
|
-
</div>
|
395
377
|
|
396
378
|
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
<div class="method-source-code" id="ip-source">
|
404
|
-
<pre>
|
405
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 43</span>
|
379
|
+
|
380
|
+
<div class="method-source-code" id="ip-source">
|
381
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 43</span>
|
406
382
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ip</span>
|
407
383
|
<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>).<span class="ruby-identifier">first</span>[<span class="ruby-regexp">/\b(?:\d{1,3}\.){3}\d{1,3}\b/</span>]
|
408
384
|
<span class="ruby-keyword">end</span></pre>
|
409
|
-
|
410
|
-
|
411
|
-
</div>
|
412
|
-
|
385
|
+
</div><!-- ip-source -->
|
413
386
|
|
387
|
+
</div>
|
414
388
|
|
415
|
-
|
416
|
-
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
</div><!-- ip-method -->
|
417
393
|
|
418
|
-
|
419
|
-
|
420
|
-
|
394
|
+
|
395
|
+
<div id="method-i-local_ip" class="method-detail ">
|
396
|
+
|
397
|
+
<div class="method-heading">
|
398
|
+
<span class="method-name">local_ip</span><span
|
399
|
+
class="method-args">()</span>
|
400
|
+
<span class="method-click-advice">click to toggle source</span>
|
401
|
+
</div>
|
402
|
+
|
421
403
|
|
404
|
+
<div class="method-description">
|
405
|
+
|
422
406
|
|
423
|
-
<div class="method-heading">
|
424
|
-
<span class="method-name">local_ip</span><span
|
425
|
-
class="method-args">()</span>
|
426
|
-
<span class="method-click-advice">click to toggle source</span>
|
427
|
-
</div>
|
428
407
|
|
429
408
|
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
<div class="method-source-code" id="local_ip-source">
|
437
|
-
<pre>
|
438
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 6</span>
|
409
|
+
|
410
|
+
<div class="method-source-code" id="local_ip-source">
|
411
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 6</span>
|
439
412
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">local_ip</span>
|
440
413
|
<span class="ruby-identifier">orig</span>, <span class="ruby-constant">Socket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span> = <span class="ruby-constant">Socket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>, <span class="ruby-keyword">true</span> <span class="ruby-comment"># turn off reverse DNS resolution temporarily</span>
|
441
414
|
|
@@ -446,36 +419,33 @@ latest redis gem.</p>
|
|
446
419
|
<span class="ruby-keyword">ensure</span>
|
447
420
|
<span class="ruby-constant">Socket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span> = <span class="ruby-identifier">orig</span>
|
448
421
|
<span class="ruby-keyword">end</span></pre>
|
449
|
-
|
450
|
-
|
451
|
-
</div>
|
452
|
-
|
422
|
+
</div><!-- local_ip-source -->
|
453
423
|
|
424
|
+
</div>
|
454
425
|
|
455
|
-
|
456
|
-
</div><!-- local_ip-method -->
|
426
|
+
|
457
427
|
|
458
|
-
|
459
|
-
|
460
|
-
<a name="method-i-pause"></a>
|
428
|
+
|
429
|
+
</div><!-- local_ip-method -->
|
461
430
|
|
431
|
+
|
432
|
+
<div id="method-i-pause" class="method-detail ">
|
433
|
+
|
434
|
+
<div class="method-heading">
|
435
|
+
<span class="method-name">pause</span><span
|
436
|
+
class="method-args">()</span>
|
437
|
+
<span class="method-click-advice">click to toggle source</span>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
|
441
|
+
<div class="method-description">
|
442
|
+
|
462
443
|
|
463
|
-
<div class="method-heading">
|
464
|
-
<span class="method-name">pause</span><span
|
465
|
-
class="method-args">()</span>
|
466
|
-
<span class="method-click-advice">click to toggle source</span>
|
467
|
-
</div>
|
468
444
|
|
469
445
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
<div class="method-source-code" id="pause-source">
|
477
|
-
<pre>
|
478
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 257</span>
|
446
|
+
|
447
|
+
<div class="method-source-code" id="pause-source">
|
448
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 257</span>
|
479
449
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pause</span>
|
480
450
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/development|test/</span>
|
481
451
|
<span class="ruby-identifier">system</span>(<span class="ruby-node">"kill -USR2 #{self.pid}"</span>)
|
@@ -483,172 +453,158 @@ latest redis gem.</p>
|
|
483
453
|
<span class="ruby-identifier">system</span>(<span class="ruby-node">"cd #{Rails.root}; #{ResqueUi::Cap.path} #{Rails.env} resque:pause_worker pid=#{self.pid} host=#{self.ip}"</span>)
|
484
454
|
<span class="ruby-keyword">end</span>
|
485
455
|
<span class="ruby-keyword">end</span></pre>
|
486
|
-
|
487
|
-
|
488
|
-
</div>
|
489
|
-
|
456
|
+
</div><!-- pause-source -->
|
490
457
|
|
458
|
+
</div>
|
491
459
|
|
492
|
-
|
493
|
-
</div><!-- pause-method -->
|
460
|
+
|
494
461
|
|
495
|
-
|
496
|
-
|
497
|
-
<a name="method-i-pause_key"></a>
|
462
|
+
|
463
|
+
</div><!-- pause-method -->
|
498
464
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
465
|
+
|
466
|
+
<div id="method-i-pause_key" class="method-detail ">
|
467
|
+
|
468
|
+
<div class="method-heading">
|
469
|
+
<span class="method-name">pause_key</span><span
|
470
|
+
class="method-args">()</span>
|
471
|
+
<span class="method-click-advice">click to toggle source</span>
|
472
|
+
</div>
|
473
|
+
|
506
474
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
href="Worker.html#method-i-to_s"
|
475
|
+
<div class="method-description">
|
476
|
+
|
477
|
+
<p>When the worker gets the -USR2 signal, <a
|
478
|
+
href="Worker.html#method-i-to_s">#to_s</a> may give a different value for
|
511
479
|
the thread and queue portion</p>
|
512
|
-
|
480
|
+
|
513
481
|
|
514
|
-
|
515
|
-
|
516
|
-
<pre>
|
517
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 26</span>
|
482
|
+
|
483
|
+
<div class="method-source-code" id="pause_key-source">
|
484
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 26</span>
|
518
485
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pause_key</span>
|
519
486
|
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>)
|
520
487
|
<span class="ruby-node">"worker:#{key.first}:#{key.second}:all_workers:paused"</span>
|
521
488
|
<span class="ruby-keyword">end</span></pre>
|
522
|
-
|
523
|
-
|
524
|
-
</div>
|
525
|
-
|
489
|
+
</div><!-- pause_key-source -->
|
526
490
|
|
491
|
+
</div>
|
527
492
|
|
528
|
-
|
529
|
-
</div><!-- pause_key-method -->
|
493
|
+
|
530
494
|
|
531
|
-
|
532
|
-
|
533
|
-
<a name="method-i-pause_processing"></a>
|
495
|
+
|
496
|
+
</div><!-- pause_key-method -->
|
534
497
|
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
498
|
+
|
499
|
+
<div id="method-i-pause_processing" class="method-detail ">
|
500
|
+
|
501
|
+
<div class="method-heading">
|
502
|
+
<span class="method-name">pause_processing</span><span
|
503
|
+
class="method-args">()</span>
|
504
|
+
<span class="method-click-advice">click to toggle source</span>
|
505
|
+
</div>
|
506
|
+
|
542
507
|
|
543
|
-
|
544
|
-
|
545
|
-
|
508
|
+
<div class="method-description">
|
509
|
+
|
510
|
+
<pre>Stop processing jobs after the current one has completed (if we're
|
546
511
|
currently running one).</pre>
|
547
512
|
|
548
513
|
<p>OVERRIDE to set a redis key so UI knows it’s paused too</p>
|
549
514
|
|
550
515
|
<pre>Would prefer to call super but get no superclass method error</pre>
|
551
|
-
|
516
|
+
|
552
517
|
|
553
|
-
|
554
|
-
|
555
|
-
<pre>
|
556
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 95</span>
|
518
|
+
|
519
|
+
<div class="method-source-code" id="pause_processing-source">
|
520
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 95</span>
|
557
521
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pause_processing</span>
|
558
522
|
<span class="ruby-identifier">log</span> <span class="ruby-string">"USR2 received; pausing job processing"</span>
|
559
523
|
<span class="ruby-ivar">@paused</span> = <span class="ruby-keyword">true</span>
|
560
524
|
<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">pause_key</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_s</span>)
|
561
525
|
<span class="ruby-keyword">end</span></pre>
|
562
|
-
|
563
|
-
|
564
|
-
</div>
|
565
|
-
|
526
|
+
</div><!-- pause_processing-source -->
|
566
527
|
|
528
|
+
</div>
|
567
529
|
|
568
|
-
|
569
|
-
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
</div><!-- pause_processing-method -->
|
570
534
|
|
571
|
-
|
572
|
-
|
573
|
-
|
535
|
+
|
536
|
+
<div id="method-i-paused" class="method-detail ">
|
537
|
+
|
538
|
+
<div class="method-heading">
|
539
|
+
<span class="method-name">paused</span><span
|
540
|
+
class="method-args">()</span>
|
541
|
+
<span class="method-click-advice">click to toggle source</span>
|
542
|
+
</div>
|
543
|
+
|
574
544
|
|
545
|
+
<div class="method-description">
|
546
|
+
|
575
547
|
|
576
|
-
<div class="method-heading">
|
577
|
-
<span class="method-name">paused</span><span
|
578
|
-
class="method-args">()</span>
|
579
|
-
<span class="method-click-advice">click to toggle source</span>
|
580
|
-
</div>
|
581
548
|
|
582
549
|
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
<div class="method-source-code" id="paused-source">
|
590
|
-
<pre>
|
591
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 81</span>
|
550
|
+
|
551
|
+
<div class="method-source-code" id="paused-source">
|
552
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 81</span>
|
592
553
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">paused</span>
|
593
554
|
<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">get</span> <span class="ruby-identifier">pause_key</span>
|
594
555
|
<span class="ruby-keyword">end</span></pre>
|
595
|
-
|
596
|
-
|
597
|
-
</div>
|
598
|
-
|
556
|
+
</div><!-- paused-source -->
|
599
557
|
|
558
|
+
</div>
|
600
559
|
|
601
|
-
|
602
|
-
</div><!-- paused-method -->
|
560
|
+
|
603
561
|
|
604
|
-
|
605
|
-
|
606
|
-
<a name="method-i-paused-3F"></a>
|
562
|
+
|
563
|
+
</div><!-- paused-method -->
|
607
564
|
|
565
|
+
|
566
|
+
<div id="method-i-paused-3F" class="method-detail ">
|
567
|
+
|
568
|
+
<div class="method-heading">
|
569
|
+
<span class="method-name">paused?</span><span
|
570
|
+
class="method-args">()</span>
|
571
|
+
<span class="method-click-advice">click to toggle source</span>
|
572
|
+
</div>
|
573
|
+
|
574
|
+
|
575
|
+
<div class="method-description">
|
608
576
|
|
609
|
-
<
|
610
|
-
<span class="method-name">paused?</span><span
|
611
|
-
class="method-args">()</span>
|
612
|
-
<span class="method-click-advice">click to toggle source</span>
|
613
|
-
</div>
|
577
|
+
<p>are we paused? OVERRIDE so UI can tell if we’re paused</p>
|
614
578
|
|
615
579
|
|
616
|
-
|
617
|
-
|
618
|
-
<
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
<div class="method-source-code" id="paused-3F-source">
|
623
|
-
<pre>
|
624
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 87</span>
|
580
|
+
|
581
|
+
<div class="method-source-code" id="paused-3F-source">
|
582
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 87</span>
|
625
583
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">paused?</span>
|
626
584
|
<span class="ruby-ivar">@paused</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">paused</span>.<span class="ruby-identifier">present?</span>
|
627
585
|
<span class="ruby-keyword">end</span></pre>
|
628
|
-
|
629
|
-
|
630
|
-
</div>
|
631
|
-
|
586
|
+
</div><!-- paused-3F-source -->
|
632
587
|
|
588
|
+
</div>
|
633
589
|
|
634
|
-
|
635
|
-
</div><!-- paused-3F-method -->
|
590
|
+
|
636
591
|
|
637
|
-
|
638
|
-
|
639
|
-
<a name="method-i-prune_dead_workers"></a>
|
592
|
+
|
593
|
+
</div><!-- paused-3F-method -->
|
640
594
|
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
595
|
+
|
596
|
+
<div id="method-i-prune_dead_workers" class="method-detail ">
|
597
|
+
|
598
|
+
<div class="method-heading">
|
599
|
+
<span class="method-name">prune_dead_workers</span><span
|
600
|
+
class="method-args">()</span>
|
601
|
+
<span class="method-click-advice">click to toggle source</span>
|
602
|
+
</div>
|
603
|
+
|
648
604
|
|
649
|
-
|
650
|
-
|
651
|
-
|
605
|
+
<div class="method-description">
|
606
|
+
|
607
|
+
<p>Looks for any workers which should be running on this server and, if
|
652
608
|
they’re not, removes them from Redis.</p>
|
653
609
|
|
654
610
|
<p>This is a form of garbage collection. If a server is killed by a hard
|
@@ -658,12 +614,11 @@ therefor will leave stale state information in Redis.</p>
|
|
658
614
|
|
659
615
|
<p>By checking the current Redis state against the actual environment, we can
|
660
616
|
determine if Redis is old and clean it up a bit.</p>
|
661
|
-
|
617
|
+
|
662
618
|
|
663
|
-
|
664
|
-
|
665
|
-
<pre>
|
666
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 120</span>
|
619
|
+
|
620
|
+
<div class="method-source-code" id="prune_dead_workers-source">
|
621
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 120</span>
|
667
622
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">prune_dead_workers</span>
|
668
623
|
<span class="ruby-constant">Worker</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">worker</span><span class="ruby-operator">|</span>
|
669
624
|
<span class="ruby-identifier">host</span>, <span class="ruby-identifier">pid</span>, <span class="ruby-identifier">thread</span>, <span class="ruby-identifier">queues</span> = <span class="ruby-identifier">worker</span>.<span class="ruby-identifier">id</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>)
|
@@ -673,135 +628,123 @@ determine if Redis is old and clean it up a bit.</p>
|
|
673
628
|
<span class="ruby-identifier">worker</span>.<span class="ruby-identifier">unregister_worker</span>
|
674
629
|
<span class="ruby-keyword">end</span>
|
675
630
|
<span class="ruby-keyword">end</span></pre>
|
676
|
-
|
677
|
-
|
678
|
-
</div>
|
679
|
-
|
631
|
+
</div><!-- prune_dead_workers-source -->
|
680
632
|
|
633
|
+
</div>
|
681
634
|
|
682
|
-
|
683
|
-
</div><!-- prune_dead_workers-method -->
|
635
|
+
|
684
636
|
|
685
|
-
|
686
|
-
|
687
|
-
<a name="method-i-queue"></a>
|
637
|
+
|
638
|
+
</div><!-- prune_dead_workers-method -->
|
688
639
|
|
640
|
+
|
641
|
+
<div id="method-i-queue" class="method-detail ">
|
642
|
+
|
643
|
+
<div class="method-heading">
|
644
|
+
<span class="method-name">queue</span><span
|
645
|
+
class="method-args">()</span>
|
646
|
+
<span class="method-click-advice">click to toggle source</span>
|
647
|
+
</div>
|
648
|
+
|
649
|
+
|
650
|
+
<div class="method-description">
|
651
|
+
|
689
652
|
|
690
|
-
<div class="method-heading">
|
691
|
-
<span class="method-name">queue</span><span
|
692
|
-
class="method-args">()</span>
|
693
|
-
<span class="method-click-advice">click to toggle source</span>
|
694
|
-
</div>
|
695
653
|
|
696
654
|
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
<div class="method-source-code" id="queue-source">
|
704
|
-
<pre>
|
705
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 35</span>
|
655
|
+
|
656
|
+
<div class="method-source-code" id="queue-source">
|
657
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 35</span>
|
706
658
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">queue</span>
|
707
659
|
<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>).<span class="ruby-identifier">last</span>
|
708
660
|
<span class="ruby-keyword">end</span></pre>
|
709
|
-
|
710
|
-
|
711
|
-
</div>
|
712
|
-
|
661
|
+
</div><!-- queue-source -->
|
713
662
|
|
663
|
+
</div>
|
714
664
|
|
715
|
-
|
716
|
-
</div><!-- queue-method -->
|
665
|
+
|
717
666
|
|
718
|
-
|
719
|
-
|
720
|
-
<a name="method-i-queues"></a>
|
667
|
+
|
668
|
+
</div><!-- queue-method -->
|
721
669
|
|
670
|
+
|
671
|
+
<div id="method-i-queues" class="method-detail ">
|
672
|
+
|
673
|
+
<div class="method-heading">
|
674
|
+
<span class="method-name">queues</span><span
|
675
|
+
class="method-args">()</span>
|
676
|
+
<span class="method-click-advice">click to toggle source</span>
|
677
|
+
</div>
|
678
|
+
|
679
|
+
|
680
|
+
<div class="method-description">
|
722
681
|
|
723
|
-
<
|
724
|
-
<span class="method-name">queues</span><span
|
725
|
-
class="method-args">()</span>
|
726
|
-
<span class="method-click-advice">click to toggle source</span>
|
727
|
-
</div>
|
682
|
+
<p>OVERRIDE for multithreaded workers</p>
|
728
683
|
|
729
684
|
|
730
|
-
|
731
|
-
|
732
|
-
<
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
<div class="method-source-code" id="queues-source">
|
737
|
-
<pre>
|
738
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 52</span>
|
685
|
+
|
686
|
+
<div class="method-source-code" id="queues-source">
|
687
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 52</span>
|
739
688
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">queues</span>
|
740
689
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value">:queues</span>] <span class="ruby-operator">==</span> <span class="ruby-string">"*"</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Resque</span>.<span class="ruby-identifier">queues</span>.<span class="ruby-identifier">sort</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value">:queues</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">','</span>)
|
741
690
|
<span class="ruby-keyword">end</span></pre>
|
742
|
-
|
743
|
-
|
744
|
-
</div>
|
745
|
-
|
691
|
+
</div><!-- queues-source -->
|
746
692
|
|
693
|
+
</div>
|
747
694
|
|
748
|
-
|
749
|
-
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
</div><!-- queues-method -->
|
750
699
|
|
751
|
-
|
752
|
-
|
753
|
-
|
700
|
+
|
701
|
+
<div id="method-i-queues_in_pid" class="method-detail ">
|
702
|
+
|
703
|
+
<div class="method-heading">
|
704
|
+
<span class="method-name">queues_in_pid</span><span
|
705
|
+
class="method-args">()</span>
|
706
|
+
<span class="method-click-advice">click to toggle source</span>
|
707
|
+
</div>
|
708
|
+
|
754
709
|
|
710
|
+
<div class="method-description">
|
711
|
+
|
755
712
|
|
756
|
-
<div class="method-heading">
|
757
|
-
<span class="method-name">queues_in_pid</span><span
|
758
|
-
class="method-args">()</span>
|
759
|
-
<span class="method-click-advice">click to toggle source</span>
|
760
|
-
</div>
|
761
713
|
|
762
714
|
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
<div class="method-source-code" id="queues_in_pid-source">
|
770
|
-
<pre>
|
771
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 47</span>
|
715
|
+
|
716
|
+
<div class="method-source-code" id="queues_in_pid-source">
|
717
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 47</span>
|
772
718
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">queues_in_pid</span>
|
773
719
|
<span class="ruby-identifier">workers_in_pid</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">queue</span> }
|
774
720
|
<span class="ruby-keyword">end</span></pre>
|
775
|
-
|
776
|
-
|
777
|
-
</div>
|
778
|
-
|
721
|
+
</div><!-- queues_in_pid-source -->
|
779
722
|
|
723
|
+
</div>
|
780
724
|
|
781
|
-
|
782
|
-
</div><!-- queues_in_pid-method -->
|
725
|
+
|
783
726
|
|
784
|
-
|
785
|
-
|
786
|
-
<a name="method-i-quit"></a>
|
727
|
+
|
728
|
+
</div><!-- queues_in_pid-method -->
|
787
729
|
|
730
|
+
|
731
|
+
<div id="method-i-quit" class="method-detail ">
|
732
|
+
|
733
|
+
<div class="method-heading">
|
734
|
+
<span class="method-name">quit</span><span
|
735
|
+
class="method-args">()</span>
|
736
|
+
<span class="method-click-advice">click to toggle source</span>
|
737
|
+
</div>
|
738
|
+
|
739
|
+
|
740
|
+
<div class="method-description">
|
741
|
+
|
788
742
|
|
789
|
-
<div class="method-heading">
|
790
|
-
<span class="method-name">quit</span><span
|
791
|
-
class="method-args">()</span>
|
792
|
-
<span class="method-click-advice">click to toggle source</span>
|
793
|
-
</div>
|
794
743
|
|
795
744
|
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
<div class="method-source-code" id="quit-source">
|
803
|
-
<pre>
|
804
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 242</span>
|
745
|
+
|
746
|
+
<div class="method-source-code" id="quit-source">
|
747
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 242</span>
|
805
748
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">quit</span>
|
806
749
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/development|test/</span>
|
807
750
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/java/</span>
|
@@ -816,111 +759,102 @@ determine if Redis is old and clean it up a bit.</p>
|
|
816
759
|
<span class="ruby-identifier">system</span>(<span class="ruby-node">"cd #{Rails.root}; #{ResqueUi::Cap.path} #{Rails.env} resque:quit_worker pid=#{self.pid} host=#{self.ip}"</span>)
|
817
760
|
<span class="ruby-keyword">end</span>
|
818
761
|
<span class="ruby-keyword">end</span></pre>
|
819
|
-
|
820
|
-
|
821
|
-
</div>
|
822
|
-
|
762
|
+
</div><!-- quit-source -->
|
823
763
|
|
764
|
+
</div>
|
824
765
|
|
825
|
-
|
826
|
-
</div><!-- quit-method -->
|
766
|
+
|
827
767
|
|
828
|
-
|
829
|
-
|
830
|
-
<a name="method-i-restart"></a>
|
768
|
+
|
769
|
+
</div><!-- quit-method -->
|
831
770
|
|
771
|
+
|
772
|
+
<div id="method-i-restart" class="method-detail ">
|
773
|
+
|
774
|
+
<div class="method-heading">
|
775
|
+
<span class="method-name">restart</span><span
|
776
|
+
class="method-args">()</span>
|
777
|
+
<span class="method-click-advice">click to toggle source</span>
|
778
|
+
</div>
|
779
|
+
|
780
|
+
|
781
|
+
<div class="method-description">
|
782
|
+
|
832
783
|
|
833
|
-
<div class="method-heading">
|
834
|
-
<span class="method-name">restart</span><span
|
835
|
-
class="method-args">()</span>
|
836
|
-
<span class="method-click-advice">click to toggle source</span>
|
837
|
-
</div>
|
838
784
|
|
839
785
|
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
<div class="method-source-code" id="restart-source">
|
847
|
-
<pre>
|
848
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 273</span>
|
786
|
+
|
787
|
+
<div class="method-source-code" id="restart-source">
|
788
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 273</span>
|
849
789
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">restart</span>
|
850
790
|
<span class="ruby-identifier">queues</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">queues_in_pid</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">'#'</span>)
|
851
791
|
<span class="ruby-identifier">quit</span>
|
852
792
|
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">start</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">ip</span>, <span class="ruby-identifier">queues</span>)
|
853
793
|
<span class="ruby-keyword">end</span></pre>
|
854
|
-
|
855
|
-
|
856
|
-
</div>
|
857
|
-
|
794
|
+
</div><!-- restart-source -->
|
858
795
|
|
796
|
+
</div>
|
859
797
|
|
860
|
-
|
861
|
-
</div><!-- restart-method -->
|
798
|
+
|
862
799
|
|
863
|
-
|
864
|
-
|
865
|
-
<a name="method-i-shutdown"></a>
|
800
|
+
|
801
|
+
</div><!-- restart-method -->
|
866
802
|
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
803
|
+
|
804
|
+
<div id="method-i-shutdown" class="method-detail ">
|
805
|
+
|
806
|
+
<div class="method-heading">
|
807
|
+
<span class="method-name">shutdown</span><span
|
808
|
+
class="method-args">()</span>
|
809
|
+
<span class="method-click-advice">click to toggle source</span>
|
810
|
+
</div>
|
811
|
+
|
874
812
|
|
875
|
-
|
876
|
-
|
877
|
-
|
813
|
+
<div class="method-description">
|
814
|
+
|
815
|
+
<pre>Schedule this worker for shutdown. Will finish processing the
|
878
816
|
current job.</pre>
|
879
817
|
|
880
818
|
<p>OVERRIDE for multithreaded workers</p>
|
881
|
-
|
819
|
+
|
882
820
|
|
883
|
-
|
884
|
-
|
885
|
-
<pre>
|
886
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 75</span>
|
821
|
+
|
822
|
+
<div class="method-source-code" id="shutdown-source">
|
823
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 75</span>
|
887
824
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">shutdown</span>
|
888
825
|
<span class="ruby-identifier">log</span> <span class="ruby-string">'Exiting...'</span>
|
889
826
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>[<span class="ruby-value">:shutdown</span>] = <span class="ruby-keyword">true</span> }
|
890
827
|
<span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword">true</span>
|
891
828
|
<span class="ruby-keyword">end</span></pre>
|
892
|
-
|
893
|
-
|
894
|
-
</div>
|
895
|
-
|
829
|
+
</div><!-- shutdown-source -->
|
896
830
|
|
831
|
+
</div>
|
897
832
|
|
898
|
-
|
899
|
-
</div><!-- shutdown-method -->
|
833
|
+
|
900
834
|
|
901
|
-
|
902
|
-
|
903
|
-
<a name="method-i-startup"></a>
|
835
|
+
|
836
|
+
</div><!-- shutdown-method -->
|
904
837
|
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
838
|
+
|
839
|
+
<div id="method-i-startup" class="method-detail ">
|
840
|
+
|
841
|
+
<div class="method-heading">
|
842
|
+
<span class="method-name">startup</span><span
|
843
|
+
class="method-args">()</span>
|
844
|
+
<span class="method-click-advice">click to toggle source</span>
|
845
|
+
</div>
|
846
|
+
|
912
847
|
|
913
|
-
|
914
|
-
|
915
|
-
|
848
|
+
<div class="method-description">
|
849
|
+
|
850
|
+
<pre>Runs all the methods needed when a worker begins its lifecycle.</pre>
|
916
851
|
|
917
852
|
<p>OVERRIDE for multithreaded workers</p>
|
918
|
-
|
853
|
+
|
919
854
|
|
920
|
-
|
921
|
-
|
922
|
-
<pre>
|
923
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 58</span>
|
855
|
+
|
856
|
+
<div class="method-source-code" id="startup-source">
|
857
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 58</span>
|
924
858
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">startup</span>
|
925
859
|
<span class="ruby-identifier">enable_gc_optimizations</span>
|
926
860
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">main</span>
|
@@ -934,215 +868,197 @@ current job.</pre>
|
|
934
868
|
<span class="ruby-comment"># get output from the child in there.</span>
|
935
869
|
<span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-keyword">true</span>
|
936
870
|
<span class="ruby-keyword">end</span></pre>
|
937
|
-
|
938
|
-
|
939
|
-
</div>
|
940
|
-
|
871
|
+
</div><!-- startup-source -->
|
941
872
|
|
873
|
+
</div>
|
942
874
|
|
943
|
-
|
944
|
-
</div><!-- startup-method -->
|
875
|
+
|
945
876
|
|
946
|
-
|
947
|
-
|
948
|
-
|
877
|
+
|
878
|
+
</div><!-- startup-method -->
|
879
|
+
|
880
|
+
|
881
|
+
<div id="method-i-status" class="method-detail ">
|
882
|
+
|
883
|
+
<div class="method-heading">
|
884
|
+
<span class="method-name">status</span><span
|
885
|
+
class="method-args">()</span>
|
886
|
+
<span class="method-click-advice">click to toggle source</span>
|
887
|
+
</div>
|
888
|
+
|
949
889
|
|
890
|
+
<div class="method-description">
|
891
|
+
|
950
892
|
|
951
|
-
<div class="method-heading">
|
952
|
-
<span class="method-name">status</span><span
|
953
|
-
class="method-args">()</span>
|
954
|
-
<span class="method-click-advice">click to toggle source</span>
|
955
|
-
</div>
|
956
893
|
|
957
894
|
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
<div class="method-source-code" id="status-source">
|
965
|
-
<pre>
|
966
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 230</span>
|
895
|
+
|
896
|
+
<div class="method-source-code" id="status-source">
|
897
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 230</span>
|
967
898
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">status</span>
|
968
899
|
<span class="ruby-identifier">job</span>[<span class="ruby-string">'status'</span>]
|
969
900
|
<span class="ruby-keyword">end</span></pre>
|
970
|
-
|
971
|
-
|
972
|
-
</div>
|
973
|
-
|
901
|
+
</div><!-- status-source -->
|
974
902
|
|
903
|
+
</div>
|
975
904
|
|
976
|
-
|
977
|
-
</div><!-- status-method -->
|
905
|
+
|
978
906
|
|
979
|
-
|
980
|
-
|
981
|
-
<a name="method-i-status-3D"></a>
|
907
|
+
|
908
|
+
</div><!-- status-method -->
|
982
909
|
|
910
|
+
|
911
|
+
<div id="method-i-status-3D" class="method-detail ">
|
912
|
+
|
913
|
+
<div class="method-heading">
|
914
|
+
<span class="method-name">status=</span><span
|
915
|
+
class="method-args">(status)</span>
|
916
|
+
<span class="method-click-advice">click to toggle source</span>
|
917
|
+
</div>
|
918
|
+
|
919
|
+
|
920
|
+
<div class="method-description">
|
921
|
+
|
983
922
|
|
984
|
-
<div class="method-heading">
|
985
|
-
<span class="method-name">status=</span><span
|
986
|
-
class="method-args">(status)</span>
|
987
|
-
<span class="method-click-advice">click to toggle source</span>
|
988
|
-
</div>
|
989
923
|
|
990
924
|
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
<div class="method-source-code" id="status-3D-source">
|
998
|
-
<pre>
|
999
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 225</span>
|
925
|
+
|
926
|
+
<div class="method-source-code" id="status-3D-source">
|
927
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 225</span>
|
1000
928
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">status=</span>(<span class="ruby-identifier">status</span>)
|
1001
929
|
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">encode</span>(<span class="ruby-identifier">job</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-string">'status'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">status</span>))
|
1002
930
|
<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">set</span>(<span class="ruby-node">"worker:#{self}"</span>, <span class="ruby-identifier">data</span>)
|
1003
931
|
<span class="ruby-keyword">end</span></pre>
|
1004
|
-
|
1005
|
-
|
1006
|
-
</div>
|
1007
|
-
|
932
|
+
</div><!-- status-3D-source -->
|
1008
933
|
|
934
|
+
</div>
|
1009
935
|
|
1010
|
-
|
1011
|
-
</div><!-- status-3D-method -->
|
936
|
+
|
1012
937
|
|
1013
|
-
|
1014
|
-
|
1015
|
-
<a name="method-i-thread"></a>
|
938
|
+
|
939
|
+
</div><!-- status-3D-method -->
|
1016
940
|
|
941
|
+
|
942
|
+
<div id="method-i-thread" class="method-detail ">
|
943
|
+
|
944
|
+
<div class="method-heading">
|
945
|
+
<span class="method-name">thread</span><span
|
946
|
+
class="method-args">()</span>
|
947
|
+
<span class="method-click-advice">click to toggle source</span>
|
948
|
+
</div>
|
949
|
+
|
950
|
+
|
951
|
+
<div class="method-description">
|
952
|
+
|
1017
953
|
|
1018
|
-
<div class="method-heading">
|
1019
|
-
<span class="method-name">thread</span><span
|
1020
|
-
class="method-args">()</span>
|
1021
|
-
<span class="method-click-advice">click to toggle source</span>
|
1022
|
-
</div>
|
1023
954
|
|
1024
955
|
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
<div class="method-source-code" id="thread-source">
|
1032
|
-
<pre>
|
1033
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 31</span>
|
956
|
+
|
957
|
+
<div class="method-source-code" id="thread-source">
|
958
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 31</span>
|
1034
959
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">thread</span>
|
1035
960
|
<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>).<span class="ruby-identifier">third</span>
|
1036
961
|
<span class="ruby-keyword">end</span></pre>
|
1037
|
-
|
1038
|
-
|
1039
|
-
</div>
|
1040
|
-
|
962
|
+
</div><!-- thread-source -->
|
1041
963
|
|
964
|
+
</div>
|
1042
965
|
|
1043
|
-
|
1044
|
-
</div><!-- thread-method -->
|
966
|
+
|
1045
967
|
|
1046
|
-
|
1047
|
-
|
1048
|
-
<a name="method-i-to_s"></a>
|
968
|
+
|
969
|
+
</div><!-- thread-method -->
|
1049
970
|
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
971
|
+
|
972
|
+
<div id="method-i-to_s" class="method-detail ">
|
973
|
+
|
974
|
+
<div class="method-heading">
|
975
|
+
<span class="method-name">to_s</span><span
|
976
|
+
class="method-args">()</span>
|
977
|
+
<span class="method-click-advice">click to toggle source</span>
|
978
|
+
</div>
|
979
|
+
|
1057
980
|
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
981
|
+
<div class="method-description">
|
982
|
+
|
983
|
+
<p>The string representation is the same as the id for this worker instance.
|
1061
984
|
Can be used with `Worker.find`.</p>
|
1062
|
-
|
985
|
+
|
1063
986
|
|
1064
|
-
|
1065
|
-
|
1066
|
-
<pre>
|
1067
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 19</span>
|
987
|
+
|
988
|
+
<div class="method-source-code" id="to_s-source">
|
989
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 19</span>
|
1068
990
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
1069
991
|
<span class="ruby-ivar">@to_s</span> <span class="ruby-operator">||</span> <span class="ruby-node">"#{hostname}(#{local_ip}):#{Process.pid}:#{Thread.current.object_id}:#{Thread.current[:queues]}"</span>
|
1070
992
|
<span class="ruby-keyword">end</span></pre>
|
1071
|
-
|
1072
|
-
|
1073
|
-
</div>
|
1074
|
-
|
1075
|
-
|
1076
|
-
<div class="aliases">
|
1077
|
-
Also aliased as: <a href="Worker.html#method-i-id">id</a>
|
1078
|
-
</div>
|
993
|
+
</div><!-- to_s-source -->
|
1079
994
|
|
995
|
+
</div>
|
1080
996
|
|
1081
|
-
|
1082
|
-
|
997
|
+
|
998
|
+
<div class="aliases">
|
999
|
+
Also aliased as: <a href="Worker.html#method-i-id">id</a>
|
1000
|
+
</div>
|
1001
|
+
|
1083
1002
|
|
1084
|
-
|
1085
|
-
|
1086
|
-
<a name="method-i-unpause_processing"></a>
|
1003
|
+
|
1004
|
+
</div><!-- to_s-method -->
|
1087
1005
|
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1006
|
+
|
1007
|
+
<div id="method-i-unpause_processing" class="method-detail ">
|
1008
|
+
|
1009
|
+
<div class="method-heading">
|
1010
|
+
<span class="method-name">unpause_processing</span><span
|
1011
|
+
class="method-args">()</span>
|
1012
|
+
<span class="method-click-advice">click to toggle source</span>
|
1013
|
+
</div>
|
1014
|
+
|
1095
1015
|
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1016
|
+
<div class="method-description">
|
1017
|
+
|
1018
|
+
<pre>Start processing jobs again after a pause</pre>
|
1099
1019
|
|
1100
1020
|
<p>OVERRIDE to set remove redis key so UI knows it’s unpaused too</p>
|
1101
1021
|
|
1102
1022
|
<pre>Would prefer to call super but get no superclass method error</pre>
|
1103
|
-
|
1023
|
+
|
1104
1024
|
|
1105
|
-
|
1106
|
-
|
1107
|
-
<pre>
|
1108
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 104</span>
|
1025
|
+
|
1026
|
+
<div class="method-source-code" id="unpause_processing-source">
|
1027
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 104</span>
|
1109
1028
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unpause_processing</span>
|
1110
1029
|
<span class="ruby-identifier">log</span> <span class="ruby-string">"CONT received; resuming job processing"</span>
|
1111
1030
|
<span class="ruby-ivar">@paused</span> = <span class="ruby-keyword">false</span>
|
1112
1031
|
<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">del</span>(<span class="ruby-identifier">pause_key</span>)
|
1113
1032
|
<span class="ruby-keyword">end</span></pre>
|
1114
|
-
|
1115
|
-
|
1116
|
-
</div>
|
1117
|
-
|
1033
|
+
</div><!-- unpause_processing-source -->
|
1118
1034
|
|
1035
|
+
</div>
|
1119
1036
|
|
1120
|
-
|
1121
|
-
</div><!-- unpause_processing-method -->
|
1037
|
+
|
1122
1038
|
|
1123
|
-
|
1124
|
-
|
1125
|
-
<a name="method-i-unregister_worker"></a>
|
1039
|
+
|
1040
|
+
</div><!-- unpause_processing-method -->
|
1126
1041
|
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1042
|
+
|
1043
|
+
<div id="method-i-unregister_worker" class="method-detail ">
|
1044
|
+
|
1045
|
+
<div class="method-heading">
|
1046
|
+
<span class="method-name">unregister_worker</span><span
|
1047
|
+
class="method-args">()</span>
|
1048
|
+
<span class="method-click-advice">click to toggle source</span>
|
1049
|
+
</div>
|
1050
|
+
|
1134
1051
|
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1052
|
+
<div class="method-description">
|
1053
|
+
|
1054
|
+
<p>Unregisters ourself as a worker. Useful when shutting down. OVERRIDE to
|
1138
1055
|
also remove the pause key Would prefer to call super but get no superclass
|
1139
1056
|
method error</p>
|
1140
|
-
|
1057
|
+
|
1141
1058
|
|
1142
|
-
|
1143
|
-
|
1144
|
-
<pre>
|
1145
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 133</span>
|
1059
|
+
|
1060
|
+
<div class="method-source-code" id="unregister_worker-source">
|
1061
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 133</span>
|
1146
1062
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unregister_worker</span>
|
1147
1063
|
<span class="ruby-comment"># If we're still processing a job, make sure it gets logged as a</span>
|
1148
1064
|
<span class="ruby-comment"># failure.</span>
|
@@ -1162,30 +1078,28 @@ method error</p>
|
|
1162
1078
|
<span class="ruby-constant">Stat</span>.<span class="ruby-identifier">clear</span>(<span class="ruby-node">"processed:#{self}"</span>)
|
1163
1079
|
<span class="ruby-constant">Stat</span>.<span class="ruby-identifier">clear</span>(<span class="ruby-node">"failed:#{self}"</span>)
|
1164
1080
|
<span class="ruby-keyword">end</span></pre>
|
1165
|
-
|
1166
|
-
|
1167
|
-
</div>
|
1168
|
-
|
1081
|
+
</div><!-- unregister_worker-source -->
|
1169
1082
|
|
1083
|
+
</div>
|
1170
1084
|
|
1171
|
-
|
1172
|
-
</div><!-- unregister_worker-method -->
|
1085
|
+
|
1173
1086
|
|
1174
|
-
|
1175
|
-
|
1176
|
-
<a name="method-i-work"></a>
|
1087
|
+
|
1088
|
+
</div><!-- unregister_worker-method -->
|
1177
1089
|
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1090
|
+
|
1091
|
+
<div id="method-i-work" class="method-detail ">
|
1092
|
+
|
1093
|
+
<div class="method-heading">
|
1094
|
+
<span class="method-name">work</span><span
|
1095
|
+
class="method-args">(interval = 5, &block)</span>
|
1096
|
+
<span class="method-click-advice">click to toggle source</span>
|
1097
|
+
</div>
|
1098
|
+
|
1185
1099
|
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1100
|
+
<div class="method-description">
|
1101
|
+
|
1102
|
+
<pre>This is the main workhorse method. Called on a Worker instance,
|
1189
1103
|
it begins the worker life cycle.
|
1190
1104
|
|
1191
1105
|
The following events occur during a worker's life cycle:
|
@@ -1203,12 +1117,11 @@ Also accepts a block which will be passed the job as soon as it
|
|
1203
1117
|
has completed processing. Useful for testing.</pre>
|
1204
1118
|
|
1205
1119
|
<p>OVERRIDE for multithreaded workers</p>
|
1206
|
-
|
1120
|
+
|
1207
1121
|
|
1208
|
-
|
1209
|
-
|
1210
|
-
<pre>
|
1211
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 174</span>
|
1122
|
+
|
1123
|
+
<div class="method-source-code" id="work-source">
|
1124
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 174</span>
|
1212
1125
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">work</span>(<span class="ruby-identifier">interval</span> = <span class="ruby-value">5</span>, &<span class="ruby-identifier">block</span>)
|
1213
1126
|
<span class="ruby-identifier">$0</span> = <span class="ruby-string">"resque: Starting"</span>
|
1214
1127
|
<span class="ruby-identifier">startup</span>
|
@@ -1249,62 +1162,56 @@ has completed processing. Useful for testing.</pre>
|
|
1249
1162
|
<span class="ruby-keyword">ensure</span>
|
1250
1163
|
<span class="ruby-identifier">unregister_worker</span>
|
1251
1164
|
<span class="ruby-keyword">end</span></pre>
|
1252
|
-
|
1253
|
-
|
1254
|
-
</div>
|
1255
|
-
|
1165
|
+
</div><!-- work-source -->
|
1256
1166
|
|
1167
|
+
</div>
|
1257
1168
|
|
1258
|
-
|
1259
|
-
|
1169
|
+
|
1170
|
+
|
1171
|
+
|
1172
|
+
</div><!-- work-method -->
|
1260
1173
|
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1174
|
+
|
1175
|
+
<div id="method-i-workers_in_pid" class="method-detail ">
|
1176
|
+
|
1177
|
+
<div class="method-heading">
|
1178
|
+
<span class="method-name">workers_in_pid</span><span
|
1179
|
+
class="method-args">()</span>
|
1180
|
+
<span class="method-click-advice">click to toggle source</span>
|
1181
|
+
</div>
|
1182
|
+
|
1264
1183
|
|
1184
|
+
<div class="method-description">
|
1185
|
+
|
1265
1186
|
|
1266
|
-
<div class="method-heading">
|
1267
|
-
<span class="method-name">workers_in_pid</span><span
|
1268
|
-
class="method-args">()</span>
|
1269
|
-
<span class="method-click-advice">click to toggle source</span>
|
1270
|
-
</div>
|
1271
1187
|
|
1272
1188
|
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
<div class="method-source-code" id="workers_in_pid-source">
|
1280
|
-
<pre>
|
1281
|
-
<span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 39</span>
|
1189
|
+
|
1190
|
+
<div class="method-source-code" id="workers_in_pid-source">
|
1191
|
+
<pre><span class="ruby-comment"># File lib/resque_ui/overrides/resque/worker.rb, line 39</span>
|
1282
1192
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">workers_in_pid</span>
|
1283
1193
|
<span class="ruby-constant">Array</span>(<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">smembers</span>(<span class="ruby-value">:workers</span>)).<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span> <span class="ruby-identifier">id</span> <span class="ruby-operator">=~</span> <span class="ruby-node">/\(#{ip}\):#{pid}/</span> }.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span> <span class="ruby-constant">Resque</span><span class="ruby-operator">::</span><span class="ruby-constant">Worker</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">id</span>) }.<span class="ruby-identifier">compact</span>
|
1284
1194
|
<span class="ruby-keyword">end</span></pre>
|
1285
|
-
|
1286
|
-
|
1287
|
-
</div>
|
1288
|
-
|
1195
|
+
</div><!-- workers_in_pid-source -->
|
1289
1196
|
|
1197
|
+
</div>
|
1290
1198
|
|
1291
|
-
|
1292
|
-
|
1199
|
+
|
1200
|
+
|
1201
|
+
|
1202
|
+
</div><!-- workers_in_pid-method -->
|
1293
1203
|
|
1294
|
-
|
1295
|
-
</div><!-- public-instance-method-details -->
|
1296
1204
|
|
1297
|
-
</
|
1205
|
+
</section><!-- public-instance-method-details -->
|
1298
1206
|
|
1207
|
+
</section><!-- 5Buntitled-5D -->
|
1299
1208
|
|
1300
|
-
|
1209
|
+
</div><!-- documentation -->
|
1301
1210
|
|
1302
|
-
<div id="validator-badges">
|
1303
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1304
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
1305
|
-
Rdoc Generator</a> 2</small>.</p>
|
1306
|
-
</div>
|
1307
1211
|
|
1308
|
-
|
1309
|
-
</
|
1212
|
+
<footer id="validator-badges">
|
1213
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
1214
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
1215
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
1216
|
+
</footer>
|
1310
1217
|
|