rocketjob 3.4.3 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +27 -0
- data/bin/rocketjob +1 -1
- data/lib/rocket_job/active_worker.rb +4 -3
- data/lib/rocket_job/cli.rb +13 -12
- data/lib/rocket_job/config.rb +17 -13
- data/lib/rocket_job/dirmon_entry.rb +88 -91
- data/lib/rocket_job/extensions/mongo/logging.rb +8 -4
- data/lib/rocket_job/extensions/mongoid/factory.rb +8 -6
- data/lib/rocket_job/extensions/rocket_job_adapter.rb +2 -4
- data/lib/rocket_job/heartbeat.rb +7 -8
- data/lib/rocket_job/job_exception.rb +6 -5
- data/lib/rocket_job/jobs/dirmon_job.rb +5 -7
- data/lib/rocket_job/jobs/housekeeping_job.rb +3 -2
- data/lib/rocket_job/jobs/on_demand_job.rb +104 -0
- data/lib/rocket_job/jobs/simple_job.rb +0 -2
- data/lib/rocket_job/jobs/upload_file_job.rb +100 -0
- data/lib/rocket_job/performance.rb +15 -10
- data/lib/rocket_job/plugins/cron.rb +7 -124
- data/lib/rocket_job/plugins/document.rb +8 -10
- data/lib/rocket_job/plugins/job/callbacks.rb +0 -1
- data/lib/rocket_job/plugins/job/logger.rb +0 -1
- data/lib/rocket_job/plugins/job/model.rb +15 -20
- data/lib/rocket_job/plugins/job/persistence.rb +3 -13
- data/lib/rocket_job/plugins/job/state_machine.rb +1 -2
- data/lib/rocket_job/plugins/job/throttle.rb +16 -12
- data/lib/rocket_job/plugins/job/worker.rb +15 -19
- data/lib/rocket_job/plugins/processing_window.rb +2 -2
- data/lib/rocket_job/plugins/restart.rb +3 -4
- data/lib/rocket_job/plugins/retry.rb +2 -3
- data/lib/rocket_job/plugins/singleton.rb +2 -3
- data/lib/rocket_job/plugins/state_machine.rb +19 -23
- data/lib/rocket_job/rocket_job.rb +4 -5
- data/lib/rocket_job/server.rb +35 -41
- data/lib/rocket_job/version.rb +2 -2
- data/lib/rocket_job/worker.rb +22 -21
- data/lib/rocketjob.rb +2 -0
- data/test/config/mongoid.yml +2 -2
- data/test/config_test.rb +0 -2
- data/test/dirmon_entry_test.rb +161 -134
- data/test/dirmon_job_test.rb +80 -78
- data/test/job_test.rb +0 -2
- data/test/jobs/housekeeping_job_test.rb +0 -1
- data/test/jobs/on_demand_job_test.rb +59 -0
- data/test/jobs/upload_file_job_test.rb +99 -0
- data/test/plugins/cron_test.rb +1 -3
- data/test/plugins/job/callbacks_test.rb +8 -13
- data/test/plugins/job/defaults_test.rb +0 -1
- data/test/plugins/job/logger_test.rb +2 -4
- data/test/plugins/job/model_test.rb +1 -2
- data/test/plugins/job/persistence_test.rb +0 -2
- data/test/plugins/job/state_machine_test.rb +0 -2
- data/test/plugins/job/throttle_test.rb +6 -8
- data/test/plugins/job/worker_test.rb +1 -2
- data/test/plugins/processing_window_test.rb +0 -2
- data/test/plugins/restart_test.rb +0 -1
- data/test/plugins/retry_test.rb +1 -2
- data/test/plugins/singleton_test.rb +0 -2
- data/test/plugins/state_machine_event_callbacks_test.rb +1 -2
- data/test/plugins/state_machine_test.rb +0 -2
- data/test/plugins/transaction_test.rb +5 -7
- data/test/test_db.sqlite3 +0 -0
- data/test/test_helper.rb +2 -1
- metadata +42 -36
data/test/plugins/retry_test.rb
CHANGED
@@ -7,7 +7,7 @@ module Plugins
|
|
7
7
|
|
8
8
|
# Fails 5 times before succeeding
|
9
9
|
def perform
|
10
|
-
raise
|
10
|
+
raise 'Oh No' unless rocket_job_failure_count >= 5
|
11
11
|
'DONE'
|
12
12
|
end
|
13
13
|
end
|
@@ -83,7 +83,6 @@ module Plugins
|
|
83
83
|
assert @job.failed?, -> { @job.attributes.ai }
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
87
86
|
end
|
88
87
|
end
|
89
88
|
end
|
@@ -3,7 +3,6 @@ require_relative '../test_helper'
|
|
3
3
|
module Plugins
|
4
4
|
# Unit Test for RocketJob::Job
|
5
5
|
class SingletonTest < Minitest::Test
|
6
|
-
|
7
6
|
class SingletonJob < RocketJob::Job
|
8
7
|
include RocketJob::Plugins::Singleton
|
9
8
|
|
@@ -88,7 +87,6 @@ module Plugins
|
|
88
87
|
job2.save!
|
89
88
|
end
|
90
89
|
end
|
91
|
-
|
92
90
|
end
|
93
91
|
end
|
94
92
|
end
|
@@ -93,11 +93,10 @@ module Plugins
|
|
93
93
|
@job = PositivePathJob.new
|
94
94
|
@job.perform_now
|
95
95
|
assert @job.completed?, @job.attributes.ai
|
96
|
-
expected = %w
|
96
|
+
expected = %w[before_start_block before_start_method before_start2_block before_start_method2 after_start2_block after_start_method after_start_block perform before_complete_block before_complete_method before_complete2_block before_complete_method2 after_complete2_block after_complete_method after_complete_block]
|
97
97
|
assert_equal expected, @job.call_list, 'Sequence of before_perform callbacks is incorrect'
|
98
98
|
end
|
99
99
|
end
|
100
|
-
|
101
100
|
end
|
102
101
|
end
|
103
102
|
end
|
@@ -3,7 +3,6 @@ require_relative '../test_helper'
|
|
3
3
|
module Plugins
|
4
4
|
# Unit Test for RocketJob::Job
|
5
5
|
class StateMachineTest < Minitest::Test
|
6
|
-
|
7
6
|
class Test
|
8
7
|
include RocketJob::Plugins::Document
|
9
8
|
include RocketJob::Plugins::StateMachine
|
@@ -63,7 +62,6 @@ module Plugins
|
|
63
62
|
assert @doc.enabled?
|
64
63
|
end
|
65
64
|
end
|
66
|
-
|
67
65
|
end
|
68
66
|
end
|
69
67
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
require 'active_record'
|
3
3
|
|
4
|
-
ActiveRecord::Base.configurations = YAML
|
4
|
+
ActiveRecord::Base.configurations = YAML.safe_load(ERB.new(IO.read('test/config/database.yml')).result)
|
5
5
|
ActiveRecord::Base.establish_connection(:test)
|
6
6
|
|
7
7
|
ActiveRecord::Schema.define version: 0 do
|
@@ -16,7 +16,6 @@ end
|
|
16
16
|
module Plugins
|
17
17
|
module Job
|
18
18
|
class TransactionTest < Minitest::Test
|
19
|
-
|
20
19
|
class CommitTransactionJob < RocketJob::Job
|
21
20
|
# Wrap perform with a transaction, so that it is rolled back on exception.
|
22
21
|
include RocketJob::Plugins::Transaction
|
@@ -36,7 +35,7 @@ module Plugins
|
|
36
35
|
|
37
36
|
def perform
|
38
37
|
User.create!(login: login)
|
39
|
-
raise
|
38
|
+
raise 'This must fail and rollback the transaction'
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
@@ -53,9 +52,9 @@ module Plugins
|
|
53
52
|
|
54
53
|
describe '#rocket_job_transaction' do
|
55
54
|
it 'is registered' do
|
56
|
-
assert
|
57
|
-
assert
|
58
|
-
refute
|
55
|
+
assert(CommitTransactionJob.send(:get_callbacks, :perform).find { |c| c.filter == :rocket_job_transaction })
|
56
|
+
assert(RollbackTransactionJob.send(:get_callbacks, :perform).find { |c| c.filter == :rocket_job_transaction })
|
57
|
+
refute(RocketJob::Job.send(:get_callbacks, :perform).find { |c| c.filter == :rocket_job_transaction })
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
@@ -79,7 +78,6 @@ module Plugins
|
|
79
78
|
assert_equal 0, User.count
|
80
79
|
end
|
81
80
|
end
|
82
|
-
|
83
81
|
end
|
84
82
|
end
|
85
83
|
end
|
data/test/test_db.sqlite3
CHANGED
Binary file
|
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
ENV['TZ'] = 'America/New_York'
|
2
3
|
|
3
4
|
require 'yaml'
|
4
5
|
require 'minitest/autorun'
|
@@ -13,4 +14,4 @@ RocketJob::Config.load!('test', 'test/config/mongoid.yml')
|
|
13
14
|
Mongoid.logger = SemanticLogger[Mongoid]
|
14
15
|
Mongo::Logger.logger = SemanticLogger[Mongo]
|
15
16
|
|
16
|
-
#RocketJob::Job.collection.database.command(dropDatabase: 1)
|
17
|
+
# RocketJob::Job.collection.database.command(dropDatabase: 1)
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketjob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aasm
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.12'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.12'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: concurrent-ruby
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +66,6 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '4.1'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: aasm
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '4.12'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '4.12'
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- support@rocketjob.io
|
@@ -92,7 +92,9 @@ files:
|
|
92
92
|
- lib/rocket_job/jobs/active_job.rb
|
93
93
|
- lib/rocket_job/jobs/dirmon_job.rb
|
94
94
|
- lib/rocket_job/jobs/housekeeping_job.rb
|
95
|
+
- lib/rocket_job/jobs/on_demand_job.rb
|
95
96
|
- lib/rocket_job/jobs/simple_job.rb
|
97
|
+
- lib/rocket_job/jobs/upload_file_job.rb
|
96
98
|
- lib/rocket_job/performance.rb
|
97
99
|
- lib/rocket_job/plugins/cron.rb
|
98
100
|
- lib/rocket_job/plugins/document.rb
|
@@ -125,6 +127,8 @@ files:
|
|
125
127
|
- test/files/text.txt
|
126
128
|
- test/job_test.rb
|
127
129
|
- test/jobs/housekeeping_job_test.rb
|
130
|
+
- test/jobs/on_demand_job_test.rb
|
131
|
+
- test/jobs/upload_file_job_test.rb
|
128
132
|
- test/plugins/cron_test.rb
|
129
133
|
- test/plugins/job/callbacks_test.rb
|
130
134
|
- test/plugins/job/defaults_test.rb
|
@@ -155,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
159
|
requirements:
|
156
160
|
- - ">="
|
157
161
|
- !ruby/object:Gem::Version
|
158
|
-
version: '2.
|
162
|
+
version: '2.3'
|
159
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
164
|
requirements:
|
161
165
|
- - ">="
|
@@ -163,34 +167,36 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
167
|
version: '0'
|
164
168
|
requirements: []
|
165
169
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.6
|
170
|
+
rubygems_version: 2.7.6
|
167
171
|
signing_key:
|
168
172
|
specification_version: 4
|
169
173
|
summary: Ruby's missing batch system.
|
170
174
|
test_files:
|
171
|
-
- test/config/database.yml
|
172
|
-
- test/config/mongoid.yml
|
173
175
|
- test/config_test.rb
|
174
|
-
- test/
|
175
|
-
- test/
|
176
|
-
- test/
|
177
|
-
- test/
|
178
|
-
- test/
|
176
|
+
- test/config/mongoid.yml
|
177
|
+
- test/config/database.yml
|
178
|
+
- test/test_db.sqlite3
|
179
|
+
- test/plugins/state_machine_test.rb
|
180
|
+
- test/plugins/restart_test.rb
|
181
|
+
- test/plugins/state_machine_event_callbacks_test.rb
|
182
|
+
- test/plugins/transaction_test.rb
|
179
183
|
- test/plugins/cron_test.rb
|
180
|
-
- test/plugins/job/callbacks_test.rb
|
181
|
-
- test/plugins/job/defaults_test.rb
|
182
184
|
- test/plugins/job/logger_test.rb
|
183
|
-
- test/plugins/job/model_test.rb
|
184
|
-
- test/plugins/job/persistence_test.rb
|
185
185
|
- test/plugins/job/state_machine_test.rb
|
186
|
-
- test/plugins/job/throttle_test.rb
|
187
186
|
- test/plugins/job/worker_test.rb
|
187
|
+
- test/plugins/job/throttle_test.rb
|
188
|
+
- test/plugins/job/defaults_test.rb
|
189
|
+
- test/plugins/job/persistence_test.rb
|
190
|
+
- test/plugins/job/callbacks_test.rb
|
191
|
+
- test/plugins/job/model_test.rb
|
192
|
+
- test/plugins/singleton_test.rb
|
188
193
|
- test/plugins/processing_window_test.rb
|
189
|
-
- test/plugins/restart_test.rb
|
190
194
|
- test/plugins/retry_test.rb
|
191
|
-
- test/
|
192
|
-
- test/
|
193
|
-
- test/
|
194
|
-
- test/
|
195
|
-
- test/test_db.sqlite3
|
195
|
+
- test/job_test.rb
|
196
|
+
- test/dirmon_job_test.rb
|
197
|
+
- test/dirmon_entry_test.rb
|
198
|
+
- test/files/text.txt
|
196
199
|
- test/test_helper.rb
|
200
|
+
- test/jobs/housekeeping_job_test.rb
|
201
|
+
- test/jobs/on_demand_job_test.rb
|
202
|
+
- test/jobs/upload_file_job_test.rb
|