distributed_job 1.0.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8aa1822c85ccb44521e470a312b430b9409dd537add85122045f7cd71d075ed
4
- data.tar.gz: a781158c7699303544cb78185a200059da25013830f677a44a704b6a0c115af8
3
+ metadata.gz: 2d9474eeee925618320f8a541274a66b68c20648a6ab7e33bd1cc302e97108e9
4
+ data.tar.gz: d2cf52dc713aca183eda21d4022001533e35d7846fa3fcf76aee9434cbe21089
5
5
  SHA512:
6
- metadata.gz: 6885d739ae86c615588dfd85ca1b4d0b0b3e4bcdf8cca1ddf1aebcb806a703c1980ca2d1e6f758d22b38a24a3859d5673fa47e7b2438db4635a4e24351bff4eb
7
- data.tar.gz: ffbea863763a62d8f22a2e8c2f2b8555a910fc908801e9a93157703a3a2e7e6fbd9bee3b90e6c35971d430b8b720781b02c1d116159e1ea2c3cb00b9fa57b7d4
6
+ metadata.gz: 5a4e788012c9b9c3bf9afe5d20a3ff835c0260aeca0e90bffd9de80441fb342ca1a30550baf974bbb5efcd85707c31e10b187e4281eab65a1f111cfcd4de6817
7
+ data.tar.gz: ce00582676f135a1a11f92f59e7cf50147b7ac1ddb8427368d1dc0b7095e40d047a6ef662f5ecf5e1c765acf64c8783bcb7a4e1d8b821d7b74b91adbd19b290b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v2.0.0
4
+
5
+ * `#push_each` no longer returns an enum when no block is given
6
+ * Renamed `#parts` to `#open_parts`
7
+
3
8
  ## v1.0.0
4
9
 
5
10
  * Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- distributed_job (1.0.0)
4
+ distributed_job (2.0.0)
5
5
  redis
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -38,6 +38,12 @@ To create a distributed job and add parts, i.e. units of work, to it, simply:
38
38
  distributed_job.token # can be used to query the status of the distributed job
39
39
  ```
40
40
 
41
+ The `part` which is passed to the block is some id for one particular part of
42
+ the distributed job. It must be used in a respective background job to mark
43
+ this part finished after it has been successfully processed. Therefore, when
44
+ all those background jobs have successfully finished, all parts will be marked
45
+ as finished, such that the distributed job will finally be finished as well.
46
+
41
47
  The `token` can be used to keep query the status of the distributed job, e.g.
42
48
  on a job summary page or similar. You can show some progress bar in the browser
43
49
  or in the terminal, etc:
@@ -48,7 +54,8 @@ distributed_job = Distributed.new(redis: Redis.new, token: params[:token])
48
54
 
49
55
  distributed_job.total # total number of parts
50
56
  distributed_job.count # number of unfinished parts
51
- distributed_job.finished?
57
+ distributed_job.finished? # whether or not all parts are finished
58
+ distributed_job.open_parts # returns all not yet finished part id's
52
59
  ```
53
60
 
54
61
  Within the background job, you use the passed token and part to query and
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class DistributedJob
4
- VERSION = '1.0.0'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -82,8 +82,6 @@ class DistributedJob
82
82
  # end
83
83
 
84
84
  def push_each(enum)
85
- return enum_for(:push_each, enum) unless block_given?
86
-
87
85
  previous_object = nil
88
86
  previous_index = nil
89
87
 
@@ -101,11 +99,11 @@ class DistributedJob
101
99
  yield(previous_object, previous_index.to_s) if previous_index
102
100
  end
103
101
 
104
- # Returns all pushed parts of the distributed job
102
+ # Returns all parts of the distributed job which are not yet finished.
105
103
  #
106
104
  # @return [Enumerator] The enum which allows to iterate all parts
107
105
 
108
- def parts
106
+ def open_parts
109
107
  redis.sscan_each("#{redis_key}:parts")
110
108
  end
111
109
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter