jobba 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +5 -10
- data/lib/jobba.rb +6 -5
- data/lib/jobba/status.rb +9 -1
- data/lib/jobba/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4e9d94c44e106165f0d2ac0e0cfc45999e491e9
|
4
|
+
data.tar.gz: 6f6d8db0eb8b7cbc17a9825e55b9a35365b8c4a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 787771b8aaaf606437ee72425667dce7caa899ef95d965d2703710422bd50274c67a4f40992ae9306da4ead581878fe4380c6e5fb1cb2ae42cedf7d71782106b
|
7
|
+
data.tar.gz: 6bb44328f4be0c0230e0760071fa1dd28a15f611c20ffb7724402674e6237d8813ff20b6ddd46d147ac4826242aa9cf0fb40727ec93a323ae72b3d181ffdf53c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -40,20 +40,20 @@ end
|
|
40
40
|
If you know you need a new `Status`, call `create!`:
|
41
41
|
|
42
42
|
```ruby
|
43
|
-
Jobba
|
43
|
+
Jobba.create!
|
44
44
|
```
|
45
45
|
|
46
46
|
If you are looking for a status:
|
47
47
|
|
48
48
|
```ruby
|
49
|
-
Jobba
|
49
|
+
Jobba.find(id)
|
50
50
|
```
|
51
51
|
|
52
52
|
which will return `nil` if no such `Status` is found. If you always want a `Status` object back,
|
53
53
|
call:
|
54
54
|
|
55
55
|
```ruby
|
56
|
-
Jobba
|
56
|
+
Jobba.find!(id)
|
57
57
|
```
|
58
58
|
|
59
59
|
The result of `find!` will start in an `unknown` state if the ID doesn't exist in Redis.
|
@@ -63,7 +63,7 @@ The result of `find!` will start in an `unknown` state if the ID doesn't exist i
|
|
63
63
|
```ruby
|
64
64
|
class MyJob < ::ActiveJob::Base
|
65
65
|
def self.perform_later(an_arg:, another_arg:)
|
66
|
-
status = Jobba
|
66
|
+
status = Jobba.create!
|
67
67
|
args.push(status.id)
|
68
68
|
|
69
69
|
# In theory we'd mark as queued right after the call to super, but this messes
|
@@ -77,7 +77,7 @@ class MyJob < ::ActiveJob::Base
|
|
77
77
|
|
78
78
|
def perform(*args, &block)
|
79
79
|
# Pop the ID argument added by perform_later and get a Status
|
80
|
-
status = Jobba
|
80
|
+
status = Jobba.find!(args.pop)
|
81
81
|
status.started!
|
82
82
|
|
83
83
|
# ... do stuff ...
|
@@ -462,8 +462,3 @@ Travis runs the specs with both `fakeredis` and real Redis.
|
|
462
462
|
1. Provide job min, max, and average durations.
|
463
463
|
8. Specs that test scale.
|
464
464
|
9. Move redis code in `set_job_args`, `set_job_name`, and `save` into `set` to match rest of code.
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
data/lib/jobba.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
require 'securerandom'
|
3
|
+
|
1
4
|
require "redis"
|
2
5
|
require "redis-namespace"
|
3
6
|
|
@@ -14,12 +17,10 @@ require "jobba/query"
|
|
14
17
|
|
15
18
|
module Jobba
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
+
class << self
|
21
|
+
extend Forwardable
|
20
22
|
|
21
|
-
|
22
|
-
all.where(*args)
|
23
|
+
def_delegators Jobba::Status, :all, :where, :create, :create!, :find, :find!
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.configure
|
data/lib/jobba/status.rb
CHANGED
@@ -6,6 +6,14 @@ module Jobba
|
|
6
6
|
|
7
7
|
include Jobba::Common
|
8
8
|
|
9
|
+
def self.all
|
10
|
+
Query.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.where(*args)
|
14
|
+
all.where(*args)
|
15
|
+
end
|
16
|
+
|
9
17
|
def self.create!
|
10
18
|
create(state: State::UNQUEUED)
|
11
19
|
end
|
@@ -211,7 +219,7 @@ module Jobba
|
|
211
219
|
@state = attrs[:state] || State::UNKNOWN
|
212
220
|
@progress = attrs[:progress] || 0
|
213
221
|
@errors = attrs[:errors] || []
|
214
|
-
@data = attrs[:data]
|
222
|
+
@data = attrs[:data]
|
215
223
|
@attempt = attrs[:attempt] || 0
|
216
224
|
@job_args = attrs[:job_args] || {}
|
217
225
|
@job_name = attrs[:job_name]
|
data/lib/jobba/version.rb
CHANGED
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.
|
4
|
+
version: 1.4.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-
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|