distributed_job 3.0.0 → 3.0.1
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +4 -7
- data/distributed_job.gemspec +1 -1
- data/lib/distributed_job/job.rb +9 -11
- data/lib/distributed_job/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bda4273dc59888e0269d7d14d69180e9a67bdb793e9c7f9f24bcc9f88a1b8fd
|
4
|
+
data.tar.gz: 8a3108b573a9e46e78d57979dfab70906459947651c1b2cda1391f66aa8e0f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e553072546911dffba6bd7f40e9f4eb6c7fe4f0a0338437ffc21cdc8e442c91cb0b51fa2afbcf070e257d2caaade5954867710e14e7919fde335aaebb8ec3867
|
7
|
+
data.tar.gz: 86ae97dd953642cc225f6b4280776c84dfc080cc4af90d8519352f6d4faf0a26ab736df372cac734a1884382a0173e9a44784371858b5e5f137bf68b2b6193d0
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -86,9 +86,7 @@ class SomeBackgroundJob
|
|
86
86
|
|
87
87
|
# ...
|
88
88
|
|
89
|
-
distributed_job.done(part)
|
90
|
-
|
91
|
-
if distributed_job.finished?
|
89
|
+
if distributed_job.done(part)
|
92
90
|
# perform e.g. cleanup or the some other job
|
93
91
|
end
|
94
92
|
rescue
|
@@ -101,10 +99,9 @@ end
|
|
101
99
|
|
102
100
|
The `#stop` and `#stopped?` methods can be used to globally stop a distributed
|
103
101
|
job in case of errors. Contrary, the `#done` method tells the distributed job
|
104
|
-
that the specified part has successfully finished.
|
105
|
-
|
106
|
-
|
107
|
-
job.
|
102
|
+
that the specified part has successfully finished. The `#done` method returns
|
103
|
+
true when all parts of the distributed job have finished, which is useful to
|
104
|
+
start cleanup jobs or to even start another subsequent distributed job.
|
108
105
|
|
109
106
|
That's it.
|
110
107
|
|
data/distributed_job.gemspec
CHANGED
data/lib/distributed_job/job.rb
CHANGED
@@ -24,9 +24,7 @@ module DistributedJob
|
|
24
24
|
#
|
25
25
|
# # ...
|
26
26
|
#
|
27
|
-
# distributed_job.done(part)
|
28
|
-
#
|
29
|
-
# if distributed_job.finished?
|
27
|
+
# if distributed_job.done(part)
|
30
28
|
# # perform e.g. cleanup or the some other job
|
31
29
|
# end
|
32
30
|
# rescue
|
@@ -199,11 +197,11 @@ module DistributedJob
|
|
199
197
|
# end
|
200
198
|
|
201
199
|
def stop
|
202
|
-
redis.multi do
|
203
|
-
|
200
|
+
redis.multi do |transaction|
|
201
|
+
transaction.hset("#{redis_key}:state", 'stopped', 1)
|
204
202
|
|
205
|
-
|
206
|
-
|
203
|
+
transaction.expire("#{redis_key}:state", ttl)
|
204
|
+
transaction.expire("#{redis_key}:parts", ttl)
|
207
205
|
end
|
208
206
|
|
209
207
|
true
|
@@ -245,11 +243,11 @@ module DistributedJob
|
|
245
243
|
end
|
246
244
|
|
247
245
|
def close
|
248
|
-
redis.multi do
|
249
|
-
|
246
|
+
redis.multi do |transaction|
|
247
|
+
transaction.hset("#{redis_key}:state", 'closed', 1)
|
250
248
|
|
251
|
-
|
252
|
-
|
249
|
+
transaction.expire("#{redis_key}:state", ttl)
|
250
|
+
transaction.expire("#{redis_key}:parts", ttl)
|
253
251
|
end
|
254
252
|
|
255
253
|
true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distributed_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Vetter
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 4.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 4.1.0
|
55
55
|
description: Keep track of distributed jobs spanning multiple workers using redis
|
56
56
|
email:
|
57
57
|
- benjamin.vetter@wlw.de
|
@@ -83,7 +83,7 @@ metadata:
|
|
83
83
|
homepage_uri: https://github.com/mrkamel/distributed_job
|
84
84
|
source_code_uri: https://github.com/mrkamel/distributed_job
|
85
85
|
changelog_uri: https://github.com/mrkamel/distributed_job/blob/master/CHANGELOG.md
|
86
|
-
post_install_message:
|
86
|
+
post_install_message:
|
87
87
|
rdoc_options: []
|
88
88
|
require_paths:
|
89
89
|
- lib
|
@@ -98,8 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
101
|
+
rubygems_version: 3.3.3
|
102
|
+
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Keep track of distributed jobs using redis
|
105
105
|
test_files: []
|