abid 0.3.0.pre.alpha.4 → 0.3.0.pre.alpha.5
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/.travis.yml +1 -1
- data/README.md +3 -2
- data/bin/setup +1 -1
- data/lib/abid/application.rb +33 -2
- data/lib/abid/cli.rb +15 -4
- data/lib/abid/dsl/job_manager.rb +23 -0
- data/lib/abid/engine/executor.rb +1 -0
- data/lib/abid/engine/process.rb +1 -0
- data/lib/abid/version.rb +1 -1
- data/migrations/02_create_state_table_index.rb +9 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa7a38773bdfcb607b2640de85df8f0c3039ee2b
|
4
|
+
data.tar.gz: 876354c5246cbf418d99fc88d9a32d7ab2b628d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c03979c2d34b3f12819d47a8f7f28fce29fae3b56f03ede95f203a30ead441abb9e6a78f7cc1fdfc6a249c4d5dff29ae2a2c438c6d110dd373b31a8246838f47
|
7
|
+
data.tar.gz: 9b530b8336df34055d30ec0b83bff880db5c8573f6c36d5a92fc6f05a4586262b652cf41aaf13bca31eb814b1569592bcb7c7c084f9dc9de97be436ba4909dc2
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Abid is a simple Workflow Engine based on Rake.
|
|
26
26
|
|
27
27
|
2. Setup a database.
|
28
28
|
|
29
|
-
$ bundle exec abidsc
|
29
|
+
$ bundle exec abidsc init
|
30
30
|
|
31
31
|
## Usage
|
32
32
|
|
@@ -352,7 +352,8 @@ $ abidsc list --after='2000-01-01 00:00:00" --before="2000=01-02 00:00:00" # Di
|
|
352
352
|
$ abidsc revoke STATE_ID # remove the job history # Remove the play recored from DB.
|
353
353
|
$ abidsc assume TASK_NAME date=2000-01-01 # Insert a record that the play successed into DB.
|
354
354
|
|
355
|
-
$ abidsc
|
355
|
+
$ abidsc init # Initialize DB schema.
|
356
|
+
$ abidsc upgrade # Upgrade DB schema.
|
356
357
|
```
|
357
358
|
|
358
359
|
## Development
|
data/bin/setup
CHANGED
data/lib/abid/application.rb
CHANGED
@@ -15,6 +15,7 @@ module Abid
|
|
15
15
|
class Application < Rake::Application
|
16
16
|
def initialize(env)
|
17
17
|
super()
|
18
|
+
@name = 'abid'
|
18
19
|
@rakefiles = %w(abidfile Abidfile abidfile.rb Abidfile.rb)
|
19
20
|
@env = env
|
20
21
|
@global_params = {}
|
@@ -24,7 +25,7 @@ module Abid
|
|
24
25
|
end
|
25
26
|
attr_reader :global_params, :global_mixin, :job_manager, :after_all_actions
|
26
27
|
|
27
|
-
def init
|
28
|
+
def init(app_name = 'abid')
|
28
29
|
super
|
29
30
|
@env.config.load(options.config_file)
|
30
31
|
end
|
@@ -32,6 +33,8 @@ module Abid
|
|
32
33
|
def top_level
|
33
34
|
if options.show_tasks || options.show_prereqs
|
34
35
|
super
|
36
|
+
elsif options.show_job_preqs
|
37
|
+
display_job_prerequisites
|
35
38
|
else
|
36
39
|
run_with_engine { invoke_top_level_tasks }
|
37
40
|
end
|
@@ -57,6 +60,24 @@ module Abid
|
|
57
60
|
call_after_all_actions
|
58
61
|
end
|
59
62
|
|
63
|
+
# Display the job prerequisites
|
64
|
+
def display_job_prerequisites
|
65
|
+
from = parse_job_string(options.show_job_preqs)
|
66
|
+
to = parse_job_string(options.show_job_preqs_to) \
|
67
|
+
if options.show_job_preqs_to
|
68
|
+
@job_manager.collect_prerequisites(from, to).each do |job|
|
69
|
+
puts "#{name} #{job}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def parse_job_string(job_string)
|
74
|
+
require 'shellwords'
|
75
|
+
args = Shellwords.split(job_string)
|
76
|
+
params, tasks = ParamsFormat.collect_params(args)
|
77
|
+
name, = parse_task_string(tasks.first)
|
78
|
+
@job_manager[name, params]
|
79
|
+
end
|
80
|
+
|
60
81
|
def standard_rake_options
|
61
82
|
super.each do |opt|
|
62
83
|
case opt.first
|
@@ -95,7 +116,17 @@ module Abid
|
|
95
116
|
end],
|
96
117
|
['--[no-]logging',
|
97
118
|
'Enable logging. (default: on)',
|
98
|
-
proc { |v| options.logging = v }]
|
119
|
+
proc { |v| options.logging = v }],
|
120
|
+
['--force',
|
121
|
+
'Force execute the task without regard to dependencies and the' \
|
122
|
+
' task state.',
|
123
|
+
proc { options.force = true }],
|
124
|
+
['--job-prereqs JOB', '-J',
|
125
|
+
'Display the job dependencies, then exit',
|
126
|
+
proc { |v| options.show_job_preqs = v }],
|
127
|
+
['--to JOB',
|
128
|
+
'Show only the job dependencies which depends on this job',
|
129
|
+
proc { |v| options.show_job_preqs_to = v }]
|
99
130
|
]
|
100
131
|
)
|
101
132
|
end
|
data/lib/abid/cli.rb
CHANGED
@@ -15,10 +15,14 @@ module Abid
|
|
15
15
|
puts @env.config.to_yaml
|
16
16
|
end
|
17
17
|
|
18
|
-
desc '
|
19
|
-
def
|
20
|
-
|
21
|
-
|
18
|
+
desc 'init', 'Create new abid project'
|
19
|
+
def init
|
20
|
+
migrate
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'upgrade', 'Upgrade current abid project'
|
24
|
+
def upgrade
|
25
|
+
migrate
|
22
26
|
end
|
23
27
|
|
24
28
|
desc 'assume TASK [TASKS..] [PARAMS]', 'Assume the job to be SUCCESSED'
|
@@ -50,5 +54,12 @@ module Abid
|
|
50
54
|
Revoke.new(@env, options, [job_id, *rest_args]).run
|
51
55
|
end
|
52
56
|
map rm: :revoke
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def migrate
|
61
|
+
require 'abid/cli/migrate'
|
62
|
+
Migrate.new(@env, options).run
|
63
|
+
end
|
53
64
|
end
|
54
65
|
end
|
data/lib/abid/dsl/job_manager.rb
CHANGED
@@ -48,6 +48,29 @@ module Abid
|
|
48
48
|
raise "#{task.name}: param #{key} is not specified"
|
49
49
|
end
|
50
50
|
private :fetch_param
|
51
|
+
|
52
|
+
# @param job [Job] collect prerequisites of the job.
|
53
|
+
# @param target_job [Job] collect only prerequisites depending on
|
54
|
+
# `target_job` if specified.
|
55
|
+
# @return [Array<Job>]
|
56
|
+
def collect_prerequisites(job, target_job = nil)
|
57
|
+
collect_prerequisites_iter(job, {}, target_job).keys
|
58
|
+
end
|
59
|
+
|
60
|
+
def collect_prerequisites_iter(job, checked, target_job = nil)
|
61
|
+
return {} if checked.include?(job)
|
62
|
+
checked[job] = nil
|
63
|
+
|
64
|
+
return { job => nil } if target_job == job
|
65
|
+
|
66
|
+
found = {}
|
67
|
+
job.prerequisites.each do |preq|
|
68
|
+
found.update(collect_prerequisites_iter(preq, checked, target_job))
|
69
|
+
end
|
70
|
+
found[job] = nil if target_job.nil? || !found.empty?
|
71
|
+
found
|
72
|
+
end
|
73
|
+
private :collect_prerequisites_iter
|
51
74
|
end
|
52
75
|
end
|
53
76
|
end
|
data/lib/abid/engine/executor.rb
CHANGED
data/lib/abid/engine/process.rb
CHANGED
data/lib/abid/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.pre.alpha.
|
4
|
+
version: 0.3.0.pre.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hikaru Ojima
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- lib/abid/status.rb
|
196
196
|
- lib/abid/version.rb
|
197
197
|
- migrations/01_create_state_table.rb
|
198
|
+
- migrations/02_create_state_table_index.rb
|
198
199
|
homepage: https://github.com/ojima-h/abid
|
199
200
|
licenses:
|
200
201
|
- MIT
|