resque-scheduler 2.5.5 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of resque-scheduler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +12 -6
- data/.rubocop.yml +18 -113
- data/.rubocop_todo.yml +29 -0
- data/.simplecov +3 -1
- data/.travis.yml +12 -4
- data/.vagrant-provision-as-vagrant.sh +15 -0
- data/.vagrant-provision.sh +23 -0
- data/.vagrant-skel/bash_profile +7 -0
- data/.vagrant-skel/bashrc +7 -0
- data/AUTHORS.md +5 -0
- data/Gemfile +1 -2
- data/HISTORY.md +18 -0
- data/README.md +39 -11
- data/ROADMAP.md +0 -6
- data/Rakefile +11 -19
- data/Vagrantfile +14 -0
- data/bin/resque-scheduler +2 -2
- data/examples/Rakefile +1 -1
- data/examples/config/initializers/resque-web.rb +2 -2
- data/examples/dynamic-scheduling/app/jobs/fix_schedules_job.rb +2 -4
- data/examples/dynamic-scheduling/app/jobs/send_email_job.rb +1 -1
- data/examples/dynamic-scheduling/app/models/user.rb +2 -2
- data/examples/dynamic-scheduling/lib/tasks/resque.rake +2 -2
- data/lib/resque-scheduler.rb +3 -1
- data/lib/resque/scheduler.rb +112 -168
- data/lib/resque/scheduler/cli.rb +144 -0
- data/lib/resque/scheduler/configuration.rb +73 -0
- data/lib/resque/scheduler/delaying_extensions.rb +278 -0
- data/lib/resque/scheduler/env.rb +61 -0
- data/lib/resque/scheduler/extension.rb +13 -0
- data/lib/resque/scheduler/lock.rb +2 -1
- data/lib/resque/scheduler/lock/base.rb +6 -2
- data/lib/resque/scheduler/lock/basic.rb +4 -5
- data/lib/resque/scheduler/lock/resilient.rb +30 -37
- data/lib/resque/scheduler/locking.rb +94 -0
- data/lib/resque/scheduler/logger_builder.rb +72 -0
- data/lib/resque/scheduler/plugin.rb +31 -0
- data/lib/resque/scheduler/scheduling_extensions.rb +150 -0
- data/lib/resque/scheduler/server.rb +246 -0
- data/lib/{resque_scheduler → resque/scheduler}/server/views/delayed.erb +2 -1
- data/lib/{resque_scheduler → resque/scheduler}/server/views/delayed_schedules.erb +0 -0
- data/lib/{resque_scheduler → resque/scheduler}/server/views/delayed_timestamp.erb +0 -0
- data/lib/{resque_scheduler → resque/scheduler}/server/views/requeue-params.erb +0 -0
- data/lib/{resque_scheduler → resque/scheduler}/server/views/scheduler.erb +16 -1
- data/lib/{resque_scheduler → resque/scheduler}/server/views/search.erb +2 -1
- data/lib/{resque_scheduler → resque/scheduler}/server/views/search_form.erb +0 -0
- data/lib/resque/scheduler/signal_handling.rb +40 -0
- data/lib/{resque_scheduler → resque/scheduler}/tasks.rb +3 -5
- data/lib/resque/scheduler/util.rb +41 -0
- data/lib/resque/scheduler/version.rb +7 -0
- data/resque-scheduler.gemspec +21 -19
- data/script/migrate_to_timestamps_set.rb +5 -3
- data/tasks/resque_scheduler.rake +1 -1
- data/test/cli_test.rb +26 -69
- data/test/delayed_queue_test.rb +262 -169
- data/test/env_test.rb +41 -0
- data/test/resque-web_test.rb +169 -48
- data/test/scheduler_args_test.rb +73 -41
- data/test/scheduler_hooks_test.rb +9 -8
- data/test/scheduler_locking_test.rb +55 -36
- data/test/scheduler_setup_test.rb +52 -15
- data/test/scheduler_task_test.rb +15 -10
- data/test/scheduler_test.rb +215 -114
- data/test/support/redis_instance.rb +32 -33
- data/test/test_helper.rb +33 -36
- data/test/util_test.rb +11 -0
- metadata +113 -57
- data/lib/resque/scheduler_locking.rb +0 -91
- data/lib/resque_scheduler.rb +0 -386
- data/lib/resque_scheduler/cli.rb +0 -160
- data/lib/resque_scheduler/logger_builder.rb +0 -72
- data/lib/resque_scheduler/plugin.rb +0 -28
- data/lib/resque_scheduler/server.rb +0 -183
- data/lib/resque_scheduler/util.rb +0 -34
- data/lib/resque_scheduler/version.rb +0 -5
- data/test/redis-test.conf +0 -108
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 315b0ea47908358f5cd357a315f9bcf958402ccb
|
4
|
+
data.tar.gz: 8bcbe775f3fc7f68d47a7d0cf79f75b2f27ac0b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40b428d2bfdbd36eb3ba623812a3d06db24a674531db24069c9dd19e24af478c49eafe615238d333ae9181ecf2ca3e76a0a8f9b20f2181431a4ff147733d80f4
|
7
|
+
data.tar.gz: ce2e9aee9671c7a4ffbf016934d169ee36d575543142fccea9318244c8a84c20108878ed5010ace31d67aa706bc6f4793aabc5952bf521aeecf0f33728ac18f4
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,129 +1,34 @@
|
|
1
|
-
|
2
|
-
# The point is for the user to remove these configuration records
|
3
|
-
# one by one as the offences are removed from the code base.
|
1
|
+
inherit_from: .rubocop_todo.yml
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
AssignmentInCondition:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
BracesAroundHashParameters:
|
15
|
-
Enabled: false
|
3
|
+
AllCops:
|
4
|
+
Include:
|
5
|
+
- Gemfile
|
6
|
+
- '**/Rakefile'
|
7
|
+
- resque-scheduler.gemspec
|
8
|
+
- bin/resque-scheduler
|
16
9
|
|
10
|
+
# Offence count: 1
|
17
11
|
CaseEquality:
|
18
12
|
Enabled: false
|
19
13
|
|
14
|
+
# Offence count: 2
|
15
|
+
# Configuration parameters: CountComments.
|
20
16
|
ClassLength:
|
21
|
-
Max:
|
22
|
-
|
23
|
-
ClassVars:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
CollectionMethods:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
ColonMethodCall:
|
30
|
-
Enabled: false
|
31
|
-
|
32
|
-
CommentAnnotation:
|
33
|
-
Enabled: false
|
17
|
+
Max: 130
|
34
18
|
|
19
|
+
# Offence count: 3
|
35
20
|
CyclomaticComplexity:
|
36
|
-
Max:
|
21
|
+
Max: 21
|
37
22
|
|
23
|
+
# Offence count: 29
|
38
24
|
Documentation:
|
39
25
|
Enabled: false
|
40
26
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
FavorUnlessOverNegatedIf:
|
45
|
-
Enabled: false
|
46
|
-
|
47
|
-
FavorUntilOverNegatedWhile:
|
48
|
-
Enabled: false
|
49
|
-
|
50
|
-
HandleExceptions:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
HashSyntax:
|
54
|
-
Enabled: false
|
55
|
-
|
56
|
-
IfUnlessModifier:
|
57
|
-
Enabled: false
|
58
|
-
|
59
|
-
IndentationWidth:
|
60
|
-
Enabled: false
|
61
|
-
|
62
|
-
LineLength:
|
63
|
-
Max: 152
|
64
|
-
|
65
|
-
Loop:
|
66
|
-
Enabled: false
|
67
|
-
|
68
|
-
MethodCallParentheses:
|
69
|
-
Enabled: false
|
70
|
-
|
27
|
+
# Offence count: 17
|
28
|
+
# Configuration parameters: CountComments.
|
71
29
|
MethodLength:
|
72
|
-
Max:
|
73
|
-
|
74
|
-
ModuleFunction:
|
75
|
-
Enabled: false
|
76
|
-
|
77
|
-
NumericLiterals:
|
78
|
-
Enabled: false
|
79
|
-
|
80
|
-
ParenthesesAroundCondition:
|
81
|
-
Enabled: false
|
82
|
-
|
83
|
-
PredicateName:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
RedundantBegin:
|
87
|
-
Enabled: false
|
30
|
+
Max: 145
|
88
31
|
|
32
|
+
# Offence count: 1
|
89
33
|
RescueException:
|
90
34
|
Enabled: false
|
91
|
-
|
92
|
-
RescueModifier:
|
93
|
-
Enabled: false
|
94
|
-
|
95
|
-
SingleLineMethods:
|
96
|
-
Enabled: false
|
97
|
-
|
98
|
-
SpaceAfterComma:
|
99
|
-
Enabled: false
|
100
|
-
|
101
|
-
SpaceAroundBlockBraces:
|
102
|
-
Enabled: false
|
103
|
-
|
104
|
-
SpaceAroundEqualsInParameterDefault:
|
105
|
-
Enabled: false
|
106
|
-
|
107
|
-
SpaceAroundOperators:
|
108
|
-
Enabled: false
|
109
|
-
|
110
|
-
SpaceInsideHashLiteralBraces:
|
111
|
-
Enabled: false
|
112
|
-
|
113
|
-
SpecialGlobalVars:
|
114
|
-
Enabled: false
|
115
|
-
|
116
|
-
StringLiterals:
|
117
|
-
Enabled: false
|
118
|
-
|
119
|
-
TrailingBlankLines:
|
120
|
-
Enabled: false
|
121
|
-
|
122
|
-
TrailingWhitespace:
|
123
|
-
Enabled: false
|
124
|
-
|
125
|
-
TrivialAccessors:
|
126
|
-
Enabled: false
|
127
|
-
|
128
|
-
UselessAssignment:
|
129
|
-
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-05-24 08:24:15 -0400 using RuboCop version 0.22.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 12
|
9
|
+
DoubleNegation:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 1
|
13
|
+
EachWithObject:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
# Offense count: 3
|
17
|
+
# Configuration parameters: Exclude.
|
18
|
+
FileName:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
# Offense count: 7
|
22
|
+
# Configuration parameters: MinBodyLength.
|
23
|
+
GuardClause:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
# Offense count: 1
|
27
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
28
|
+
Next:
|
29
|
+
Enabled: false
|
data/.simplecov
CHANGED
data/.travis.yml
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.9.3
|
4
|
-
- 2.
|
3
|
+
- '1.9.3'
|
4
|
+
- '2.1'
|
5
|
+
- 'jruby-19mode'
|
6
|
+
- 'rbx'
|
5
7
|
env:
|
6
8
|
global:
|
7
9
|
- RESQUE_SCHEDULER_DISABLE_TEST_REDIS_SERVER=1
|
10
|
+
- JRUBY_OPTS='-Xcext.enabled=true'
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
- rvm: 'jruby-19mode'
|
14
|
+
- rvm: 'rbx'
|
8
15
|
services:
|
9
16
|
- redis-server
|
10
17
|
notifications:
|
11
18
|
email:
|
12
|
-
recipients:
|
19
|
+
recipients:
|
20
|
+
- daniel.buch+resque-scheduler@gmail.com
|
13
21
|
deploy:
|
14
22
|
provider: rubygems
|
15
23
|
api_key:
|
@@ -18,4 +26,4 @@ deploy:
|
|
18
26
|
on:
|
19
27
|
tags: true
|
20
28
|
repo: resque/resque-scheduler
|
21
|
-
rvm: 2.
|
29
|
+
rvm: '2.1'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
set -x
|
5
|
+
|
6
|
+
ln -svf /vagrant/.vagrant-skel/bashrc ~/.bashrc
|
7
|
+
ln -svf /vagrant/.vagrant-skel/bash_profile ~/.bash_profile
|
8
|
+
|
9
|
+
source ~/.bashrc
|
10
|
+
|
11
|
+
set +x
|
12
|
+
curl -L https://get.rvm.io | bash -s stable --ruby=2.0.0 --auto-dotfiles
|
13
|
+
|
14
|
+
source ~/.rvm/scripts/rvm
|
15
|
+
gem install --no-ri --no-rdoc bundler foreman
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
export DEBIAN_FRONTEND=noninteractive
|
4
|
+
|
5
|
+
umask 022
|
6
|
+
|
7
|
+
set -e
|
8
|
+
set -x
|
9
|
+
|
10
|
+
apt-get update -yq
|
11
|
+
apt-get install --no-install-suggests -yq python-software-properties
|
12
|
+
add-apt-repository -y ppa:chris-lea/redis-server
|
13
|
+
apt-get update -yq
|
14
|
+
apt-get install --no-install-suggests -yq \
|
15
|
+
build-essential \
|
16
|
+
byobu \
|
17
|
+
curl \
|
18
|
+
git \
|
19
|
+
make \
|
20
|
+
redis-server \
|
21
|
+
screen
|
22
|
+
|
23
|
+
su - vagrant -c /vagrant/.vagrant-provision-as-vagrant.sh
|
data/AUTHORS.md
CHANGED
@@ -3,6 +3,7 @@ Resque Scheduler authors
|
|
3
3
|
|
4
4
|
- Aaron Suggs
|
5
5
|
- Alexander Simonov
|
6
|
+
- Andrea Campolonghi
|
6
7
|
- Ben VandenBos
|
7
8
|
- Bernerd Schaefer
|
8
9
|
- Bogdan Gusiev
|
@@ -29,6 +30,7 @@ Resque Scheduler authors
|
|
29
30
|
- John Crepezzi
|
30
31
|
- John Griffin
|
31
32
|
- Jon Larkowski and Les Hill
|
33
|
+
- Jonathan Conley
|
32
34
|
- Jonathan Hyman
|
33
35
|
- Jonathan Owens
|
34
36
|
- Joshua Szmajda
|
@@ -57,9 +59,12 @@ Resque Scheduler authors
|
|
57
59
|
- Tim Liner
|
58
60
|
- Tony Lewis
|
59
61
|
- Vincent Zhu
|
62
|
+
- Vladislav Shub
|
60
63
|
- V Sreekanth
|
64
|
+
- Warren Sangster
|
61
65
|
- andreas
|
62
66
|
- bbauer
|
67
|
+
- camol
|
63
68
|
- fallwith
|
64
69
|
- gravis
|
65
70
|
- hpoydar
|
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Resque Scheduler History / ChangeLog / Release Notes
|
2
2
|
|
3
|
+
## 3.0.0 (2014-05-27)
|
4
|
+
* The grand re-namespacing of
|
5
|
+
`resque_scheduler/(.*)` => `resque/scheduler/\1`
|
6
|
+
* Cleanup of a ton of rubocop offenses
|
7
|
+
* Vagrant setup
|
8
|
+
* Documentation updates
|
9
|
+
* "Refactoring"
|
10
|
+
* Added support for last execution information through the web
|
11
|
+
* Handling signals while "sleeping" by relying on `Thread#wakeup`
|
12
|
+
* CodeClimate integration
|
13
|
+
* Addition of `Resque.delayed?` and `Resque.next_delayed_schedule`
|
14
|
+
* Testing against same rubies as resque (+ 2.1.1)
|
15
|
+
* Renamed `Resque.set_last_run` to `Resque.last_enqueued_at`
|
16
|
+
* Allow scheduled jobs to be deleted via resque web
|
17
|
+
* Fixed duplicated layout for `search_form` partial template.
|
18
|
+
* Fix issue where Web UI was ONLY showing jobs that only run in the current
|
19
|
+
environment
|
20
|
+
|
3
21
|
## 2.5.5 (2014-02-27)
|
4
22
|
* Only showing link to job with args if job is present
|
5
23
|
* Only showing scheduled jobs that match current env or omit env
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@ resque-scheduler
|
|
4
4
|
[![Dependency Status](https://gemnasium.com/resque/resque-scheduler.png)](https://gemnasium.com/resque/resque-scheduler)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/resque-scheduler.png)](http://badge.fury.io/rb/resque-scheduler)
|
6
6
|
[![Build Status](https://travis-ci.org/resque/resque-scheduler.png?branch=master)](https://travis-ci.org/resque/resque-scheduler)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/resque/resque-scheduler.png)](https://codeclimate.com/github/resque/resque-scheduler)
|
7
8
|
|
8
9
|
### Description
|
9
10
|
|
@@ -52,7 +53,7 @@ gem 'resque-scheduler'
|
|
52
53
|
Adding the resque:scheduler rake task:
|
53
54
|
|
54
55
|
```ruby
|
55
|
-
require '
|
56
|
+
require 'resque/scheduler/tasks'
|
56
57
|
```
|
57
58
|
|
58
59
|
### Rake integration
|
@@ -65,12 +66,12 @@ everything `resque` needs to know.
|
|
65
66
|
```ruby
|
66
67
|
# Resque tasks
|
67
68
|
require 'resque/tasks'
|
68
|
-
require '
|
69
|
+
require 'resque/scheduler/tasks'
|
69
70
|
|
70
71
|
namespace :resque do
|
71
72
|
task :setup do
|
72
73
|
require 'resque'
|
73
|
-
require '
|
74
|
+
require 'resque-scheduler'
|
74
75
|
|
75
76
|
# you probably already have this somewhere
|
76
77
|
Resque.redis = 'localhost:6379'
|
@@ -144,8 +145,8 @@ scheduled job must run (coerced with `Kernel#Float()`) (default `5`)
|
|
144
145
|
* `LOGFORMAT` - Log output format to use (either `'text'` or `'json'`,
|
145
146
|
default `'text'`)
|
146
147
|
* `PIDFILE` - If non-empty, write process PID to file (default empty)
|
147
|
-
* `QUIET`
|
148
|
-
|
148
|
+
* `QUIET` - Silence most output if non-empty (equivalent to a level of
|
149
|
+
`MonoLogger::FATAL`, default `false`)
|
149
150
|
* `VERBOSE` - Maximize log verbosity if non-empty (equivalent to a level
|
150
151
|
of `MonoLogger::DEBUG`, default `false`)
|
151
152
|
|
@@ -447,7 +448,7 @@ redis instance and schedule. The scheduler processes will use redis to
|
|
447
448
|
elect a master process and detect failover when the master dies. Precautions are
|
448
449
|
taken to prevent jobs from potentially being queued twice during failover even
|
449
450
|
when the clocks of the scheduler machines are slightly out of sync (or load affects
|
450
|
-
scheduled job firing time). If you want the gory details, look at Resque::
|
451
|
+
scheduled job firing time). If you want the gory details, look at Resque::Scheduler::Locking.
|
451
452
|
|
452
453
|
If the scheduler process(es) goes down for whatever reason, the delayed items
|
453
454
|
that should have fired during the outage will fire once the scheduler process
|
@@ -494,8 +495,8 @@ Now, you want to add the following:
|
|
494
495
|
|
495
496
|
```ruby
|
496
497
|
# This will make the tabs show up.
|
497
|
-
require '
|
498
|
-
require '
|
498
|
+
require 'resque-scheduler'
|
499
|
+
require 'resque/scheduler/server'
|
499
500
|
```
|
500
501
|
|
501
502
|
That should make the scheduler tabs show up in `resque-web`.
|
@@ -533,8 +534,8 @@ worker is started.
|
|
533
534
|
There are several options to toggle the way scheduler logs its actions. They
|
534
535
|
are toggled by environment variables:
|
535
536
|
|
536
|
-
- `
|
537
|
-
- `VERBOSE` opposite of '
|
537
|
+
- `QUIET` will stop logging anything. Completely silent.
|
538
|
+
- `VERBOSE` opposite of 'QUIET'; will log even debug information
|
538
539
|
- `LOGFILE` specifies the file to write logs to. (default standard output)
|
539
540
|
- `LOGFORMAT` specifies either "text" or "json" output format
|
540
541
|
(default "text")
|
@@ -544,7 +545,7 @@ values:
|
|
544
545
|
|
545
546
|
```ruby
|
546
547
|
Resque::Scheduler.configure do |c|
|
547
|
-
c.
|
548
|
+
c.quiet = false
|
548
549
|
c.verbose = false
|
549
550
|
c.logfile = nil # meaning all messages go to $stdout
|
550
551
|
c.logformat = 'text'
|
@@ -570,6 +571,33 @@ of the code looking very similar to resque, particularly in resque-web
|
|
570
571
|
and the views. I wanted it to be similar enough that someone familiar
|
571
572
|
with resque could easily work on resque-scheduler.
|
572
573
|
|
574
|
+
### Development
|
575
|
+
|
576
|
+
Working on resque-scheduler requires the following:
|
577
|
+
|
578
|
+
* A relatively modern Ruby interpreter (MRI 1.9+ is what's tested)
|
579
|
+
* bundler
|
580
|
+
|
581
|
+
The development setup looks like this, which is roughly the same thing
|
582
|
+
that happens on Travis CI:
|
583
|
+
|
584
|
+
``` bash
|
585
|
+
# Install everything
|
586
|
+
bundle install
|
587
|
+
|
588
|
+
# Make sure tests are green before you change stuff
|
589
|
+
bundle exec rake
|
590
|
+
# Change stuff
|
591
|
+
# Repeat
|
592
|
+
```
|
593
|
+
|
594
|
+
If you have [vagrant](http://www.vagrantup.com) installed, there is a
|
595
|
+
development box available that requires no plugins or external
|
596
|
+
provisioners:
|
597
|
+
|
598
|
+
``` bash
|
599
|
+
vagrant up
|
600
|
+
```
|
573
601
|
|
574
602
|
### Contributing
|
575
603
|
|