gush 2.0.0 → 2.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/CHANGELOG.md +6 -0
- data/gush.gemspec +1 -1
- data/lib/gush/job.rb +1 -0
- data/spec/features/integration_spec.rb +47 -2
- data/spec/gush/job_spec.rb +10 -2
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffcdce12d2f530e27afdd048328d8942e60efcddfbe20a18426b8d245589c759
|
4
|
+
data.tar.gz: 3c95194d44f446a694af83b06b06eac55a3e5ed1f8555fe86958fa110b357647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e75e7f0ae5c5c83302d0507bb502a30a860f276e0706edd5a4119bb9c50bf88c73c9839ac1f141f4569017301ebb61fe943317d214c0c9a10f49309e674bd183
|
7
|
+
data.tar.gz: 38f3baaa43a4d512d5d5ec6c476d21965d27116e7dc8bc1ae3cc3fa4a4fac13e6d18272ed236fd413aba0c304f0e79aee59f3c06cdad19db7fa02e41305fe491
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## 2.0.1
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
- Fix bug when retried jobs didn't correctly reset their failed flag when ran again (Thanks to @theo-delaune-argus and @mickael-palma-argus! [See issue](https://github.com/chaps-io/gush/issues/61))
|
13
|
+
|
8
14
|
## 2.0.0
|
9
15
|
|
10
16
|
## Changed
|
data/gush.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "gush"
|
7
|
-
spec.version = "2.0.
|
7
|
+
spec.version = "2.0.1"
|
8
8
|
spec.authors = ["Piotrek Okoński"]
|
9
9
|
spec.email = ["piotrek@okonski.org"]
|
10
10
|
spec.summary = "Fast and distributed workflow runner based on ActiveJob and Redis"
|
data/lib/gush/job.rb
CHANGED
@@ -15,6 +15,53 @@ describe "Workflows" do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
context 'when one of the jobs fails initally' do
|
19
|
+
it 'succeeds when the job retries' do
|
20
|
+
FAIL_THEN_SUCCEED_SPY = double()
|
21
|
+
allow(FAIL_THEN_SUCCEED_SPY).to receive(:foo).and_return('failure', 'success')
|
22
|
+
|
23
|
+
class FailsThenSucceeds < Gush::Job
|
24
|
+
def perform
|
25
|
+
if FAIL_THEN_SUCCEED_SPY.foo == 'failure'
|
26
|
+
raise NameError
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class SecondChanceWorkflow < Gush::Workflow
|
32
|
+
def configure
|
33
|
+
run Prepare
|
34
|
+
run FailsThenSucceeds, after: Prepare
|
35
|
+
run NormalizeJob, after: FailsThenSucceeds
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
flow = SecondChanceWorkflow.create
|
40
|
+
flow.start!
|
41
|
+
|
42
|
+
expect(Gush::Worker).to have_jobs(flow.id, jobs_with_id(['Prepare']))
|
43
|
+
perform_one
|
44
|
+
|
45
|
+
expect(Gush::Worker).to have_jobs(flow.id, jobs_with_id(['FailsThenSucceeds']))
|
46
|
+
expect do
|
47
|
+
perform_one
|
48
|
+
end.to raise_error(NameError)
|
49
|
+
|
50
|
+
expect(flow.reload).to be_failed
|
51
|
+
expect(Gush::Worker).to have_jobs(flow.id, jobs_with_id(['FailsThenSucceeds']))
|
52
|
+
|
53
|
+
# Retry the same job again, but this time succeeds
|
54
|
+
perform_one
|
55
|
+
|
56
|
+
expect(Gush::Worker).to have_jobs(flow.id, jobs_with_id(['NormalizeJob']))
|
57
|
+
perform_one
|
58
|
+
|
59
|
+
flow = flow.reload
|
60
|
+
expect(flow).to be_finished
|
61
|
+
expect(flow).to_not be_failed
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
18
65
|
it "runs the whole workflow in proper order" do
|
19
66
|
flow = TestWorkflow.create
|
20
67
|
flow.start!
|
@@ -77,8 +124,6 @@ describe "Workflows" do
|
|
77
124
|
|
78
125
|
perform_one
|
79
126
|
expect(flow.reload.find_job("PrependJob").output_payload).to eq("A prefix: SOME TEXT")
|
80
|
-
|
81
|
-
|
82
127
|
end
|
83
128
|
|
84
129
|
it "passes payloads from workflow that runs multiple same class jobs with nameized payloads" do
|
data/spec/gush/job_spec.rb
CHANGED
@@ -52,10 +52,18 @@ describe Gush::Job do
|
|
52
52
|
describe "#start!" do
|
53
53
|
it "resets flags and marks as running" do
|
54
54
|
job = described_class.new(name: "a-job")
|
55
|
+
|
56
|
+
job.enqueue!
|
57
|
+
job.fail!
|
58
|
+
|
59
|
+
now = Time.now.to_i
|
60
|
+
expect(job.started_at).to eq(nil)
|
61
|
+
expect(job.failed_at).to eq(now)
|
62
|
+
|
55
63
|
job.start!
|
64
|
+
|
56
65
|
expect(job.started_at).to eq(Time.now.to_i)
|
57
|
-
expect(job.
|
58
|
-
expect(job.running?).to eq(true)
|
66
|
+
expect(job.failed_at).to eq(nil)
|
59
67
|
end
|
60
68
|
end
|
61
69
|
|
data/spec/spec_helper.rb
CHANGED
@@ -14,7 +14,7 @@ class PersistSecondJob < Gush::Job; end
|
|
14
14
|
class NormalizeJob < Gush::Job; end
|
15
15
|
class BobJob < Gush::Job; end
|
16
16
|
|
17
|
-
GUSHFILE
|
17
|
+
GUSHFILE = Pathname.new(__FILE__).parent.join("Gushfile")
|
18
18
|
|
19
19
|
class TestWorkflow < Gush::Workflow
|
20
20
|
def configure
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotrek Okoński
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|