gush 0.2.2 → 0.2.3
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/gush.gemspec +1 -1
- data/lib/gush/cli.rb +2 -1
- data/lib/gush/cli/overview.rb +7 -2
- data/lib/gush/client.rb +2 -1
- data/lib/gush/job.rb +7 -1
- data/lib/gush/workflow.rb +2 -2
- data/spec/features/integration_spec.rb +1 -2
- data/spec/lib/gush/workflow_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -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: 392530c8fb8c72de66d30d0e2dff156f7bd5981e
|
4
|
+
data.tar.gz: 96a4eb1b335d4b1927d6b10b09659197b5518bc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd3deccd8c220426b730d417883cddc18a0fbf1ffac6aaa9e2406fd98b969e48a349fb2eb687769f03ae60a62aa3792f4f951b84a92bdd0c804bedc4f265a44d
|
7
|
+
data.tar.gz: 0bf46f8276ad9c1cc59104c329aa7f41e621aa0bb9ddb21ce1d0b5e0efcb76f4dcd7d0ec5c1c05363cd6868483c88b18175774881ef8004091950d929ad76eba
|
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 = "0.2.
|
7
|
+
spec.version = "0.2.3"
|
8
8
|
spec.authors = ["Piotrek Okoński"]
|
9
9
|
spec.email = ["piotrek@okonski.org"]
|
10
10
|
spec.summary = "Fast and distributed workflow runner using only Sidekiq and Redis"
|
data/lib/gush/cli.rb
CHANGED
@@ -35,7 +35,8 @@ module Gush
|
|
35
35
|
desc "start [workflow_id]", "Starts Workflow with given ID"
|
36
36
|
def start(*args)
|
37
37
|
id = args.shift
|
38
|
-
client.
|
38
|
+
workflow = client.find_workflow(id)
|
39
|
+
client.start_workflow(workflow, args)
|
39
40
|
end
|
40
41
|
|
41
42
|
desc "create_and_start [WorkflowClass]", "Create and instantly start the new workflow"
|
data/lib/gush/cli/overview.rb
CHANGED
@@ -21,7 +21,7 @@ module Gush
|
|
21
21
|
elsif workflow.stopped?
|
22
22
|
"stopped".red
|
23
23
|
else
|
24
|
-
|
24
|
+
"ready to start".blue
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -53,6 +53,7 @@ module Gush
|
|
53
53
|
"Enqueued jobs" => enqueued_jobs_count.yellow,
|
54
54
|
"Running jobs" => running_jobs_count.blue,
|
55
55
|
"Remaining jobs" => remaining_jobs_count,
|
56
|
+
"Started at" => started_at,
|
56
57
|
"Status" => status
|
57
58
|
}
|
58
59
|
end
|
@@ -63,6 +64,10 @@ module Gush
|
|
63
64
|
status += "\n#{finished}/#{total_jobs_count} [#{(finished*100)/total_jobs_count}%]"
|
64
65
|
end
|
65
66
|
|
67
|
+
def started_at
|
68
|
+
workflow.started_at.inspect
|
69
|
+
end
|
70
|
+
|
66
71
|
def failed_status
|
67
72
|
status = "failed".light_red
|
68
73
|
status += "\n#{failed_job} failed"
|
@@ -131,7 +136,7 @@ module Gush
|
|
131
136
|
end
|
132
137
|
|
133
138
|
def remaining_jobs_count
|
134
|
-
workflow.jobs.count{|j| [j.finished
|
139
|
+
workflow.jobs.count{|j| [j.finished?, j.failed?, j.enqueued?].none? }.to_s
|
135
140
|
end
|
136
141
|
end
|
137
142
|
end
|
data/lib/gush/client.rb
CHANGED
@@ -87,10 +87,11 @@ module Gush
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def load_job(workflow_id, job_id)
|
90
|
+
workflow = find_workflow(workflow_id)
|
90
91
|
data = redis.get("gush.jobs.#{workflow_id}.#{job_id}")
|
91
92
|
return nil if data.nil?
|
92
93
|
data = Gush::JSON.decode(data, symbolize_keys: true)
|
93
|
-
Gush::Job.from_hash(
|
94
|
+
Gush::Job.from_hash(workflow, data)
|
94
95
|
end
|
95
96
|
|
96
97
|
def destroy_workflow(workflow)
|
data/lib/gush/job.rb
CHANGED
@@ -84,7 +84,13 @@ module Gush
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def ready_to_start?
|
87
|
-
!running? && !enqueued? && !finished? && !failed?
|
87
|
+
!running? && !enqueued? && !finished? && !failed? && parents_succeeded?
|
88
|
+
end
|
89
|
+
|
90
|
+
def parents_succeeded?
|
91
|
+
incoming.all? do |name|
|
92
|
+
@workflow.find_job(name).succeeded?
|
93
|
+
end
|
88
94
|
end
|
89
95
|
|
90
96
|
def has_no_dependencies?
|
data/lib/gush/workflow.rb
CHANGED
@@ -5,7 +5,6 @@ describe "Workflows" do
|
|
5
5
|
it "marks workflow as completed" do
|
6
6
|
flow = TestWorkflow.create
|
7
7
|
flow.start!
|
8
|
-
expect(flow.reload).to be_running
|
9
8
|
|
10
9
|
Gush::Worker.drain
|
11
10
|
|
@@ -28,7 +27,7 @@ describe "Workflows" do
|
|
28
27
|
expect(Gush::Worker).to have_jobs(flow.id, ["FetchSecondJob", "PersistFirstJob"])
|
29
28
|
|
30
29
|
Gush::Worker.perform_one
|
31
|
-
expect(Gush::Worker).to have_jobs(flow.id, ["PersistFirstJob"
|
30
|
+
expect(Gush::Worker).to have_jobs(flow.id, ["PersistFirstJob"])
|
32
31
|
|
33
32
|
Gush::Worker.perform_one
|
34
33
|
expect(Gush::Worker).to have_jobs(flow.id, ["NormalizeJob"])
|
data/spec/spec_helper.rb
CHANGED
@@ -21,9 +21,10 @@ class TestWorkflow < Gush::Workflow
|
|
21
21
|
run NormalizeJob
|
22
22
|
|
23
23
|
run FetchFirstJob, after: Prepare
|
24
|
+
run FetchSecondJob, after: Prepare, before: NormalizeJob
|
25
|
+
|
24
26
|
run PersistFirstJob, after: FetchFirstJob, before: NormalizeJob
|
25
27
|
|
26
|
-
run FetchSecondJob, after: Prepare, before: NormalizeJob
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
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: 0.2.
|
4
|
+
version: 0.2.3
|
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: 2015-09-
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|