jobba 1.0.1 → 1.1.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
  SHA1:
3
- metadata.gz: f867ae880d3339b25e987267ac135429ee2fb80e
4
- data.tar.gz: 3882b0e610200fe6b2c119dc46efe37261dea455
3
+ metadata.gz: be04439547ffdf5ad57d5ac3a3279ca10ed0ae5b
4
+ data.tar.gz: 13de0a5da8c25827bdef5a7dbb99143d3e12427b
5
5
  SHA512:
6
- metadata.gz: 369cddf40dd02571641bd114043f8f70f74ba6b0803d191893a79f7375c40bfaa8114436fbabcbc95986d231491d4f86979af90564e8b284608f7cdad46b5553
7
- data.tar.gz: 966e2fc051cd4d8c5f5c9a2abebb4286aa9960cfad46d77ca52bdbe06351bf92945963c1c3d7d0cf9694b3fe6b84ccfe7b0610cef169a125dbbfb1aaa251cbe4
6
+ metadata.gz: 1099b20ffe944620cf5d712eea9c64410da0fa877ac9695c27dfee3cf557f2c348eeeaf9ca44088fa4c42fe0f1e8b6f1d27541412e0211ad5f7d900a1625baaa
7
+ data.tar.gz: a041d7540f6518291bd659b881dd03fc74d942529786b7c70145c9c327b6261facb44d489c7fd33672fe23a29d446c799ce362494d4d018f1c9824c9d4c5c64a
data/README.md CHANGED
@@ -19,6 +19,8 @@ or
19
19
  $> gem install jobba
20
20
  ```
21
21
 
22
+ Semantic versioning will begin with version `2.0.0`.
23
+
22
24
  ## Configuration
23
25
 
24
26
  To configure Jobba, put the following code in your applications
@@ -54,7 +56,7 @@ call:
54
56
  Jobba::Status.find!(id)
55
57
  ```
56
58
 
57
- The results of `find!` will always start in an `unknown` state.
59
+ The result of `find!` will start in an `unknown` state if the ID doesn't exist in Redis.
58
60
 
59
61
  ## Basic Use with ActiveJob
60
62
 
@@ -76,7 +78,7 @@ class MyJob < ::ActiveJob::Base
76
78
  def perform(*args, &block)
77
79
  # Pop the ID argument added by perform_later and get a Status
78
80
  status = Jobba::Status.find!(args.pop)
79
- status.working!
81
+ status.started!
80
82
 
81
83
  # ... do stuff ...
82
84
 
@@ -91,7 +93,7 @@ One of the main functions of Jobba is to let a job advance its status through a
91
93
 
92
94
  * `unqueued`
93
95
  * `queued`
94
- * `working`
96
+ * `started`
95
97
  * `succeeded`
96
98
  * `failed`
97
99
  * `killed`
@@ -100,7 +102,7 @@ One of the main functions of Jobba is to let a job advance its status through a
100
102
  Put a `Status` into one of these states by calling `that_state!`, e.g.
101
103
 
102
104
  ```ruby
103
- my_state.working!
105
+ my_state.started!
104
106
  ```
105
107
 
106
108
  The `unqueued` state is entered when a `Status` is first created. The `unknown` state is entered when `find!(id)` is called but the `id` is not known. You can re-enter these states with the `!` methods, but note that the `recorded_at` timestamp will not be updated.
@@ -111,7 +113,7 @@ The **first time a state is entered**, a timestamp is recorded for that state.
111
113
  |-------|-----------|
112
114
  |unqueued | recorded_at |
113
115
  |queued | queued_at |
114
- |working | started_at |
116
+ |started | started_at |
115
117
  |succeeded | succeeded_at |
116
118
  |failed | failed_at |
117
119
  |killed | killed_at |
@@ -162,7 +164,7 @@ If you want to be able to query for all statuses that take a certain argument as
162
164
  my_status.add_job_arg(arg_name, arg)
163
165
  ```
164
166
 
165
- where `arg_name` is what the argument is called in your job (e.g. `"input_1"`) and `arg` is a way to identify the argument (e.g. `"gid://app/Person/72").
167
+ where `arg_name` is what the argument is called in your job (e.g. `"input_1"`) and `arg` is a way to identify the argument (e.g. `"gid://app/Person/72"`).
166
168
 
167
169
  You probably will only want to track complex arguments, e.g. models in your application. E.g. you could have a `Book` model and a `PublishBook` background job and you may want to see all of the `PublishBook` jobs that have status for the `Book` with ID `53`.
168
170
 
@@ -182,7 +184,7 @@ my_status.kill_requested?
182
184
 
183
185
  and if that returns `true`, it can attempt to gracefully terminate itself.
184
186
 
185
- Note that when a kill is requested, the job will continue to be in some other state (e.g. `working`) until it is in fact killed, at which point the job should call:
187
+ Note that when a kill is requested, the job will continue to be in some other state (e.g. `started`) until it is in fact killed, at which point the job should call:
186
188
 
187
189
  ```ruby
188
190
  my_status.killed!
@@ -217,7 +219,7 @@ A `Status` object also methods to check if it is in certain states:
217
219
  * `reload!`
218
220
  * `unqueued?`
219
221
  * `queued?`
220
- * `working?`
222
+ * `started?`
221
223
  * `succeeded?`
222
224
  * `failed?`
223
225
  * `killed?`
@@ -228,11 +230,11 @@ And two conveience methods for checking groups of states:
228
230
  * `completed?`
229
231
  * `incomplete?`
230
232
 
231
- You can also call `reload!` on a `Status` to have it reset its state to what is stored in redis.
233
+ You can also call `reload!` on a `Status` to have it reset its state to what is stored in Redis.
232
234
 
233
235
  ## Deleting Job Statuses
234
236
 
235
- Once jobs are completed or otherwise no longer interesting, it'd be nice to clear them out of redis. You can do this with:
237
+ Once jobs are completed or otherwise no longer interesting, it'd be nice to clear them out of Redis. You can do this with:
236
238
 
237
239
  ```ruby
238
240
  my_status.delete # freaks out if `my_status` isn't complete
@@ -250,7 +252,7 @@ Jobba has an activerecord-like query interface for finding Status objects.
250
252
  ```ruby
251
253
  Jobba.where(state: :unqueued)
252
254
  Jobba.where(state: :queued)
253
- Jobba.where(state: :working)
255
+ Jobba.where(state: :started)
254
256
  Jobba.where(state: :succeeded)
255
257
  Jobba.where(state: :failed)
256
258
  Jobba.where(state: :killed)
@@ -261,13 +263,13 @@ Two convenience "state" queries have been added:
261
263
 
262
264
  ```ruby
263
265
  Jobba.where(state: :completed) # includes succeeded, failed
264
- Jobba.where(state: :incomplete) # includes unqueued, queued, working, killed
266
+ Jobba.where(state: :incomplete) # includes unqueued, queued, started, killed
265
267
  ```
266
268
 
267
269
  You can query combinations of states too:
268
270
 
269
271
  ```ruby
270
- Jobba.where(state: [:queued, :working])
272
+ Jobba.where(state: [:queued, :started])
271
273
  ```
272
274
 
273
275
  **State Timestamp**
@@ -328,7 +330,7 @@ When you have a query you can run the following methods on it. These act like w
328
330
  * `empty?`
329
331
  * `count`
330
332
 
331
- `empty?` and `count` are performed in redis without bringing back all query results to Ruby.
333
+ `empty?` and `count` are performed in Redis without bringing back all query results to Ruby.
332
334
 
333
335
  You can also call two special methods directly on `Jobba`:
334
336
 
@@ -363,7 +365,7 @@ Note that, in operations having to do with time, this gem ignores anything beyon
363
365
 
364
366
  ### Efficiency
365
367
 
366
- Jobba strives to do all of its operations as efficiently as possible using built-in redis operations. If you find a place where the efficiency can be improved, please submit an issue or a pull request.
368
+ Jobba strives to do all of its operations as efficiently as possible using built-in Redis operations. If you find a place where the efficiency can be improved, please submit an issue or a pull request.
367
369
 
368
370
  ## TODO
369
371
 
data/lib/jobba/state.rb CHANGED
@@ -13,7 +13,7 @@ class Jobba::State
13
13
 
14
14
  UNQUEUED = new('unqueued', 'recorded_at')
15
15
  QUEUED = new('queued', 'queued_at')
16
- WORKING = new('working', 'started_at')
16
+ STARTED = new('started', 'started_at')
17
17
  SUCCEEDED = new('succeeded', 'succeeded_at')
18
18
  FAILED = new('failed', 'failed_at')
19
19
  KILLED = new('killed', 'killed_at')
@@ -22,7 +22,7 @@ class Jobba::State
22
22
  ALL = [
23
23
  UNQUEUED,
24
24
  QUEUED,
25
- WORKING,
25
+ STARTED,
26
26
  SUCCEEDED,
27
27
  FAILED,
28
28
  KILLED,
@@ -37,14 +37,14 @@ class Jobba::State
37
37
  INCOMPLETE = [
38
38
  UNQUEUED,
39
39
  QUEUED,
40
- WORKING,
40
+ STARTED,
41
41
  KILLED
42
42
  ].freeze
43
43
 
44
44
  ENTERABLE = [
45
45
  UNQUEUED,
46
46
  QUEUED,
47
- WORKING,
47
+ STARTED,
48
48
  SUCCEEDED,
49
49
  FAILED,
50
50
  KILLED,
data/lib/jobba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jobba
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobba
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis