resque_admin 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +30 -30
  3. data/README.markdown +83 -83
  4. data/bin/resque +5 -5
  5. data/bin/resque-web +4 -4
  6. data/lib/resque_admin/data_store.rb +4 -4
  7. data/lib/resque_admin/errors.rb +1 -1
  8. data/lib/resque_admin/failure/airbrake.rb +4 -4
  9. data/lib/resque_admin/failure/base.rb +1 -1
  10. data/lib/resque_admin/failure/multiple.rb +2 -2
  11. data/lib/resque_admin/failure/redis.rb +7 -7
  12. data/lib/resque_admin/failure/redis_multi_queue.rb +11 -11
  13. data/lib/resque_admin/failure.rb +6 -6
  14. data/lib/resque_admin/helpers.rb +9 -9
  15. data/lib/resque_admin/job.rb +22 -22
  16. data/lib/resque_admin/log_formatters/quiet_formatter.rb +1 -1
  17. data/lib/resque_admin/log_formatters/verbose_formatter.rb +1 -1
  18. data/lib/resque_admin/log_formatters/very_verbose_formatter.rb +1 -1
  19. data/lib/resque_admin/logging.rb +2 -2
  20. data/lib/resque_admin/plugin.rb +2 -2
  21. data/lib/resque_admin/server/helpers.rb +4 -4
  22. data/lib/resque_admin/server/test_helper.rb +2 -2
  23. data/lib/resque_admin/server/views/failed.erb +2 -2
  24. data/lib/resque_admin/server/views/failed_queues_overview.erb +3 -3
  25. data/lib/resque_admin/server/views/layout.erb +6 -6
  26. data/lib/resque_admin/server/views/queues.erb +5 -5
  27. data/lib/resque_admin/server/views/stats.erb +1 -1
  28. data/lib/resque_admin/server/views/workers.erb +4 -4
  29. data/lib/resque_admin/server/views/working.erb +1 -1
  30. data/lib/resque_admin/server.rb +35 -35
  31. data/lib/resque_admin/stat.rb +2 -2
  32. data/lib/resque_admin/tasks.rb +8 -8
  33. data/lib/resque_admin/thread_signal.rb +1 -1
  34. data/lib/resque_admin/version.rb +2 -2
  35. data/lib/resque_admin/worker.rb +29 -29
  36. data/lib/resque_admin.rb +27 -27
  37. metadata +4 -4
data/README.markdown CHANGED
@@ -1,11 +1,11 @@
1
- Resque
1
+ ResqueAdmin
2
2
  ======
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/resque.svg)](https://rubygems.org/gems/resque)
5
5
  [![Build Status](https://travis-ci.org/resque/resque.svg)](https://travis-ci.org/resque/resque)
6
6
  [![Coverage Status](https://coveralls.io/repos/github/resque/resque/badge.svg?branch=1-x-stable)](https://coveralls.io/r/resque/resque?branch=1-x-stable)
7
7
 
8
- Resque (pronounced like "rescue") is a Redis-backed library for creating
8
+ ResqueAdmin (pronounced like "rescue") is a Redis-backed library for creating
9
9
  background jobs, placing those jobs on multiple queues, and processing
10
10
  them later.
11
11
 
@@ -14,44 +14,44 @@ Background jobs can be any Ruby class or module that responds to
14
14
  jobs or you can create new classes specifically to do work. Or, you
15
15
  can do both.
16
16
 
17
- Resque is heavily inspired by DelayedJob (which rocks) and comprises
17
+ ResqueAdmin is heavily inspired by DelayedJob (which rocks) and comprises
18
18
  three parts:
19
19
 
20
20
  1. A Ruby library for creating, querying, and processing jobs
21
21
  2. A Rake task for starting a worker which processes jobs
22
22
  3. A Sinatra app for monitoring queues, jobs, and workers.
23
23
 
24
- Resque workers can be distributed between multiple machines,
24
+ ResqueAdmin workers can be distributed between multiple machines,
25
25
  support priorities, are resilient to memory bloat / "leaks," are
26
26
  optimized for REE (but work on MRI and JRuby), tell you what they're
27
27
  doing, and expect failure.
28
28
 
29
- Resque queues are persistent; support constant time, atomic push and
29
+ ResqueAdmin queues are persistent; support constant time, atomic push and
30
30
  pop (thanks to Redis); provide visibility into their contents; and
31
31
  store jobs as simple JSON packages.
32
32
 
33
- The Resque frontend tells you what workers are doing, what workers are
33
+ The ResqueAdmin frontend tells you what workers are doing, what workers are
34
34
  not doing, what queues you're using, what's in those queues, provides
35
35
  general usage stats, and helps you track failures.
36
36
 
37
- Resque now supports Ruby 2.0.0 and above. Any future updates will not be
37
+ ResqueAdmin now supports Ruby 2.0.0 and above. Any future updates will not be
38
38
  guaranteed to work without defects on any Rubies older than 2.0.0. We will also only be supporting Redis 3.0 and above going forward.
39
39
 
40
40
 
41
41
  The Blog Post
42
42
  -------------
43
43
 
44
- For the backstory, philosophy, and history of Resque's beginnings,
44
+ For the backstory, philosophy, and history of ResqueAdmin's beginnings,
45
45
  please see [the blog post][0].
46
46
 
47
47
 
48
48
  Overview
49
49
  --------
50
50
 
51
- Resque allows you to create jobs and place them on a queue, then,
51
+ ResqueAdmin allows you to create jobs and place them on a queue, then,
52
52
  later, pull those jobs off the queue and process them.
53
53
 
54
- Resque jobs are Ruby classes (or modules) which respond to the
54
+ ResqueAdmin jobs are Ruby classes (or modules) which respond to the
55
55
  `perform` method. Here's an example:
56
56
 
57
57
 
@@ -76,7 +76,7 @@ to our application's pre-existing `Repository` class:
76
76
  ``` ruby
77
77
  class Repository
78
78
  def async_create_archive(branch)
79
- Resque.enqueue(Archive, self.id, branch)
79
+ ResqueAdmin.enqueue(Archive, self.id, branch)
80
80
  end
81
81
  end
82
82
  ```
@@ -88,7 +88,7 @@ queue.
88
88
  Later, a worker will run something like this code to process the job:
89
89
 
90
90
  ``` ruby
91
- klass, args = Resque.reserve(:file_serve)
91
+ klass, args = ResqueAdmin.reserve(:file_serve)
92
92
  klass.perform(*args) if klass.respond_to? :perform
93
93
  ```
94
94
 
@@ -103,9 +103,9 @@ Let's start a worker to run `file_serve` jobs:
103
103
  $ cd app_root
104
104
  $ QUEUE=file_serve rake resque:work
105
105
 
106
- This starts one Resque worker and tells it to work off the
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
108
- `Resque.reserve` code snippet above and process jobs until it can't
108
+ `ResqueAdmin.reserve` code snippet above and process jobs until it can't
109
109
  find any more, at which point it will sleep for a small period and
110
110
  repeatedly poll the queue for more jobs.
111
111
 
@@ -120,7 +120,7 @@ Jobs
120
120
  What should you run in the background? Anything that takes any time at
121
121
  all. Slow INSERT statements, disk manipulating, data processing, etc.
122
122
 
123
- At GitHub we use Resque to process the following types of jobs:
123
+ At GitHub we use ResqueAdmin to process the following types of jobs:
124
124
 
125
125
  * Warming caches
126
126
  * Counting disk usage
@@ -134,7 +134,7 @@ At GitHub we use Resque to process the following types of jobs:
134
134
 
135
135
  As of writing we have about 35 different types of background jobs.
136
136
 
137
- Keep in mind that you don't need a web app to use Resque - we just
137
+ Keep in mind that you don't need a web app to use ResqueAdmin - we just
138
138
  mention "foreground" and "background" because they make conceptual
139
139
  sense. You could easily be spidering sites and sticking data which
140
140
  needs to be crunched later into a queue.
@@ -164,13 +164,13 @@ Because of this your jobs must only accept arguments that can be JSON encoded.
164
164
  So instead of doing this:
165
165
 
166
166
  ``` ruby
167
- Resque.enqueue(Archive, self, branch)
167
+ ResqueAdmin.enqueue(Archive, self, branch)
168
168
  ```
169
169
 
170
170
  do this:
171
171
 
172
172
  ``` ruby
173
- Resque.enqueue(Archive, self.id, branch)
173
+ ResqueAdmin.enqueue(Archive, self.id, branch)
174
174
  ```
175
175
 
176
176
  This is why our above example (and all the examples in `examples/`)
@@ -197,11 +197,11 @@ We plan to provide first class `async` support in a future release.
197
197
  ### Failure
198
198
 
199
199
  If a job raises an exception, it is logged and handed off to the
200
- `Resque::Failure` module. Failures are logged either locally in Redis
200
+ `ResqueAdmin::Failure` module. Failures are logged either locally in Redis
201
201
  or using some different backend. To see exceptions while developing,
202
202
  use VERBOSE env variable, see details below under Logging.
203
203
 
204
- For example, Resque ships with Airbrake support. To configure it, put
204
+ For example, ResqueAdmin ships with Airbrake support. To configure it, put
205
205
  the following into an initialisation file or into your rake job:
206
206
 
207
207
  ``` ruby
@@ -210,8 +210,8 @@ require 'resque_admin/failure/multiple'
210
210
  require 'resque_admin/failure/redis'
211
211
  require 'resque_admin/failure/airbrake'
212
212
 
213
- Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Airbrake]
214
- Resque::Failure.backend = Resque::Failure::Multiple
213
+ ResqueAdmin::Failure::Multiple.classes = [ResqueAdmin::Failure::Redis, ResqueAdmin::Failure::Airbrake]
214
+ ResqueAdmin::Failure.backend = ResqueAdmin::Failure::Multiple
215
215
  ```
216
216
 
217
217
  Keep this in mind when writing your jobs: you may want to throw
@@ -221,7 +221,7 @@ exceptions you would not normally throw in order to assist debugging.
221
221
  Workers
222
222
  -------
223
223
 
224
- Resque workers are rake tasks that run forever. They basically do this:
224
+ ResqueAdmin workers are rake tasks that run forever. They basically do this:
225
225
 
226
226
  ``` ruby
227
227
  start
@@ -239,11 +239,11 @@ Starting a worker is simple. Here's our example from earlier:
239
239
 
240
240
  $ QUEUE=file_serve rake resque:work
241
241
 
242
- By default Resque won't know about your application's
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
244
244
  needs to load your application into memory.
245
245
 
246
- If we've installed Resque as a Rails plugin, we might run this command
246
+ If we've installed ResqueAdmin as a Rails plugin, we might run this command
247
247
  from our RAILS_ROOT:
248
248
 
249
249
  $ QUEUE=file_serve rake environment resque:work
@@ -265,7 +265,7 @@ end
265
265
  ```
266
266
 
267
267
  We don't want the `git_timeout` as high as 10 minutes in our web app,
268
- but in the Resque workers it's fine.
268
+ but in the ResqueAdmin workers it's fine.
269
269
 
270
270
 
271
271
  ### Logging
@@ -277,11 +277,11 @@ variable.
277
277
 
278
278
  $ VVERBOSE=1 QUEUE=file_serve rake environment resque:work
279
279
 
280
- If you want Resque to log to a file, in Rails do:
280
+ If you want ResqueAdmin to log to a file, in Rails do:
281
281
 
282
282
  ```ruby
283
283
  # config/initializers/resque.rb
284
- Resque.logger = Logger.new(Rails.root.join('log', "#{Rails.env}_resque.log"))
284
+ ResqueAdmin.logger = Logger.new(Rails.root.join('log', "#{Rails.env}_resque.log"))
285
285
  ```
286
286
 
287
287
  ### Process IDs (PIDs)
@@ -310,7 +310,7 @@ The default is 5 seconds, but for a semi-active app you may want to use a smalle
310
310
 
311
311
  ### Priorities and Queue Lists
312
312
 
313
- Resque doesn't support numeric priorities but instead uses the order
313
+ ResqueAdmin doesn't support numeric priorities but instead uses the order
314
314
  of queues you give it. We call this list of queues the "queue list."
315
315
 
316
316
  Let's say we add a `warm_cache` queue in addition to our `file_serve`
@@ -364,25 +364,25 @@ so using the `resque:workers` rake task:
364
364
 
365
365
  $ COUNT=5 QUEUE=* rake resque:workers
366
366
 
367
- This will spawn five Resque workers, each in its own process. Hitting
367
+ This will spawn five ResqueAdmin workers, each in its own process. Hitting
368
368
  ctrl-c should be sufficient to stop them all.
369
369
 
370
370
 
371
371
  ### Forking
372
372
 
373
- On certain platforms, when a Resque worker reserves a job it
373
+ On certain platforms, when a ResqueAdmin worker reserves a job it
374
374
  immediately forks a child process. The child processes the job then
375
375
  exits. When the child has exited successfully, the worker reserves
376
376
  another job and repeats the process.
377
377
 
378
378
  Why?
379
379
 
380
- Because Resque assumes chaos.
380
+ Because ResqueAdmin assumes chaos.
381
381
 
382
- Resque assumes your background workers will lock up, run too long, or
382
+ ResqueAdmin assumes your background workers will lock up, run too long, or
383
383
  have unwanted memory growth.
384
384
 
385
- If Resque workers processed jobs themselves, it'd be hard to whip them
385
+ If ResqueAdmin workers processed jobs themselves, it'd be hard to whip them
386
386
  into shape. Let's say one is using too much memory: you send it a
387
387
  signal that says "shutdown after you finish processing the current
388
388
  job," and it does so. It then starts up again - loading your entire
@@ -392,11 +392,11 @@ delay in queue processing.
392
392
  Plus, what if it's using too much memory and has stopped responding to
393
393
  signals?
394
394
 
395
- Thanks to Resque's parent / child architecture, jobs that use too much memory
395
+ Thanks to ResqueAdmin's parent / child architecture, jobs that use too much memory
396
396
  release that memory upon completion. No unwanted growth.
397
397
 
398
398
  And what if a job is running too long? You'd need to `kill -9` it then
399
- start the worker again. With Resque's parent / child architecture you
399
+ start the worker again. With ResqueAdmin's parent / child architecture you
400
400
  can tell the parent to forcefully kill the child then immediately
401
401
  start processing more jobs. No startup delay or wasted cycles.
402
402
 
@@ -433,7 +433,7 @@ waiting for work on:
433
433
 
434
434
  ### Signals
435
435
 
436
- Resque workers respond to a few different signals:
436
+ ResqueAdmin workers respond to a few different signals:
437
437
 
438
438
  * `QUIT` - Wait for child to finish processing then exit
439
439
  * `TERM` / `INT` - Immediately kill child then exit
@@ -441,11 +441,11 @@ Resque workers respond to a few different signals:
441
441
  * `USR2` - Don't start to process any new jobs
442
442
  * `CONT` - Start to process new jobs again after a USR2
443
443
 
444
- If you want to gracefully shutdown a Resque worker, use `QUIT`.
444
+ If you want to gracefully shutdown a ResqueAdmin worker, use `QUIT`.
445
445
 
446
446
  If you want to kill a stale or stuck child, use `USR1`. Processing
447
447
  will continue as normal unless the child was not found. In that case
448
- Resque assumes the parent process is in a bad state and shuts down.
448
+ ResqueAdmin assumes the parent process is in a bad state and shuts down.
449
449
 
450
450
  If you want to kill a stale or stuck child and shutdown, use `TERM`
451
451
 
@@ -457,11 +457,11 @@ then `CONT` to start it again.
457
457
 
458
458
  When shutting down processes, Heroku sends every process a TERM signal at the
459
459
  same time. By default this causes an immediate shutdown of any running job
460
- leading to frequent `Resque::TermException` errors. For short running jobs, a simple
460
+ leading to frequent `ResqueAdmin::TermException` errors. For short running jobs, a simple
461
461
  solution is to give a small amount of time for the job to finish
462
462
  before killing it.
463
463
 
464
- Resque doesn't handle this out of the box (for both cedar-14 and heroku-16), you need to
464
+ ResqueAdmin doesn't handle this out of the box (for both cedar-14 and heroku-16), you need to
465
465
  install the [`resque-heroku-signals`](https://github.com/iloveitaly/resque-heroku-signals)
466
466
  addon which adds the required signal handling to make the behavior described above work.
467
467
  Related issue: https://github.com/resque/resque/issues/1559
@@ -471,9 +471,9 @@ To accomplish this set the following environment variables:
471
471
  * `RESQUE_PRE_SHUTDOWN_TIMEOUT` - The time between the parent receiving a shutdown signal (TERM by default) and it sending that signal on to the child process. Designed to give the child process
472
472
  time to complete before being forced to die.
473
473
 
474
- * `TERM_CHILD` - Must be set for `RESQUE_PRE_SHUTDOWN_TIMEOUT` to be used. After the timeout, if the child is still running it will raise a `Resque::TermException` and exit.
474
+ * `TERM_CHILD` - Must be set for `RESQUE_PRE_SHUTDOWN_TIMEOUT` to be used. After the timeout, if the child is still running it will raise a `ResqueAdmin::TermException` and exit.
475
475
 
476
- * `RESQUE_TERM_TIMEOUT` - By default you have a few seconds to handle `Resque::TermException` in your job. `RESQUE_TERM_TIMEOUT` and `RESQUE_PRE_SHUTDOWN_TIMEOUT` must be lower than the [heroku dyno timeout](https://devcenter.heroku.com/articles/limits#exit-timeout).
476
+ * `RESQUE_TERM_TIMEOUT` - By default you have a few seconds to handle `ResqueAdmin::TermException` in your job. `RESQUE_TERM_TIMEOUT` and `RESQUE_PRE_SHUTDOWN_TIMEOUT` must be lower than the [heroku dyno timeout](https://devcenter.heroku.com/articles/limits#exit-timeout).
477
477
 
478
478
  ### Mysql::Error: MySQL server has gone away
479
479
 
@@ -529,14 +529,14 @@ end
529
529
  The Front End
530
530
  -------------
531
531
 
532
- Resque comes with a Sinatra-based front end for seeing what's up with
532
+ ResqueAdmin comes with a Sinatra-based front end for seeing what's up with
533
533
  your queue.
534
534
 
535
535
  ![The Front End](https://camo.githubusercontent.com/64d150a243987ffbc33f588bd6d7722a0bb8d69a/687474703a2f2f7475746f7269616c732e6a756d7073746172746c61622e636f6d2f696d616765732f7265737175655f6f766572766965772e706e67)
536
536
 
537
537
  ### Standalone
538
538
 
539
- If you've installed Resque as a gem running the front end standalone is easy:
539
+ If you've installed ResqueAdmin as a gem running the front end standalone is easy:
540
540
 
541
541
  $ resque-web
542
542
 
@@ -544,7 +544,7 @@ It's a thin layer around `rackup` so it's configurable as well:
544
544
 
545
545
  $ resque-web -p 8282
546
546
 
547
- If you have a Resque config file you want evaluated just pass it to
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-web -p 8282 rails_root/config/initializers/resque.rb
@@ -559,7 +559,7 @@ or set the Redis connection string if you need to do something like select a dif
559
559
 
560
560
  ### Passenger
561
561
 
562
- Using Passenger? Resque ships with a `config.ru` you can use. See
562
+ Using Passenger? ResqueAdmin ships with a `config.ru` you can use. See
563
563
  Phusion's guide:
564
564
 
565
565
  Apache: <https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/>
@@ -567,7 +567,7 @@ Nginx: <https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/>
567
567
 
568
568
  ### Rack::URLMap
569
569
 
570
- If you want to load Resque on a subpath, possibly alongside other
570
+ If you want to load ResqueAdmin on a subpath, possibly alongside other
571
571
  apps, it's easy to do with Rack's `URLMap`:
572
572
 
573
573
  ``` ruby
@@ -575,7 +575,7 @@ require 'resque_admin/server'
575
575
 
576
576
  run Rack::URLMap.new \
577
577
  "/" => Your::App.new,
578
- "/resque" => Resque::Server.new
578
+ "/resque" => ResqueAdmin::Server.new
579
579
  ```
580
580
 
581
581
  Check `examples/demo/config.ru` for a functional example (including
@@ -583,28 +583,28 @@ HTTP basic auth).
583
583
 
584
584
  ### Rails 3
585
585
 
586
- You can also mount Resque 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`:
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 Resque::Server.new, :at => "/resque"
589
+ mount ResqueAdmin::Server.new, :at => "/resque"
590
590
  ```
591
591
 
592
592
 
593
- Resque vs DelayedJob
593
+ ResqueAdmin vs DelayedJob
594
594
  --------------------
595
595
 
596
- How does Resque compare to DelayedJob, and why would you choose one
596
+ How does ResqueAdmin compare to DelayedJob, and why would you choose one
597
597
  over the other?
598
598
 
599
- * Resque supports multiple queues
599
+ * ResqueAdmin supports multiple queues
600
600
  * DelayedJob supports finer grained priorities
601
- * Resque workers are resilient to memory leaks / bloat
601
+ * ResqueAdmin workers are resilient to memory leaks / bloat
602
602
  * DelayedJob workers are extremely simple and easy to modify
603
- * Resque requires Redis
603
+ * ResqueAdmin requires Redis
604
604
  * DelayedJob requires ActiveRecord
605
- * Resque can only place JSONable Ruby objects on a queue as arguments
605
+ * ResqueAdmin can only place JSONable Ruby objects on a queue as arguments
606
606
  * DelayedJob can place _any_ Ruby object on its queue as arguments
607
- * Resque includes a Sinatra app for monitoring what's going on
607
+ * ResqueAdmin includes a Sinatra app for monitoring what's going on
608
608
  * DelayedJob can be queried from within your Rails app if you want to
609
609
  add an interface
610
610
 
@@ -612,7 +612,7 @@ If you're doing Rails development, you already have a database and
612
612
  ActiveRecord. DelayedJob is super easy to setup and works great.
613
613
  GitHub used it for many months to process almost 200 million jobs.
614
614
 
615
- Choose Resque if:
615
+ Choose ResqueAdmin if:
616
616
 
617
617
  * You need multiple queues
618
618
  * You don't care / dislike numeric priorities
@@ -632,17 +632,17 @@ Choose DelayedJob if:
632
632
  * You want to easily throw anything on the queue
633
633
  * You don't want to setup Redis
634
634
 
635
- In no way is Resque a "better" DelayedJob, so make sure you pick the
635
+ In no way is ResqueAdmin a "better" DelayedJob, so make sure you pick the
636
636
  tool that's best for your app.
637
637
 
638
- Resque Dependencies
638
+ ResqueAdmin Dependencies
639
639
  -------------------
640
640
 
641
641
  $ gem install bundler
642
642
  $ bundle install
643
643
 
644
644
 
645
- Installing Resque
645
+ Installing ResqueAdmin
646
646
  -----------------
647
647
 
648
648
  ### In a Rack app, as a gem
@@ -661,7 +661,7 @@ Now start your application:
661
661
 
662
662
  rackup config.ru
663
663
 
664
- That's it! You can now create Resque jobs from within your app.
664
+ That's it! You can now create ResqueAdmin jobs from within your app.
665
665
 
666
666
  To start a worker, create a Rakefile in your app's root (or add this
667
667
  to an existing Rakefile):
@@ -701,7 +701,7 @@ Now start your application:
701
701
 
702
702
  $ ./script/server
703
703
 
704
- That's it! You can now create Resque jobs from within your app.
704
+ That's it! You can now create ResqueAdmin jobs from within your app.
705
705
 
706
706
  To start a worker, add this to your Rakefile in `RAILS_ROOT`:
707
707
 
@@ -721,7 +721,7 @@ Don't forget you can define a `resque:setup` hook in
721
721
 
722
722
  $ ./script/plugin install git://github.com/resque/resque
723
723
 
724
- That's it! Resque will automatically be available when your Rails app
724
+ That's it! ResqueAdmin will automatically be available when your Rails app
725
725
  loads.
726
726
 
727
727
  To start a worker:
@@ -749,7 +749,7 @@ Now start your application:
749
749
 
750
750
  $ rails server
751
751
 
752
- That's it! You can now create Resque jobs from within your app.
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
755
  `lib/tasks/resque.rake`):
@@ -769,16 +769,16 @@ Don't forget you can define a `resque:setup` hook in
769
769
  Configuration
770
770
  -------------
771
771
 
772
- You may want to change the Redis host and port Resque connects to, or
772
+ You may want to change the Redis host and port ResqueAdmin connects to, or
773
773
  set various other options at startup.
774
774
 
775
- Resque has a `redis` setter which can be given a string or a Redis
776
- object. This means if you're already using Redis in your app, Resque
775
+ ResqueAdmin has a `redis` setter which can be given a string or a Redis
776
+ object. This means if you're already using Redis in your app, ResqueAdmin
777
777
  can re-use the existing connection.
778
778
 
779
- String: `Resque.redis = 'localhost:6379'`
779
+ String: `ResqueAdmin.redis = 'localhost:6379'`
780
780
 
781
- Redis: `Resque.redis = $redis`
781
+ Redis: `ResqueAdmin.redis = $redis`
782
782
 
783
783
  For our rails app we have a `config/initializers/resque.rb` file where
784
784
  we load `config/resque.yml` by hand and set the Redis information
@@ -799,7 +799,7 @@ rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
799
799
  rails_env = ENV['RAILS_ENV'] || 'development'
800
800
 
801
801
  resque_config = YAML.load_file(rails_root + '/config/resque.yml')
802
- Resque.redis = resque_config[rails_env]
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
@@ -813,7 +813,7 @@ Also, you could disable jobs queueing by setting 'inline' attribute.
813
813
  For example, if you want to run all jobs in the same process for cucumber, try:
814
814
 
815
815
  ``` ruby
816
- Resque.inline = ENV['RAILS_ENV'] == "cucumber"
816
+ ResqueAdmin.inline = ENV['RAILS_ENV'] == "cucumber"
817
817
  ```
818
818
 
819
819
 
@@ -823,26 +823,26 @@ Plugins and Hooks
823
823
  For a list of available plugins see
824
824
  <http://wiki.github.com/resque/resque/plugins>.
825
825
 
826
- If you'd like to write your own plugin, or want to customize Resque
827
- using hooks (such as `Resque.after_fork`), see
826
+ If you'd like to write your own plugin, or want to customize ResqueAdmin
827
+ using hooks (such as `ResqueAdmin.after_fork`), see
828
828
  [docs/HOOKS.md](http://github.com/resque/resque/blob/master/docs/HOOKS.md).
829
829
 
830
830
 
831
831
  Namespaces
832
832
  ----------
833
833
 
834
- If you're running multiple, separate instances of Resque you may want
834
+ If you're running multiple, separate instances of ResqueAdmin you may want
835
835
  to namespace the keyspaces so they do not overlap. This is not unlike
836
836
  the approach taken by many memcached clients.
837
837
 
838
838
  This feature is provided by the [redis-namespace][rs] library, which
839
- Resque uses by default to separate the keys it manages from other keys
839
+ ResqueAdmin uses by default to separate the keys it manages from other keys
840
840
  in your Redis server.
841
841
 
842
- Simply use the `Resque.redis.namespace` accessor:
842
+ Simply use the `ResqueAdmin.redis.namespace` accessor:
843
843
 
844
844
  ``` ruby
845
- Resque.redis.namespace = "resque:GitHub"
845
+ ResqueAdmin.redis.namespace = "resque:GitHub"
846
846
  ```
847
847
 
848
848
  We recommend sticking this in your initializer somewhere after Redis
@@ -852,7 +852,7 @@ is configured.
852
852
  Demo
853
853
  ----
854
854
 
855
- Resque ships with a demo Sinatra app for creating jobs that are later
855
+ ResqueAdmin ships with a demo Sinatra app for creating jobs that are later
856
856
  processed in the background.
857
857
 
858
858
  Try it out by looking at the README, found at `examples/demo/README.markdown`.
@@ -863,7 +863,7 @@ Monitoring
863
863
 
864
864
  ### god
865
865
 
866
- If you're using god to monitor Resque, we have provided example
866
+ If you're using god to monitor ResqueAdmin, we have provided example
867
867
  configs in `examples/god/`. One is for starting / stopping workers,
868
868
  the other is for killing workers that have been running too long.
869
869
 
@@ -883,7 +883,7 @@ Please add them to the [FAQ](https://github.com/resque/resque/wiki/FAQ) or open
883
883
  Development
884
884
  -----------
885
885
 
886
- Want to hack on Resque?
886
+ Want to hack on ResqueAdmin?
887
887
 
888
888
  First clone the repo and run the tests:
889
889
 
@@ -917,7 +917,7 @@ Read [CONTRIBUTING.md](CONTRIBUTING.md) first.
917
917
 
918
918
  Once you've made your great commits:
919
919
 
920
- 1. [Fork][1] Resque
920
+ 1. [Fork][1] ResqueAdmin
921
921
  2. Create a topic branch - `git checkout -b my_branch`
922
922
  3. Push to your branch - `git push origin my_branch`
923
923
  4. Create a [Pull Request](http://help.github.com/pull-requests/) from your branch
data/bin/resque CHANGED
@@ -17,11 +17,11 @@ parser = OptionParser.new do |opts|
17
17
  opts.separator "Options:"
18
18
 
19
19
  opts.on("-r", "--redis [HOST:PORT]", "Redis connection string") do |host|
20
- Resque.redis = host
20
+ ResqueAdmin.redis = host
21
21
  end
22
22
 
23
23
  opts.on("-N", "--namespace [NAMESPACE]", "Redis namespace") do |namespace|
24
- Resque.redis.namespace = namespace
24
+ ResqueAdmin.redis.namespace = namespace
25
25
  end
26
26
 
27
27
  opts.on("-h", "--help", "Show this message") do
@@ -53,13 +53,13 @@ end
53
53
  def remove(worker)
54
54
  abort "** resque remove WORKER_ID" if worker.nil?
55
55
 
56
- Resque.remove_worker(worker)
56
+ ResqueAdmin.remove_worker(worker)
57
57
  puts "** removed #{worker}"
58
58
  end
59
59
 
60
60
  def list
61
- if Resque.workers.any?
62
- Resque.workers.each do |worker|
61
+ if ResqueAdmin.workers.any?
62
+ ResqueAdmin.workers.each do |worker|
63
63
  puts "#{worker} (#{worker.state})"
64
64
  end
65
65
  else
data/bin/resque-web CHANGED
@@ -10,7 +10,7 @@ end
10
10
  require 'resque_admin/server'
11
11
 
12
12
 
13
- Vegas::Runner.new(Resque::Server, 'resque-web', {
13
+ Vegas::Runner.new(ResqueAdmin::Server, 'resque-web', {
14
14
  :before_run => lambda {|v|
15
15
  path = (ENV['RESQUECONFIG'] || v.args.first)
16
16
  load path.to_s.strip if path
@@ -18,14 +18,14 @@ Vegas::Runner.new(Resque::Server, 'resque-web', {
18
18
  }) do |runner, opts, app|
19
19
  opts.on('-N NAMESPACE', "--namespace NAMESPACE", "set the Redis namespace") {|namespace|
20
20
  runner.logger.info "Using Redis namespace '#{namespace}'"
21
- Resque.redis.namespace = namespace
21
+ ResqueAdmin.redis.namespace = namespace
22
22
  }
23
23
  opts.on('-r redis-connection', "--redis redis-connection", "set the Redis connection string") {|redis_conf|
24
24
  runner.logger.info "Using Redis connection '#{redis_conf}'"
25
- Resque.redis = redis_conf
25
+ ResqueAdmin.redis = redis_conf
26
26
  }
27
27
  opts.on('-a url-prefix', "--append url-prefix", "set reverse_proxy friendly prefix to links") {|url_prefix|
28
28
  runner.logger.info "Using URL Prefix '#{url_prefix}'"
29
- Resque::Server.url_prefix = url_prefix
29
+ ResqueAdmin::Server.url_prefix = url_prefix
30
30
  }
31
31
  end
@@ -1,5 +1,5 @@
1
- module Resque
2
- # An interface between Resque's persistence and the actual
1
+ module ResqueAdmin
2
+ # An interface between ResqueAdmin's persistence and the actual
3
3
  # implementation.
4
4
  class DataStore
5
5
  extend Forwardable
@@ -53,7 +53,7 @@ module Resque
53
53
  :increment_stat,
54
54
  :stat
55
55
 
56
- # Compatibility with any non-Resque classes that were using Resque.redis as a way to access Redis
56
+ # Compatibility with any non-ResqueAdmin classes that were using ResqueAdmin.redis as a way to access Redis
57
57
  def method_missing(sym,*args,&block)
58
58
  # TODO: deprecation warning?
59
59
  @redis.send(sym,*args,&block)
@@ -82,7 +82,7 @@ module Resque
82
82
  @redis.client.reconnect
83
83
  end
84
84
 
85
- # Returns an array of all known Resque keys in Redis. Redis' KEYS operation
85
+ # Returns an array of all known ResqueAdmin keys in Redis. Redis' KEYS operation
86
86
  # is O(N) for the keyspace, so be careful - this can be slow for big databases.
87
87
  def all_resque_keys
88
88
  @redis.keys("*").map do |key|
@@ -1,4 +1,4 @@
1
- module Resque
1
+ module ResqueAdmin
2
2
  # Raised whenever we need a queue but none is provided.
3
3
  class NoQueueError < RuntimeError; end
4
4
 
@@ -4,19 +4,19 @@ rescue LoadError
4
4
  raise "Can't find 'airbrake' gem. Please add it to your Gemfile or install it."
5
5
  end
6
6
 
7
- module Resque
7
+ module ResqueAdmin
8
8
  module Failure
9
9
  class Airbrake < Base
10
10
  def self.configure(&block)
11
- Resque.logger.warn "This actually sets global Airbrake configuration, " \
11
+ ResqueAdmin.logger.warn "This actually sets global Airbrake configuration, " \
12
12
  "which is probably not what you want."
13
- Resque::Failure.backend = self
13
+ ResqueAdmin::Failure.backend = self
14
14
  ::Airbrake.configure(&block)
15
15
  end
16
16
 
17
17
  def self.count(queue = nil, class_name = nil)
18
18
  # We can't get the total # of errors from Airbrake so we fake it
19
- # by asking Resque how many errors it has seen.
19
+ # by asking ResqueAdmin how many errors it has seen.
20
20
  Stat[:failed]
21
21
  end
22
22