resque_admin 1.0.5 → 2.4.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.
- checksums.yaml +4 -4
- data/HISTORY.md +19 -19
- data/README.markdown +76 -76
- data/bin/{resque → resque-admin} +3 -3
- data/bin/{resque-web → resque-admin-web} +1 -1
- data/lib/resque_admin.rb +3 -3
- data/lib/resque_admin/failure/redis.rb +1 -1
- data/lib/resque_admin/failure/redis_multi_queue.rb +1 -1
- data/lib/resque_admin/server.rb +8 -8
- data/lib/resque_admin/server/views/key_sets.erb +1 -1
- data/lib/resque_admin/server/views/key_string.erb +1 -1
- data/lib/resque_admin/server/views/layout.erb +2 -2
- data/lib/resque_admin/server/views/next_more.erb +1 -1
- data/lib/resque_admin/server/views/queues.erb +5 -5
- data/lib/resque_admin/server/views/stats.erb +10 -10
- data/lib/resque_admin/server/views/working.erb +2 -2
- data/lib/resque_admin/tasks.rb +5 -5
- data/lib/resque_admin/version.rb +1 -1
- data/lib/resque_admin/worker.rb +7 -7
- data/lib/tasks/{resque.rake → resque_admin.rake} +0 -0
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03e8688bd405e25f9f12eac7521dc999d852e39d
|
|
4
|
+
data.tar.gz: 5fbfe39a918c6eb2fcdb652a34e46fa505509f8a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e78ed9123a54674df59ec5bd2062bc4b261f12fe4f3553bca876adeb36a9c22f320347479a63f6f82ad0a60b71ac63e729b75f557d4643358698eef177fae38
|
|
7
|
+
data.tar.gz: a3e72f3c52325ffda617354b4cc4654cfb82f78402756bd3a2cbc4e4e2bf133b3fc54227a2e0f1ffeb9a0fd4ca0ee0fe10e6f2c0504c5fc0af013b0e8beb35c1
|
data/HISTORY.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* Workers queried out now have the correct hostname (@crazymykl)
|
|
35
35
|
* Fix race condition on worker startup (@stevedomin)
|
|
36
36
|
* No longer triggers verbose logging if env variables are not set (@ldnunes)
|
|
37
|
-
*
|
|
37
|
+
* resque_admin/failed/requeue/all when using Redis::Failure::Multiple no longer raises an exception (@ale7714)
|
|
38
38
|
* Improve forking to avoid having a child process escape its code (@dylanahsmith)
|
|
39
39
|
* Workers now use server time rather than their own time to maintain heartbeats (@fw42)
|
|
40
40
|
* Run eager load hooks for Rails applications versioned 4.x and up (@abhi-patel)
|
|
@@ -78,11 +78,11 @@ the next release.
|
|
|
78
78
|
* Actually require Forwardable from the standard library.
|
|
79
79
|
|
|
80
80
|
## 1.25.0 (2013-4-16)
|
|
81
|
-
* Updates fork method so [
|
|
82
|
-
monkey patching works again. See discussion at https://github.com/defunkt/
|
|
81
|
+
* Updates fork method so [resque_admin-multi-job-forks](https://github.com/stulentsev/resque_admin-multi-job-forks)
|
|
82
|
+
monkey patching works again. See discussion at https://github.com/defunkt/resque_admin/pull/895 for more
|
|
83
83
|
context (@jonhyman)
|
|
84
84
|
* Use Redis.pipelined to group batches of redis commands.
|
|
85
|
-
https://github.com/
|
|
85
|
+
https://github.com/resque_admin/resque_admin/pull/902 (@jonhyman)
|
|
86
86
|
* Fixed uninitialize constant for the module/class that contains the perform
|
|
87
87
|
method causing job failures to no be reported, #792 (@sideshowcoder)
|
|
88
88
|
* Fix ResqueAdmin::Failure::Base.all to have the correct signature.
|
|
@@ -104,7 +104,7 @@ the next release.
|
|
|
104
104
|
|
|
105
105
|
## 1.24.1 (2013-3-23)
|
|
106
106
|
|
|
107
|
-
* Adds a default value for `per_page` on
|
|
107
|
+
* Adds a default value for `per_page` on resque_admin-server for plugins which add tabs (@jonhyman)
|
|
108
108
|
* Fix bad logic on the failed queue adapter
|
|
109
109
|
* Added missing `require 'time'` which was causing occasional errors which
|
|
110
110
|
would crash workers.
|
|
@@ -140,11 +140,11 @@ the next release.
|
|
|
140
140
|
* Making all the failure backends have the same method signature for duck
|
|
141
141
|
typing purposes (jonhyman)
|
|
142
142
|
* Fix log formatters not appending a new line (flavorpill)
|
|
143
|
-
* redirect unauthorized
|
|
144
|
-
* Various
|
|
143
|
+
* redirect unauthorized resque_admin-web polling requests to root url (trliner)
|
|
144
|
+
* Various resque_admin-web fixes (@tarcieri)
|
|
145
145
|
* Optional RedisMultiQueue failure backend, can be enabled with
|
|
146
146
|
FAILURE_BACKEND=redis_multi_queue env var (@tarcieri)
|
|
147
|
-
*
|
|
147
|
+
* resque_admin:failures:sort rake task will migrate an existing "failed" queue into
|
|
148
148
|
separate failure queues per job queue, allowing an easy migration to
|
|
149
149
|
the RedisMultiQueue failure backend (@tarcieri)
|
|
150
150
|
* Disable forking completely with FORK_PER_JOB=false env var (@tarcieri)
|
|
@@ -161,7 +161,7 @@ the next release.
|
|
|
161
161
|
## 1.22.0 (2012-08-21)
|
|
162
162
|
|
|
163
163
|
* unregister signal handlers in child process when ENV["TERM_CHILD"] is set (@dylanasmith, #621)
|
|
164
|
-
* new signal handling for TERM. See http://hone.heroku.com/
|
|
164
|
+
* new signal handling for TERM. See http://hone.heroku.com/resque_admin/2012/08/21/resque_admin-signals.html. (@wuputah, @yaaule, #638)
|
|
165
165
|
* supports calling perform hooks when using ResqueAdmin.inline (@jonhyman, #506)
|
|
166
166
|
|
|
167
167
|
## 1.21.0 (2012-07-02)
|
|
@@ -188,7 +188,7 @@ the next release.
|
|
|
188
188
|
* Added before & after hooks for dequeue (@humancopy, #398)
|
|
189
189
|
* daemonize support using `ENV["BACKGROUND"]` (@chrisleishman)
|
|
190
190
|
* requeue and remove failed jobs by queue name (@evanwhalen)
|
|
191
|
-
* `-r` flag for
|
|
191
|
+
* `-r` flag for resque_admin-web for redis connection (@gjastrab)
|
|
192
192
|
* Added `ResqueAdmin.enqueue_to`: allows you to specif the queue and still run hooks (@dan-g)
|
|
193
193
|
* Web UI: Set the default encoding to UTF-8 (@elubow)
|
|
194
194
|
* fix finding worker pids on JRuby (John Andrews + Andrew Grieser)
|
|
@@ -204,7 +204,7 @@ the next release.
|
|
|
204
204
|
|
|
205
205
|
## 1.18.6 (2011-08-30)
|
|
206
206
|
|
|
207
|
-
* Bugfix: Use Rails 3 eager loading for
|
|
207
|
+
* Bugfix: Use Rails 3 eager loading for resque_admin:preload
|
|
208
208
|
|
|
209
209
|
## 1.18.5 (2011-08-24)
|
|
210
210
|
|
|
@@ -267,7 +267,7 @@ the next release.
|
|
|
267
267
|
* Web Bugfix: Dates display in Safari
|
|
268
268
|
* Web Bugfix: Dates display timezone
|
|
269
269
|
* Web Bugfix: Race condition querying working workers
|
|
270
|
-
* Web Bugfix: Fix polling /workers/all in
|
|
270
|
+
* Web Bugfix: Fix polling /workers/all in resque_admin-web
|
|
271
271
|
|
|
272
272
|
## 1.15.0 (2011-03-18)
|
|
273
273
|
|
|
@@ -296,12 +296,12 @@ the next release.
|
|
|
296
296
|
|
|
297
297
|
## 1.12.0 (2011-02-03)
|
|
298
298
|
|
|
299
|
-
* Added pidfile writing from `rake
|
|
299
|
+
* Added pidfile writing from `rake resque_admin:work`
|
|
300
300
|
* Added Worker#pid method
|
|
301
301
|
* Added configurable location for `rake install`
|
|
302
302
|
* Bugfix: Errors in failure backend are rescue'd
|
|
303
303
|
* Bugfix: Non-working workers no longer counted in "working" count
|
|
304
|
-
* Bugfix: Don't think
|
|
304
|
+
* Bugfix: Don't think resque_admin-web is a worker
|
|
305
305
|
|
|
306
306
|
## 1.11.0 (2010-08-23)
|
|
307
307
|
|
|
@@ -445,7 +445,7 @@ the next release.
|
|
|
445
445
|
|
|
446
446
|
* `Job.destroy` and `ResqueAdmin.dequeue` return the # of destroyed jobs.
|
|
447
447
|
* Hoptoad notifier improvements
|
|
448
|
-
* Specify the namespace with `
|
|
448
|
+
* Specify the namespace with `resque_admin-web` by passing `-N namespace`
|
|
449
449
|
* Bugfix: Don't crash when trying to parse invalid JSON.
|
|
450
450
|
* Bugfix: Non-standard namespace support
|
|
451
451
|
* Web: Red backgound for queue "failed" only shown if there are failed jobs.
|
|
@@ -456,7 +456,7 @@ the next release.
|
|
|
456
456
|
|
|
457
457
|
## 1.5.0 (2010-02-17)
|
|
458
458
|
|
|
459
|
-
* Version now included in procline, e.g. `
|
|
459
|
+
* Version now included in procline, e.g. `resque_admin-1.5.0: Message`
|
|
460
460
|
* Web bugfix: Ignore idle works in the "working" page
|
|
461
461
|
* Added `ResqueAdmin::Job.destroy(queue, klass, *args)`
|
|
462
462
|
* Added `ResqueAdmin.dequeue(klass, *args)`
|
|
@@ -481,7 +481,7 @@ the next release.
|
|
|
481
481
|
|
|
482
482
|
## 1.3.0 (2010-01-11)
|
|
483
483
|
|
|
484
|
-
* Use Vegas for
|
|
484
|
+
* Use Vegas for resque_admin-web
|
|
485
485
|
* Web Bugfix: Show proper date/time value for failed_at on Failures
|
|
486
486
|
* Web Bugfix: Make the / route more flexible
|
|
487
487
|
* Add ResqueAdmin::Server.tabs array (so plugins can add their own tabs)
|
|
@@ -504,11 +504,11 @@ the next release.
|
|
|
504
504
|
|
|
505
505
|
## 1.2.1 (2009-12-07)
|
|
506
506
|
|
|
507
|
-
* Added `rake
|
|
507
|
+
* Added `rake resque_admin:workers` task for starting multiple workers.
|
|
508
508
|
* 1.9.x compatibility
|
|
509
509
|
* Bugfix: Yajl decoder doesn't care about valid UTF-8
|
|
510
510
|
* config.ru loads RESQUECONFIG if the ENV variable is set.
|
|
511
|
-
* `
|
|
511
|
+
* `resque_admin-web` now sets RESQUECONFIG
|
|
512
512
|
* Job objects know if they are equal.
|
|
513
513
|
* Jobs can be re-queued using `Job#recreate`
|
|
514
514
|
|
data/README.markdown
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
ResqueAdmin
|
|
2
2
|
======
|
|
3
3
|
|
|
4
|
-
[](https://rubygems.org/gems/resque_admin)
|
|
5
|
+
[](https://travis-ci.org/resque_admin/resque_admin)
|
|
6
|
+
[](https://coveralls.io/r/resque_admin/resque_admin?branch=1-x-stable)
|
|
7
7
|
|
|
8
8
|
ResqueAdmin (pronounced like "rescue") is a Redis-backed library for creating
|
|
9
9
|
background jobs, placing those jobs on multiple queues, and processing
|
|
@@ -101,7 +101,7 @@ Archive.perform(44, 'masterbrew')
|
|
|
101
101
|
Let's start a worker to run `file_serve` jobs:
|
|
102
102
|
|
|
103
103
|
$ cd app_root
|
|
104
|
-
$ QUEUE=file_serve rake
|
|
104
|
+
$ QUEUE=file_serve rake resque_admin:work
|
|
105
105
|
|
|
106
106
|
This starts one ResqueAdmin worker and tells it to work off the
|
|
107
107
|
`file_serve` queue. As soon as it's ready it'll try to run the
|
|
@@ -237,7 +237,7 @@ shutdown
|
|
|
237
237
|
|
|
238
238
|
Starting a worker is simple. Here's our example from earlier:
|
|
239
239
|
|
|
240
|
-
$ QUEUE=file_serve rake
|
|
240
|
+
$ QUEUE=file_serve rake resque_admin:work
|
|
241
241
|
|
|
242
242
|
By default ResqueAdmin won't know about your application's
|
|
243
243
|
environment. That is, it won't be able to find and run your jobs - it
|
|
@@ -246,20 +246,20 @@ needs to load your application into memory.
|
|
|
246
246
|
If we've installed ResqueAdmin as a Rails plugin, we might run this command
|
|
247
247
|
from our RAILS_ROOT:
|
|
248
248
|
|
|
249
|
-
$ QUEUE=file_serve rake environment
|
|
249
|
+
$ QUEUE=file_serve rake environment resque_admin:work
|
|
250
250
|
|
|
251
251
|
This will load the environment before starting a worker. Alternately
|
|
252
|
-
we can define a `
|
|
252
|
+
we can define a `resque_admin:setup` task with a dependency on the
|
|
253
253
|
`environment` rake task:
|
|
254
254
|
|
|
255
255
|
``` ruby
|
|
256
|
-
task "
|
|
256
|
+
task "resque_admin:setup" => :environment
|
|
257
257
|
```
|
|
258
258
|
|
|
259
259
|
GitHub's setup task looks like this:
|
|
260
260
|
|
|
261
261
|
``` ruby
|
|
262
|
-
task "
|
|
262
|
+
task "resque_admin:setup" => :environment do
|
|
263
263
|
Grit::Git.git_timeout = 10.minutes
|
|
264
264
|
end
|
|
265
265
|
```
|
|
@@ -275,38 +275,38 @@ Workers support basic logging to STDOUT. If you start them with the
|
|
|
275
275
|
information. You can also set the `VVERBOSE` (very verbose) env
|
|
276
276
|
variable.
|
|
277
277
|
|
|
278
|
-
$ VVERBOSE=1 QUEUE=file_serve rake environment
|
|
278
|
+
$ VVERBOSE=1 QUEUE=file_serve rake environment resque_admin:work
|
|
279
279
|
|
|
280
280
|
If you want ResqueAdmin to log to a file, in Rails do:
|
|
281
281
|
|
|
282
282
|
```ruby
|
|
283
|
-
# config/initializers/
|
|
283
|
+
# config/initializers/resque_admin.rb
|
|
284
284
|
ResqueAdmin.logger = Logger.new(Rails.root.join('log', "#{Rails.env}_resque.log"))
|
|
285
285
|
```
|
|
286
286
|
|
|
287
287
|
### Process IDs (PIDs)
|
|
288
288
|
|
|
289
|
-
There are scenarios where it's helpful to record the PID of a
|
|
289
|
+
There are scenarios where it's helpful to record the PID of a resque_admin
|
|
290
290
|
worker process. Use the PIDFILE option for easy access to the PID:
|
|
291
291
|
|
|
292
|
-
$ PIDFILE=./
|
|
292
|
+
$ PIDFILE=./resque_admin.pid QUEUE=file_serve rake environment resque_admin:work
|
|
293
293
|
|
|
294
294
|
### Running in the background
|
|
295
295
|
|
|
296
296
|
There are scenarios where it's helpful for
|
|
297
|
-
the
|
|
297
|
+
the resque_admin worker to run itself in the background (usually in combination with
|
|
298
298
|
PIDFILE). Use the BACKGROUND option so that rake will return as soon as the
|
|
299
299
|
worker is started.
|
|
300
300
|
|
|
301
|
-
$ PIDFILE=./
|
|
302
|
-
rake environment
|
|
301
|
+
$ PIDFILE=./resque_admin.pid BACKGROUND=yes QUEUE=file_serve \
|
|
302
|
+
rake environment resque_admin:work
|
|
303
303
|
|
|
304
304
|
### Polling frequency
|
|
305
305
|
|
|
306
306
|
You can pass an INTERVAL option which is a float representing the polling frequency.
|
|
307
307
|
The default is 5 seconds, but for a semi-active app you may want to use a smaller value.
|
|
308
308
|
|
|
309
|
-
$ INTERVAL=0.1 QUEUE=file_serve rake environment
|
|
309
|
+
$ INTERVAL=0.1 QUEUE=file_serve rake environment resque_admin:work
|
|
310
310
|
|
|
311
311
|
### Priorities and Queue Lists
|
|
312
312
|
|
|
@@ -316,7 +316,7 @@ of queues you give it. We call this list of queues the "queue list."
|
|
|
316
316
|
Let's say we add a `warm_cache` queue in addition to our `file_serve`
|
|
317
317
|
queue. We'd now start a worker like so:
|
|
318
318
|
|
|
319
|
-
$ QUEUES=file_serve,warm_cache rake
|
|
319
|
+
$ QUEUES=file_serve,warm_cache rake resque_admin:work
|
|
320
320
|
|
|
321
321
|
When the worker looks for new jobs, it will first check
|
|
322
322
|
`file_serve`. If it finds a job, it'll process it then check
|
|
@@ -328,7 +328,7 @@ whole process).
|
|
|
328
328
|
In this way you can prioritize certain queues. At GitHub we start our
|
|
329
329
|
workers with something like this:
|
|
330
330
|
|
|
331
|
-
$ QUEUES=critical,archive,high,low rake
|
|
331
|
+
$ QUEUES=critical,archive,high,low rake resque_admin:work
|
|
332
332
|
|
|
333
333
|
Notice the `archive` queue - it is specialized and in our future
|
|
334
334
|
architecture will only be run from a single machine.
|
|
@@ -336,11 +336,11 @@ architecture will only be run from a single machine.
|
|
|
336
336
|
At that point we'll start workers on our generalized background
|
|
337
337
|
machines with this command:
|
|
338
338
|
|
|
339
|
-
$ QUEUES=critical,high,low rake
|
|
339
|
+
$ QUEUES=critical,high,low rake resque_admin:work
|
|
340
340
|
|
|
341
341
|
And workers on our specialized archive machine with this command:
|
|
342
342
|
|
|
343
|
-
$ QUEUE=archive rake
|
|
343
|
+
$ QUEUE=archive rake resque_admin:work
|
|
344
344
|
|
|
345
345
|
|
|
346
346
|
### Running All Queues
|
|
@@ -348,7 +348,7 @@ And workers on our specialized archive machine with this command:
|
|
|
348
348
|
If you want your workers to work off of every queue, including new
|
|
349
349
|
queues created on the fly, you can use a splat:
|
|
350
350
|
|
|
351
|
-
$ QUEUE=* rake
|
|
351
|
+
$ QUEUE=* rake resque_admin:work
|
|
352
352
|
|
|
353
353
|
Queues will be processed in alphabetical order.
|
|
354
354
|
|
|
@@ -360,9 +360,9 @@ configuration file is included under `examples/god`. We recommend this
|
|
|
360
360
|
method.
|
|
361
361
|
|
|
362
362
|
If you'd like to run multiple workers in development mode, you can do
|
|
363
|
-
so using the `
|
|
363
|
+
so using the `resque_admin:workers` rake task:
|
|
364
364
|
|
|
365
|
-
$ COUNT=5 QUEUE=* rake
|
|
365
|
+
$ COUNT=5 QUEUE=* rake resque_admin:workers
|
|
366
366
|
|
|
367
367
|
This will spawn five ResqueAdmin workers, each in its own process. Hitting
|
|
368
368
|
ctrl-c should be sufficient to stop them all.
|
|
@@ -415,8 +415,8 @@ Workers instead handle their own state.
|
|
|
415
415
|
Here's a parent / child pair doing some work:
|
|
416
416
|
|
|
417
417
|
$ ps -e -o pid,command | grep [r]esque
|
|
418
|
-
92099
|
|
419
|
-
92102
|
|
418
|
+
92099 resque_admin: Forked 92102 at 1253142769
|
|
419
|
+
92102 resque_admin: Processing file_serve since 1253142769
|
|
420
420
|
|
|
421
421
|
You can clearly see that process 92099 forked 92102, which has been
|
|
422
422
|
working since 1253142769.
|
|
@@ -428,7 +428,7 @@ When a parent process is idle, it lets you know what queues it is
|
|
|
428
428
|
waiting for work on:
|
|
429
429
|
|
|
430
430
|
$ ps -e -o pid,command | grep [r]esque
|
|
431
|
-
92099
|
|
431
|
+
92099 resque_admin: Waiting for file_serve,warm_cache
|
|
432
432
|
|
|
433
433
|
|
|
434
434
|
### Signals
|
|
@@ -462,9 +462,9 @@ solution is to give a small amount of time for the job to finish
|
|
|
462
462
|
before killing it.
|
|
463
463
|
|
|
464
464
|
ResqueAdmin doesn't handle this out of the box (for both cedar-14 and heroku-16), you need to
|
|
465
|
-
install the [`
|
|
465
|
+
install the [`resque_admin-heroku-signals`](https://github.com/iloveitaly/resque_admin-heroku-signals)
|
|
466
466
|
addon which adds the required signal handling to make the behavior described above work.
|
|
467
|
-
Related issue: https://github.com/
|
|
467
|
+
Related issue: https://github.com/resque_admin/resque_admin/issues/1559
|
|
468
468
|
|
|
469
469
|
To accomplish this set the following environment variables:
|
|
470
470
|
|
|
@@ -538,24 +538,24 @@ your queue.
|
|
|
538
538
|
|
|
539
539
|
If you've installed ResqueAdmin as a gem running the front end standalone is easy:
|
|
540
540
|
|
|
541
|
-
$
|
|
541
|
+
$ resque_admin-web
|
|
542
542
|
|
|
543
543
|
It's a thin layer around `rackup` so it's configurable as well:
|
|
544
544
|
|
|
545
|
-
$
|
|
545
|
+
$ resque_admin-web -p 8282
|
|
546
546
|
|
|
547
547
|
If you have a ResqueAdmin config file you want evaluated just pass it to
|
|
548
548
|
the script as the final argument:
|
|
549
549
|
|
|
550
|
-
$
|
|
550
|
+
$ resque_admin-web -p 8282 rails_root/config/initializers/resque_admin.rb
|
|
551
551
|
|
|
552
|
-
You can also set the namespace directly using `
|
|
552
|
+
You can also set the namespace directly using `resque_admin-web`:
|
|
553
553
|
|
|
554
|
-
$
|
|
554
|
+
$ resque_admin-web -p 8282 -N myapp
|
|
555
555
|
|
|
556
556
|
or set the Redis connection string if you need to do something like select a different database:
|
|
557
557
|
|
|
558
|
-
$
|
|
558
|
+
$ resque_admin-web -p 8282 -r localhost:6379:2
|
|
559
559
|
|
|
560
560
|
### Passenger
|
|
561
561
|
|
|
@@ -575,7 +575,7 @@ require 'resque_admin/server'
|
|
|
575
575
|
|
|
576
576
|
run Rack::URLMap.new \
|
|
577
577
|
"/" => Your::App.new,
|
|
578
|
-
"/
|
|
578
|
+
"/resque_admin" => ResqueAdmin::Server.new
|
|
579
579
|
```
|
|
580
580
|
|
|
581
581
|
Check `examples/demo/config.ru` for a functional example (including
|
|
@@ -586,7 +586,7 @@ HTTP basic auth).
|
|
|
586
586
|
You can also mount ResqueAdmin on a subpath in your existing Rails 3 app by adding `require 'resque_admin/server'` to the top of your routes file or in an initializer then adding this to `routes.rb`:
|
|
587
587
|
|
|
588
588
|
``` ruby
|
|
589
|
-
mount ResqueAdmin::Server.new, :at => "/
|
|
589
|
+
mount ResqueAdmin::Server.new, :at => "/resque_admin"
|
|
590
590
|
```
|
|
591
591
|
|
|
592
592
|
|
|
@@ -649,7 +649,7 @@ Installing ResqueAdmin
|
|
|
649
649
|
|
|
650
650
|
First install the gem.
|
|
651
651
|
|
|
652
|
-
$ gem install
|
|
652
|
+
$ gem install resque_admin
|
|
653
653
|
|
|
654
654
|
Next include it in your application.
|
|
655
655
|
|
|
@@ -671,18 +671,18 @@ require 'your/app'
|
|
|
671
671
|
require 'resque_admin/tasks'
|
|
672
672
|
```
|
|
673
673
|
|
|
674
|
-
If you're using Rails 5.x, include the following in lib/tasks/
|
|
674
|
+
If you're using Rails 5.x, include the following in lib/tasks/resque_admin.rb:
|
|
675
675
|
|
|
676
676
|
```ruby
|
|
677
677
|
require 'resque_admin/tasks'
|
|
678
|
-
task '
|
|
678
|
+
task 'resque_admin:setup' => :environment
|
|
679
679
|
```
|
|
680
680
|
|
|
681
681
|
Now:
|
|
682
682
|
|
|
683
|
-
$ QUEUE=* rake
|
|
683
|
+
$ QUEUE=* rake resque_admin:work
|
|
684
684
|
|
|
685
|
-
Alternately you can define a `
|
|
685
|
+
Alternately you can define a `resque_admin:setup` hook in your Rakefile if you
|
|
686
686
|
don't want to load your app every time rake runs.
|
|
687
687
|
|
|
688
688
|
|
|
@@ -690,7 +690,7 @@ don't want to load your app every time rake runs.
|
|
|
690
690
|
|
|
691
691
|
First install the gem.
|
|
692
692
|
|
|
693
|
-
$ gem install
|
|
693
|
+
$ gem install resque_admin
|
|
694
694
|
|
|
695
695
|
Next include it in your application.
|
|
696
696
|
|
|
@@ -711,24 +711,24 @@ require 'resque_admin/tasks'
|
|
|
711
711
|
|
|
712
712
|
Now:
|
|
713
713
|
|
|
714
|
-
$ QUEUE=* rake environment
|
|
714
|
+
$ QUEUE=* rake environment resque_admin:work
|
|
715
715
|
|
|
716
|
-
Don't forget you can define a `
|
|
716
|
+
Don't forget you can define a `resque_admin:setup` hook in
|
|
717
717
|
`lib/tasks/whatever.rake` that loads the `environment` task every time.
|
|
718
718
|
|
|
719
719
|
|
|
720
720
|
### In a Rails 2.x app, as a plugin
|
|
721
721
|
|
|
722
|
-
$ ./script/plugin install git://github.com/
|
|
722
|
+
$ ./script/plugin install git://github.com/resque_admin/resque_admin
|
|
723
723
|
|
|
724
724
|
That's it! ResqueAdmin will automatically be available when your Rails app
|
|
725
725
|
loads.
|
|
726
726
|
|
|
727
727
|
To start a worker:
|
|
728
728
|
|
|
729
|
-
$ QUEUE=* rake environment
|
|
729
|
+
$ QUEUE=* rake environment resque_admin:work
|
|
730
730
|
|
|
731
|
-
Don't forget you can define a `
|
|
731
|
+
Don't forget you can define a `resque_admin:setup` hook in
|
|
732
732
|
`lib/tasks/whatever.rake` that loads the `environment` task every time.
|
|
733
733
|
|
|
734
734
|
|
|
@@ -738,7 +738,7 @@ First include it in your Gemfile.
|
|
|
738
738
|
|
|
739
739
|
$ cat Gemfile
|
|
740
740
|
...
|
|
741
|
-
gem '
|
|
741
|
+
gem 'resque_admin'
|
|
742
742
|
...
|
|
743
743
|
|
|
744
744
|
Next install it with Bundler.
|
|
@@ -752,7 +752,7 @@ Now start your application:
|
|
|
752
752
|
That's it! You can now create ResqueAdmin jobs from within your app.
|
|
753
753
|
|
|
754
754
|
To start a worker, add this to a file in `lib/tasks` (ex:
|
|
755
|
-
`lib/tasks/
|
|
755
|
+
`lib/tasks/resque_admin.rake`):
|
|
756
756
|
|
|
757
757
|
``` ruby
|
|
758
758
|
require 'resque_admin/tasks'
|
|
@@ -760,9 +760,9 @@ require 'resque_admin/tasks'
|
|
|
760
760
|
|
|
761
761
|
Now:
|
|
762
762
|
|
|
763
|
-
$ QUEUE=* rake environment
|
|
763
|
+
$ QUEUE=* rake environment resque_admin:work
|
|
764
764
|
|
|
765
|
-
Don't forget you can define a `
|
|
765
|
+
Don't forget you can define a `resque_admin:setup` hook in
|
|
766
766
|
`lib/tasks/whatever.rake` that loads the `environment` task every time.
|
|
767
767
|
|
|
768
768
|
|
|
@@ -780,11 +780,11 @@ String: `ResqueAdmin.redis = 'localhost:6379'`
|
|
|
780
780
|
|
|
781
781
|
Redis: `ResqueAdmin.redis = $redis`
|
|
782
782
|
|
|
783
|
-
For our rails app we have a `config/initializers/
|
|
784
|
-
we load `config/
|
|
783
|
+
For our rails app we have a `config/initializers/resque_admin.rb` file where
|
|
784
|
+
we load `config/resque_admin.yml` by hand and set the Redis information
|
|
785
785
|
appropriately.
|
|
786
786
|
|
|
787
|
-
Here's our `config/
|
|
787
|
+
Here's our `config/resque_admin.yml`:
|
|
788
788
|
|
|
789
789
|
development: localhost:6379
|
|
790
790
|
test: localhost:6379
|
|
@@ -798,14 +798,14 @@ And our initializer:
|
|
|
798
798
|
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
|
|
799
799
|
rails_env = ENV['RAILS_ENV'] || 'development'
|
|
800
800
|
|
|
801
|
-
resque_config = YAML.load_file(rails_root + '/config/
|
|
801
|
+
resque_config = YAML.load_file(rails_root + '/config/resque_admin.yml')
|
|
802
802
|
ResqueAdmin.redis = resque_config[rails_env]
|
|
803
803
|
```
|
|
804
804
|
|
|
805
805
|
Easy peasy! Why not just use `RAILS_ROOT` and `RAILS_ENV`? Because
|
|
806
806
|
this way we can tell our Sinatra app about the config file:
|
|
807
807
|
|
|
808
|
-
$ RAILS_ENV=production
|
|
808
|
+
$ RAILS_ENV=production resque_admin-web rails_root/config/initializers/resque_admin.rb
|
|
809
809
|
|
|
810
810
|
Now everyone is on the same page.
|
|
811
811
|
|
|
@@ -821,11 +821,11 @@ Plugins and Hooks
|
|
|
821
821
|
-----------------
|
|
822
822
|
|
|
823
823
|
For a list of available plugins see
|
|
824
|
-
<http://wiki.github.com/
|
|
824
|
+
<http://wiki.github.com/resque_admin/resque_admin/plugins>.
|
|
825
825
|
|
|
826
826
|
If you'd like to write your own plugin, or want to customize ResqueAdmin
|
|
827
827
|
using hooks (such as `ResqueAdmin.after_fork`), see
|
|
828
|
-
[docs/HOOKS.md](http://github.com/
|
|
828
|
+
[docs/HOOKS.md](http://github.com/resque_admin/resque_admin/blob/master/docs/HOOKS.md).
|
|
829
829
|
|
|
830
830
|
|
|
831
831
|
Namespaces
|
|
@@ -842,7 +842,7 @@ in your Redis server.
|
|
|
842
842
|
Simply use the `ResqueAdmin.redis.namespace` accessor:
|
|
843
843
|
|
|
844
844
|
``` ruby
|
|
845
|
-
ResqueAdmin.redis.namespace = "
|
|
845
|
+
ResqueAdmin.redis.namespace = "resque_admin:GitHub"
|
|
846
846
|
```
|
|
847
847
|
|
|
848
848
|
We recommend sticking this in your initializer somewhere after Redis
|
|
@@ -869,7 +869,7 @@ the other is for killing workers that have been running too long.
|
|
|
869
869
|
|
|
870
870
|
### monit
|
|
871
871
|
|
|
872
|
-
If you're using monit, `examples/monit/
|
|
872
|
+
If you're using monit, `examples/monit/resque_admin.monit` is provided free
|
|
873
873
|
of charge. This is **not** used by GitHub in production, so please
|
|
874
874
|
send patches for any tweaks or improvements you can make to it.
|
|
875
875
|
|
|
@@ -877,7 +877,7 @@ send patches for any tweaks or improvements you can make to it.
|
|
|
877
877
|
Questions
|
|
878
878
|
---------
|
|
879
879
|
|
|
880
|
-
Please add them to the [FAQ](https://github.com/
|
|
880
|
+
Please add them to the [FAQ](https://github.com/resque_admin/resque_admin/wiki/FAQ) or open an issue on this repo.
|
|
881
881
|
|
|
882
882
|
|
|
883
883
|
Development
|
|
@@ -887,8 +887,8 @@ Want to hack on ResqueAdmin?
|
|
|
887
887
|
|
|
888
888
|
First clone the repo and run the tests:
|
|
889
889
|
|
|
890
|
-
git clone git://github.com/
|
|
891
|
-
cd
|
|
890
|
+
git clone git://github.com/resque_admin/resque_admin.git
|
|
891
|
+
cd resque_admin
|
|
892
892
|
rake test
|
|
893
893
|
|
|
894
894
|
If the tests do not pass make sure you have Redis installed
|
|
@@ -927,19 +927,19 @@ Once you've made your great commits:
|
|
|
927
927
|
Mailing List
|
|
928
928
|
------------
|
|
929
929
|
|
|
930
|
-
This mailing list is no longer maintained. The archive can be found at <http://librelist.com/browser/
|
|
930
|
+
This mailing list is no longer maintained. The archive can be found at <http://librelist.com/browser/resque_admin/>.
|
|
931
931
|
|
|
932
932
|
|
|
933
933
|
Meta
|
|
934
934
|
----
|
|
935
935
|
|
|
936
|
-
* Code: `git clone git://github.com/
|
|
937
|
-
* Home: <http://github.com/
|
|
938
|
-
* Docs: <http://rubydoc.info/gems/
|
|
939
|
-
* Bugs: <http://github.com/
|
|
940
|
-
* List: <
|
|
941
|
-
* Chat: <irc://irc.freenode.net/
|
|
942
|
-
* Gems: <http://gemcutter.org/gems/
|
|
936
|
+
* Code: `git clone git://github.com/resque_admin/resque_admin.git`
|
|
937
|
+
* Home: <http://github.com/resque_admin/resque_admin>
|
|
938
|
+
* Docs: <http://rubydoc.info/gems/resque_admin>
|
|
939
|
+
* Bugs: <http://github.com/resque_admin/resque_admin/issues>
|
|
940
|
+
* List: <resque_admin@librelist.com>
|
|
941
|
+
* Chat: <irc://irc.freenode.net/resque_admin>
|
|
942
|
+
* Gems: <http://gemcutter.org/gems/resque_admin>
|
|
943
943
|
|
|
944
944
|
This project uses [Semantic Versioning][sv].
|
|
945
945
|
|
|
@@ -949,9 +949,9 @@ Author
|
|
|
949
949
|
|
|
950
950
|
Chris Wanstrath :: chris@ozmm.org :: @defunkt
|
|
951
951
|
|
|
952
|
-
[0]: http://github.com/blog/542-introducing-
|
|
952
|
+
[0]: http://github.com/blog/542-introducing-resque_admin
|
|
953
953
|
[1]: http://help.github.com/forking/
|
|
954
|
-
[2]: http://github.com/
|
|
954
|
+
[2]: http://github.com/resque_admin/resque_admin/issues
|
|
955
955
|
[sv]: http://semver.org/
|
|
956
|
-
[rs]: http://github.com/
|
|
957
|
-
[cb]: http://wiki.github.com/
|
|
956
|
+
[rs]: http://github.com/resque_admin/redis-namespace
|
|
957
|
+
[cb]: http://wiki.github.com/resque_admin/resque_admin/contributing
|
data/bin/{resque → resque-admin}
RENAMED
|
@@ -11,7 +11,7 @@ require 'resque_admin'
|
|
|
11
11
|
require 'optparse'
|
|
12
12
|
|
|
13
13
|
parser = OptionParser.new do |opts|
|
|
14
|
-
opts.banner = "Usage:
|
|
14
|
+
opts.banner = "Usage: resque_admin [options] COMMAND"
|
|
15
15
|
|
|
16
16
|
opts.separator ""
|
|
17
17
|
opts.separator "Options:"
|
|
@@ -37,7 +37,7 @@ parser = OptionParser.new do |opts|
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def kill(worker)
|
|
40
|
-
abort "**
|
|
40
|
+
abort "** resque_admin kill WORKER_ID" if worker.nil?
|
|
41
41
|
pid = worker.split(':')[1].to_i
|
|
42
42
|
|
|
43
43
|
begin
|
|
@@ -51,7 +51,7 @@ def kill(worker)
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def remove(worker)
|
|
54
|
-
abort "**
|
|
54
|
+
abort "** resque_admin remove WORKER_ID" if worker.nil?
|
|
55
55
|
|
|
56
56
|
ResqueAdmin.remove_worker(worker)
|
|
57
57
|
puts "** removed #{worker}"
|
|
@@ -10,7 +10,7 @@ end
|
|
|
10
10
|
require 'resque_admin/server'
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
Vegas::Runner.new(ResqueAdmin::Server, 'resque-web', {
|
|
13
|
+
Vegas::Runner.new(ResqueAdmin::Server, 'resque-admin-web', {
|
|
14
14
|
:before_run => lambda {|v|
|
|
15
15
|
path = (ENV['RESQUECONFIG'] || v.args.first)
|
|
16
16
|
load path.to_s.strip if path
|
data/lib/resque_admin.rb
CHANGED
|
@@ -120,7 +120,7 @@ module ResqueAdmin
|
|
|
120
120
|
redis = Redis.new(:host => host, :port => port,
|
|
121
121
|
:thread_safe => true, :db => db)
|
|
122
122
|
end
|
|
123
|
-
namespace ||= :
|
|
123
|
+
namespace ||= :resque_admin
|
|
124
124
|
|
|
125
125
|
@data_store = ResqueAdmin::DataStore.new(Redis::Namespace.new(namespace, :redis => redis))
|
|
126
126
|
when Redis::Namespace
|
|
@@ -128,9 +128,9 @@ module ResqueAdmin
|
|
|
128
128
|
when ResqueAdmin::DataStore
|
|
129
129
|
@data_store = server
|
|
130
130
|
when Hash
|
|
131
|
-
@data_store = ResqueAdmin::DataStore.new(Redis::Namespace.new(:
|
|
131
|
+
@data_store = ResqueAdmin::DataStore.new(Redis::Namespace.new(:resque_admin, :redis => Redis.new(server)))
|
|
132
132
|
else
|
|
133
|
-
@data_store = ResqueAdmin::DataStore.new(Redis::Namespace.new(:
|
|
133
|
+
@data_store = ResqueAdmin::DataStore.new(Redis::Namespace.new(:resque_admin, :redis => server))
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
|
|
@@ -119,7 +119,7 @@ module ResqueAdmin
|
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
def filter_backtrace(backtrace)
|
|
122
|
-
index = backtrace.index { |item| item.include?('/lib/
|
|
122
|
+
index = backtrace.index { |item| item.include?('/lib/resque_admin/job.rb') }
|
|
123
123
|
backtrace.first(index.to_i)
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -96,7 +96,7 @@ module ResqueAdmin
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def filter_backtrace(backtrace)
|
|
99
|
-
index = backtrace.index { |item| item.include?('/lib/
|
|
99
|
+
index = backtrace.index { |item| item.include?('/lib/resque_admin/job.rb') }
|
|
100
100
|
backtrace.first(index.to_i)
|
|
101
101
|
end
|
|
102
102
|
end
|
data/lib/resque_admin/server.rb
CHANGED
|
@@ -146,7 +146,7 @@ module ResqueAdmin
|
|
|
146
146
|
def show(page, layout = true)
|
|
147
147
|
response["Cache-Control"] = "max-age=0, private, must-revalidate"
|
|
148
148
|
begin
|
|
149
|
-
erb page.to_sym, {:layout => layout}, :
|
|
149
|
+
erb page.to_sym, {:layout => layout}, :resque_admin => ResqueAdmin
|
|
150
150
|
rescue Errno::ECONNREFUSED
|
|
151
151
|
erb :error, {:layout => false}, :error => "Can't connect to Redis! (#{ResqueAdmin.redis_id})"
|
|
152
152
|
end
|
|
@@ -253,7 +253,7 @@ module ResqueAdmin
|
|
|
253
253
|
end
|
|
254
254
|
|
|
255
255
|
get "/stats/?" do
|
|
256
|
-
redirect redirect_url_path("/stats/
|
|
256
|
+
redirect redirect_url_path("/stats/resque_admin")
|
|
257
257
|
end
|
|
258
258
|
|
|
259
259
|
get "/stats/:id/?" do
|
|
@@ -268,11 +268,11 @@ module ResqueAdmin
|
|
|
268
268
|
info = ResqueAdmin.info
|
|
269
269
|
|
|
270
270
|
stats = []
|
|
271
|
-
stats << "
|
|
272
|
-
stats << "
|
|
273
|
-
stats << "
|
|
274
|
-
stats << "
|
|
275
|
-
stats << "
|
|
271
|
+
stats << "resque_admin.pending=#{info[:pending]}"
|
|
272
|
+
stats << "resque_admin.processed+=#{info[:processed]}"
|
|
273
|
+
stats << "resque_admin.failed+=#{info[:failed]}"
|
|
274
|
+
stats << "resque_admin.workers=#{info[:workers]}"
|
|
275
|
+
stats << "resque_admin.working=#{info[:working]}"
|
|
276
276
|
|
|
277
277
|
ResqueAdmin.queues.each do |queue|
|
|
278
278
|
stats << "queues.#{queue}=#{ResqueAdmin.size(queue)}"
|
|
@@ -282,7 +282,7 @@ module ResqueAdmin
|
|
|
282
282
|
stats.join "\n"
|
|
283
283
|
end
|
|
284
284
|
|
|
285
|
-
def
|
|
285
|
+
def resque_admin
|
|
286
286
|
ResqueAdmin
|
|
287
287
|
end
|
|
288
288
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<p class='sub'><%= page_entries_info start = params[:start].to_i, start + 20, size = redis_get_size(key) %></p>
|
|
4
4
|
|
|
5
|
-
<h1>Key "<%= key %>" is a <%=
|
|
5
|
+
<h1>Key "<%= key %>" is a <%= resque_admin.redis.type key %></h1>
|
|
6
6
|
<table>
|
|
7
7
|
<% for row in redis_get_value_as_array(key, start) %>
|
|
8
8
|
<tr>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<%= tab tab_name %>
|
|
17
17
|
<% end %>
|
|
18
18
|
</ul>
|
|
19
|
-
<% if ResqueAdmin.redis.namespace != :
|
|
19
|
+
<% if ResqueAdmin.redis.namespace != :resque_admin %>
|
|
20
20
|
<abbr class="namespace" title="ResqueAdmin's Redis Namespace">
|
|
21
21
|
<%= ResqueAdmin.redis.namespace %>
|
|
22
22
|
</abbr>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
<div id="footer">
|
|
39
|
-
<p>Powered by <a href="http://github.com/
|
|
39
|
+
<p>Powered by <a href="http://github.com/resque_admin/resque_admin">ResqueAdmin</a> v<%=ResqueAdmin::Version%></p>
|
|
40
40
|
<p>Connected to Redis namespace <%= ResqueAdmin.redis.namespace %> on <%=ResqueAdmin.redis_id%></p>
|
|
41
41
|
</div>
|
|
42
42
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% # per_page was added in 1.23.1; gems which add to
|
|
1
|
+
<% # per_page was added in 1.23.1; gems which add to resque_admin-server don't pass that variable along so it would crash %>
|
|
2
2
|
<% # without a default value %>
|
|
3
3
|
<% per_page ||= 20 %>
|
|
4
4
|
<%if start - per_page >= 0 || start + per_page <= size%>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% @subtabs =
|
|
1
|
+
<% @subtabs = resque_admin.queues unless partial? || params[:id].nil? %>
|
|
2
2
|
|
|
3
3
|
<% if queue = params[:id] %>
|
|
4
4
|
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<form method="POST" action="<%=u "/queues/#{queue}/remove" %>" class='remove-queue'>
|
|
7
7
|
<input type='submit' name='' value='Remove Queue' onclick='return confirm("Are you absolutely sure? This cannot be undone.");' />
|
|
8
8
|
</form>
|
|
9
|
-
<p class='sub'><%= page_entries_info start = params[:start].to_i, start + 19, size =
|
|
9
|
+
<p class='sub'><%= page_entries_info start = params[:start].to_i, start + 19, size = resque_admin.size(queue), 'job' %></p>
|
|
10
10
|
<table class='jobs'>
|
|
11
11
|
<tr>
|
|
12
12
|
<th>Class</th>
|
|
13
13
|
<th>Args</th>
|
|
14
14
|
</tr>
|
|
15
|
-
<% for job in (jobs =
|
|
15
|
+
<% for job in (jobs = resque_admin.peek(queue, start, 20)) %>
|
|
16
16
|
<tr>
|
|
17
17
|
<td class='class'><%= partial :job_class, :job => job %></td>
|
|
18
18
|
<td class='args'><%=h job['args'].inspect %></td>
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
<th>Name</th>
|
|
35
35
|
<th>Jobs</th>
|
|
36
36
|
</tr>
|
|
37
|
-
<%
|
|
37
|
+
<% resque_admin.queues.sort_by { |q| q.to_s }.each do |queue| %>
|
|
38
38
|
<tr>
|
|
39
39
|
<td class='queue'><a class="queue" href="<%= u "queues/#{queue}" %>"><%= queue %></a></td>
|
|
40
|
-
<td class='size'><%=
|
|
40
|
+
<td class='size'><%= resque_admin.size queue %></td>
|
|
41
41
|
</tr>
|
|
42
42
|
<% end %>
|
|
43
43
|
<% if failed_multiple_queues? %>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<% @subtabs = %w(
|
|
1
|
+
<% @subtabs = %w( resque_admin redis keys ) %>
|
|
2
2
|
|
|
3
3
|
<% if params[:key] %>
|
|
4
4
|
|
|
5
|
-
<%= partial
|
|
5
|
+
<%= partial resque_admin.redis.type(params[:key]).eql?("string") ? :key_string : :key_sets %>
|
|
6
6
|
|
|
7
|
-
<% elsif params[:id] == "
|
|
7
|
+
<% elsif params[:id] == "resque_admin" %>
|
|
8
8
|
|
|
9
|
-
<h1><%=
|
|
9
|
+
<h1><%= resque_admin %></h1>
|
|
10
10
|
<table class='stats'>
|
|
11
|
-
<% for key, value in
|
|
11
|
+
<% for key, value in resque_admin.info.to_a.sort_by { |i| i[0].to_s } %>
|
|
12
12
|
<tr>
|
|
13
13
|
<th>
|
|
14
14
|
<%= key %>
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
|
|
23
23
|
<% elsif params[:id] == 'redis' %>
|
|
24
24
|
|
|
25
|
-
<h1><%=
|
|
25
|
+
<h1><%= resque_admin.redis_id %></h1>
|
|
26
26
|
<table class='stats'>
|
|
27
|
-
<% for key, value in
|
|
27
|
+
<% for key, value in resque_admin.redis.info.to_a.sort_by { |i| i[0].to_s } %>
|
|
28
28
|
<tr>
|
|
29
29
|
<th>
|
|
30
30
|
<%= key %>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
<% elsif params[:id] == 'keys' %>
|
|
40
40
|
|
|
41
|
-
<h1>Keys owned by <%=
|
|
41
|
+
<h1>Keys owned by <%= resque_admin %></h1>
|
|
42
42
|
<p class='sub'>(All keys are actually prefixed with "<%= ResqueAdmin.redis.namespace %>:")</p>
|
|
43
43
|
<table class='stats'>
|
|
44
44
|
<tr>
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
<th>type</th>
|
|
47
47
|
<th>size</th>
|
|
48
48
|
</tr>
|
|
49
|
-
<% for key in
|
|
49
|
+
<% for key in resque_admin.keys.sort %>
|
|
50
50
|
<tr>
|
|
51
51
|
<th>
|
|
52
52
|
<a href="<%=u "/stats/keys/#{key}" %>"><%= key %></a>
|
|
53
53
|
</th>
|
|
54
|
-
<td><%=
|
|
54
|
+
<td><%= resque_admin.redis.type key %></td>
|
|
55
55
|
<td><%= redis_get_size key %></td>
|
|
56
56
|
</tr>
|
|
57
57
|
<% end %>
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
<% else %>
|
|
29
29
|
|
|
30
30
|
<%
|
|
31
|
-
workers =
|
|
31
|
+
workers = resque_admin.working
|
|
32
32
|
jobs = workers.collect {|w| w.job }
|
|
33
33
|
worker_jobs = workers.zip(jobs)
|
|
34
34
|
worker_jobs = worker_jobs.reject { |w, j| w.idle? }
|
|
35
35
|
%>
|
|
36
36
|
|
|
37
|
-
<h1 class='wi'><%= worker_jobs.size %> of <%=
|
|
37
|
+
<h1 class='wi'><%= worker_jobs.size %> of <%= resque_admin.workers.size %> Workers Working</h1>
|
|
38
38
|
<p class='intro'>The list below contains all workers which are currently running a job.</p>
|
|
39
39
|
<table class='workers'>
|
|
40
40
|
<tr>
|
data/lib/resque_admin/tasks.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# require 'resque_admin/tasks'
|
|
2
|
-
# will give you the
|
|
2
|
+
# will give you the resque_admin tasks
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
namespace :
|
|
5
|
+
namespace :resque_admin do
|
|
6
6
|
task :setup
|
|
7
7
|
|
|
8
8
|
desc "Start a ResqueAdmin worker"
|
|
@@ -12,7 +12,7 @@ namespace :resque do
|
|
|
12
12
|
begin
|
|
13
13
|
worker = ResqueAdmin::Worker.new
|
|
14
14
|
rescue ResqueAdmin::NoQueueError
|
|
15
|
-
abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake
|
|
15
|
+
abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque_admin:work"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
worker.prepare
|
|
@@ -25,12 +25,12 @@ namespace :resque do
|
|
|
25
25
|
threads = []
|
|
26
26
|
|
|
27
27
|
if ENV['COUNT'].to_i < 1
|
|
28
|
-
abort "set COUNT env var, e.g. $ COUNT=2 rake
|
|
28
|
+
abort "set COUNT env var, e.g. $ COUNT=2 rake resque_admin:workers"
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
ENV['COUNT'].to_i.times do
|
|
32
32
|
threads << Thread.new do
|
|
33
|
-
system "rake
|
|
33
|
+
system "rake resque_admin:work"
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
data/lib/resque_admin/version.rb
CHANGED
data/lib/resque_admin/worker.rb
CHANGED
|
@@ -346,7 +346,7 @@ module ResqueAdmin
|
|
|
346
346
|
|
|
347
347
|
# Runs all the methods needed when a worker begins its lifecycle.
|
|
348
348
|
def startup
|
|
349
|
-
$0 = "
|
|
349
|
+
$0 = "resque_admin: Starting"
|
|
350
350
|
|
|
351
351
|
enable_gc_optimizations
|
|
352
352
|
register_signal_handlers
|
|
@@ -355,7 +355,7 @@ module ResqueAdmin
|
|
|
355
355
|
run_hook :before_first_fork
|
|
356
356
|
register_worker
|
|
357
357
|
|
|
358
|
-
# Fix buffering so we can `rake
|
|
358
|
+
# Fix buffering so we can `rake resque_admin:work > resque_admin.log` and
|
|
359
359
|
# get output from the child in there.
|
|
360
360
|
$stdout.sync = true
|
|
361
361
|
end
|
|
@@ -811,7 +811,7 @@ module ResqueAdmin
|
|
|
811
811
|
# Find ResqueAdmin worker pids on Linux and OS X.
|
|
812
812
|
#
|
|
813
813
|
def linux_worker_pids
|
|
814
|
-
`ps -A -o pid,command | grep -E "[r]esque:work|[r]esque:\sStarting|[r]esque-[0-9]" | grep -v "
|
|
814
|
+
`ps -A -o pid,command | grep -E "[r]esque:work|[r]esque:\sStarting|[r]esque-[0-9]" | grep -v "resque_admin-web"`.split("\n").map do |line|
|
|
815
815
|
line.split(' ')[0]
|
|
816
816
|
end
|
|
817
817
|
end
|
|
@@ -821,10 +821,10 @@ module ResqueAdmin
|
|
|
821
821
|
# Returns an Array of string pids of all the other workers on this
|
|
822
822
|
# machine. Useful when pruning dead workers on startup.
|
|
823
823
|
def solaris_worker_pids
|
|
824
|
-
`ps -A -o pid,comm | grep "[r]uby" | grep -v "
|
|
824
|
+
`ps -A -o pid,comm | grep "[r]uby" | grep -v "resque_admin-web"`.split("\n").map do |line|
|
|
825
825
|
real_pid = line.split(' ')[0]
|
|
826
|
-
pargs_command = `pargs -a #{real_pid} 2>/dev/null | grep [r]esque | grep -v "
|
|
827
|
-
if pargs_command.split(':')[1] == "
|
|
826
|
+
pargs_command = `pargs -a #{real_pid} 2>/dev/null | grep [r]esque | grep -v "resque_admin-web"`
|
|
827
|
+
if pargs_command.split(':')[1] == " resque_admin-#{ResqueAdmin::Version}"
|
|
828
828
|
real_pid
|
|
829
829
|
end
|
|
830
830
|
end.compact
|
|
@@ -834,7 +834,7 @@ module ResqueAdmin
|
|
|
834
834
|
# Procline is always in the format of:
|
|
835
835
|
# RESQUE_PROCLINE_PREFIXresque-VERSION: STRING
|
|
836
836
|
def procline(string)
|
|
837
|
-
$0 = "#{ENV['RESQUE_PROCLINE_PREFIX']}
|
|
837
|
+
$0 = "#{ENV['RESQUE_PROCLINE_PREFIX']}resque_admin-#{ResqueAdmin::Version}: #{string}"
|
|
838
838
|
log_with_severity :debug, $0
|
|
839
839
|
end
|
|
840
840
|
|
|
File without changes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: resque_admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Wanstrath
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2017-09-
|
|
13
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: redis-namespace
|
|
@@ -99,8 +99,8 @@ description: |2
|
|
|
99
99
|
* A Sinatra app for monitoring queues, jobs, and workers.
|
|
100
100
|
email: steve@steveklabnik.com
|
|
101
101
|
executables:
|
|
102
|
-
- resque
|
|
103
|
-
- resque-web
|
|
102
|
+
- resque-admin
|
|
103
|
+
- resque-admin-web
|
|
104
104
|
extensions: []
|
|
105
105
|
extra_rdoc_files:
|
|
106
106
|
- LICENSE
|
|
@@ -110,8 +110,8 @@ files:
|
|
|
110
110
|
- LICENSE
|
|
111
111
|
- README.markdown
|
|
112
112
|
- Rakefile
|
|
113
|
-
- bin/resque
|
|
114
|
-
- bin/resque-web
|
|
113
|
+
- bin/resque-admin
|
|
114
|
+
- bin/resque-admin-web
|
|
115
115
|
- lib/resque_admin.rb
|
|
116
116
|
- lib/resque_admin/data_store.rb
|
|
117
117
|
- lib/resque_admin/errors.rb
|
|
@@ -162,7 +162,7 @@ files:
|
|
|
162
162
|
- lib/resque_admin/version.rb
|
|
163
163
|
- lib/resque_admin/worker.rb
|
|
164
164
|
- lib/tasks/redis.rake
|
|
165
|
-
- lib/tasks/
|
|
165
|
+
- lib/tasks/resque_admin.rake
|
|
166
166
|
homepage: http://resque.github.io/
|
|
167
167
|
licenses:
|
|
168
168
|
- MIT
|