cloudtasker 0.6.0 → 0.7.0
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +0 -2
- data/docs/BATCH_JOBS.md +1 -1
- data/docs/CRON_JOBS.md +16 -14
- data/lib/cloudtasker/version.rb +1 -1
- data/lib/cloudtasker/worker.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92abbab630f4e60c7ae8a6b2e249a5e19d49ad9730788381790463cfda136aea
|
4
|
+
data.tar.gz: c71fcf022efd34d3bba1e11341583b18581d1ae93bcd128b769b2e871e5e76f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a0f52436da444c75530ceb49ac16ce4c76392383011774accb31418447b6d0b2677e1289cb5768be39bb51b2665b46f347e0496c98c9552bf8c1a82a324f6e1
|
7
|
+
data.tar.gz: 5597abc655cef50010bbb38850cc26a5f440404aa8e3d0b645d49fe6bf34f4222d8402e1d61d3e99cf4a0093f7ccd66f561258a3b02595de7a7774cb21cda643
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.6.0](https://github.com/keypup-io/cloudtasker/tree/v0.6.0) (2019-11-25)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.5.0...v0.6.0)
|
6
|
+
|
3
7
|
## [v0.5.0](https://github.com/keypup-io/cloudtasker/tree/v0.5.0) (2019-11-25)
|
4
8
|
|
5
9
|
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.4.0...v0.5.0)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/docs/BATCH_JOBS.md
CHANGED
@@ -9,7 +9,7 @@ The Cloudtasker batch job extension allows to add sub-jobs to regular jobs. This
|
|
9
9
|
You can enable batch jobs by adding the following to your cloudtasker initializer:
|
10
10
|
```ruby
|
11
11
|
# The batch job extension is optional and must be explicitly required
|
12
|
-
require 'cloudtasker/
|
12
|
+
require 'cloudtasker/batch'
|
13
13
|
|
14
14
|
Cloudtasker.configure do |config|
|
15
15
|
# Specify your redis url.
|
data/docs/CRON_JOBS.md
CHANGED
@@ -9,7 +9,7 @@ The Cloudtasker cron job extension allows you to register workers to run at fixe
|
|
9
9
|
You can schedule cron jobs by adding the following to your cloudtasker initializer:
|
10
10
|
```ruby
|
11
11
|
# The cron job extension is optional and must be explicitly required
|
12
|
-
require 'cloudtasker/
|
12
|
+
require 'cloudtasker/cron'
|
13
13
|
|
14
14
|
Cloudtasker.configure do |config|
|
15
15
|
# Specify your redis url.
|
@@ -18,18 +18,20 @@ Cloudtasker.configure do |config|
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Specify all your cron jobs below. This will synchronize your list of cron jobs (cron jobs previously created and not listed below will be removed).
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
unless Rails.env.test?
|
22
|
+
Cloudtasker::Cron::Schedule.load_from_hash!(
|
23
|
+
# Run job every minute
|
24
|
+
some_schedule_name: {
|
25
|
+
worker: 'SomeCronWorker',
|
26
|
+
cron: '* * * * *'
|
27
|
+
},
|
28
|
+
# Run job every hour on the fifteenth minute
|
29
|
+
other_cron_schedule: {
|
30
|
+
worker: 'OtherCronWorker',
|
31
|
+
cron: '15 * * * *'
|
32
|
+
}
|
33
|
+
)
|
34
|
+
end
|
33
35
|
```
|
34
36
|
|
35
37
|
## Using a configuration file
|
@@ -56,7 +58,7 @@ Then register the jobs inside your Cloudtasker initializer this way:
|
|
56
58
|
# ... Cloudtasker configuration ...
|
57
59
|
|
58
60
|
schedule_file = 'config/cloudtasker_cron.yml'
|
59
|
-
if File.exist?(schedule_file)
|
61
|
+
if File.exist?(schedule_file) && !Rails.env.test?
|
60
62
|
Cloudtasker::Cron::Schedule.load_from_hash!(YAML.load_file(schedule_file))
|
61
63
|
end
|
62
64
|
```
|
data/lib/cloudtasker/version.rb
CHANGED
data/lib/cloudtasker/worker.rb
CHANGED
@@ -32,8 +32,9 @@ module Cloudtasker
|
|
32
32
|
# @return [Cloudtasker::Worker, nil] The instantiated worker.
|
33
33
|
#
|
34
34
|
def self.from_hash(hash)
|
35
|
-
# Symbolize
|
35
|
+
# Symbolize metadata keys and stringify job arguments
|
36
36
|
payload = JSON.parse(hash.to_json, symbolize_names: true)
|
37
|
+
payload[:job_args] = JSON.parse(hash[:job_args].to_json)
|
37
38
|
|
38
39
|
# Extract worker parameters
|
39
40
|
klass_name = payload&.dig(:worker)
|