scout-gear 6.0.0 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +465 -432
- data/VERSION +1 -1
- data/bin/scout +5 -1
- data/lib/rbbt-scout.rb +5 -0
- data/lib/scout/concurrent_stream.rb +6 -2
- data/lib/scout/config.rb +168 -0
- data/lib/scout/exceptions.rb +9 -0
- data/lib/scout/indiferent_hash/options.rb +1 -0
- data/lib/scout/indiferent_hash.rb +4 -2
- data/lib/scout/log/color.rb +31 -2
- data/lib/scout/log/progress/report.rb +1 -0
- data/lib/scout/log/progress/util.rb +3 -1
- data/lib/scout/log/progress.rb +7 -3
- data/lib/scout/log.rb +8 -3
- data/lib/scout/misc/digest.rb +1 -3
- data/lib/scout/misc/monitor.rb +3 -0
- data/lib/scout/misc/system.rb +15 -0
- data/lib/scout/misc.rb +1 -0
- data/lib/scout/named_array.rb +68 -0
- data/lib/scout/open/stream.rb +58 -26
- data/lib/scout/path/find.rb +27 -3
- data/lib/scout/path/util.rb +7 -4
- data/lib/scout/persist/serialize.rb +7 -14
- data/lib/scout/persist.rb +21 -1
- data/lib/scout/resource/produce.rb +7 -94
- data/lib/scout/resource/software.rb +176 -0
- data/lib/scout/tsv/dumper.rb +107 -0
- data/lib/scout/tsv/index.rb +49 -0
- data/lib/scout/tsv/parser.rb +317 -0
- data/lib/scout/tsv/path.rb +13 -0
- data/lib/scout/tsv/persist/adapter.rb +348 -0
- data/lib/scout/tsv/persist/tokyocabinet.rb +113 -0
- data/lib/scout/tsv/persist.rb +15 -0
- data/lib/scout/tsv/traverse.rb +48 -0
- data/lib/scout/tsv/util.rb +24 -0
- data/lib/scout/tsv.rb +27 -0
- data/lib/scout/work_queue/worker.rb +16 -11
- data/lib/scout/work_queue.rb +63 -21
- data/lib/scout/workflow/definition.rb +93 -4
- data/lib/scout/workflow/step/config.rb +18 -0
- data/lib/scout/workflow/step/dependencies.rb +40 -0
- data/lib/scout/workflow/step/file.rb +15 -0
- data/lib/scout/workflow/step/info.rb +33 -6
- data/lib/scout/workflow/step/provenance.rb +148 -0
- data/lib/scout/workflow/step.rb +70 -20
- data/lib/scout/workflow/task.rb +5 -4
- data/lib/scout/workflow/usage.rb +1 -1
- data/lib/scout/workflow.rb +11 -3
- data/lib/scout-gear.rb +1 -0
- data/lib/scout.rb +1 -0
- data/scout-gear.gemspec +38 -3
- data/scout_commands/find +1 -1
- data/scout_commands/workflow/task +16 -10
- data/share/software/install_helpers +523 -0
- data/test/scout/log/test_progress.rb +0 -2
- data/test/scout/misc/test_system.rb +21 -0
- data/test/scout/open/test_stream.rb +160 -1
- data/test/scout/path/test_find.rb +14 -7
- data/test/scout/resource/test_software.rb +24 -0
- data/test/scout/test_config.rb +66 -0
- data/test/scout/test_meta_extension.rb +10 -0
- data/test/scout/test_named_array.rb +19 -0
- data/test/scout/test_persist.rb +35 -0
- data/test/scout/test_semaphore.rb +1 -1
- data/test/scout/test_tmpfile.rb +2 -2
- data/test/scout/test_tsv.rb +74 -0
- data/test/scout/test_work_queue.rb +63 -8
- data/test/scout/tsv/persist/test_adapter.rb +34 -0
- data/test/scout/tsv/persist/test_tokyocabinet.rb +92 -0
- data/test/scout/tsv/test_dumper.rb +44 -0
- data/test/scout/tsv/test_index.rb +64 -0
- data/test/scout/tsv/test_parser.rb +173 -0
- data/test/scout/tsv/test_persist.rb +36 -0
- data/test/scout/tsv/test_traverse.rb +9 -0
- data/test/scout/tsv/test_util.rb +0 -0
- data/test/scout/work_queue/test_worker.rb +49 -1
- data/test/scout/workflow/step/test_dependencies.rb +25 -0
- data/test/scout/workflow/step/test_info.rb +15 -17
- data/test/scout/workflow/step/test_load.rb +16 -18
- data/test/scout/workflow/step/test_provenance.rb +25 -0
- data/test/scout/workflow/test_step.rb +206 -10
- data/test/scout/workflow/test_task.rb +0 -3
- data/test/test_helper.rb +6 -0
- metadata +37 -2
data/lib/scout/workflow/task.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative 'task/inputs'
|
|
4
4
|
|
5
5
|
module Task
|
6
6
|
extend MetaExtension
|
7
|
-
extension_attr :name, :type, :inputs, :deps, :directory, :description
|
7
|
+
extension_attr :name, :type, :inputs, :deps, :directory, :description, :returns, :extension, :workflow
|
8
8
|
|
9
9
|
DEFAULT_NAME = "Default"
|
10
10
|
|
@@ -54,7 +54,7 @@ module Task
|
|
54
54
|
resolved_inputs = {}
|
55
55
|
inputs.each do |k,v|
|
56
56
|
if Symbol === v
|
57
|
-
input_dep = dependencies.select{|d| d.task_name == v}.first
|
57
|
+
input_dep = dependencies.select{|d| d.task_name == v }.first
|
58
58
|
resolved_inputs[k] = input_dep || inputs[v] || k
|
59
59
|
else
|
60
60
|
resolved_inputs[k] = v
|
@@ -143,13 +143,14 @@ module Task
|
|
143
143
|
non_default_inputs.concat provided_inputs.keys.select{|k| String === k && k.include?("#") } if Hash === provided_inputs
|
144
144
|
|
145
145
|
if non_default_inputs.any?
|
146
|
-
hash = Misc.digest(:inputs => input_hash, :
|
147
|
-
Log.debug "Hash #{name} - #{hash}: #{Misc.digest_str(:inputs => inputs, :dependencies => dependencies)}"
|
146
|
+
hash = Misc.digest(:inputs => input_hash, :dependencies => dependencies)
|
147
|
+
Log.debug "Hash #{name} - #{hash}: #{Misc.digest_str(:inputs => inputs, :non_default_inputs => non_default_inputs, :dependencies => dependencies)}"
|
148
148
|
id = [id, hash] * "_"
|
149
149
|
end
|
150
150
|
|
151
151
|
path = directory[id]
|
152
152
|
|
153
|
+
NamedArray.setup(inputs, @inputs.collect{|i| i[0] }) if @inputs
|
153
154
|
Step.new path.find, inputs, dependencies, &self
|
154
155
|
end
|
155
156
|
end
|
data/lib/scout/workflow/usage.rb
CHANGED
@@ -34,7 +34,6 @@ module Task
|
|
34
34
|
str.puts Log.color :yellow, dep + ":"
|
35
35
|
str.puts
|
36
36
|
str.puts SOPT.input_array_doc(inputs)
|
37
|
-
str.puts
|
38
37
|
end
|
39
38
|
|
40
39
|
#task_inputs = dep_inputs deps, workflow
|
@@ -72,6 +71,7 @@ module Task
|
|
72
71
|
str.puts
|
73
72
|
end
|
74
73
|
|
74
|
+
str.puts
|
75
75
|
str.puts Log.color(:magenta, "Returns: ") << Log.color(:blue, type.to_s) << "\n"
|
76
76
|
str.puts
|
77
77
|
|
data/lib/scout/workflow.rb
CHANGED
@@ -24,17 +24,25 @@ module Workflow
|
|
24
24
|
base.libdir = Path.setup(libdir).tap{|p| p.resource = base}
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.require_workflow(
|
28
|
-
workflow =
|
27
|
+
def self.require_workflow(workflow_name)
|
28
|
+
workflow = workflow_name
|
29
|
+
workflow = Path.setup('workflows')[workflow_name]["workflow.rb"] unless Open.exists?(workflow)
|
30
|
+
workflow = Path.setup('workflows')[Misc.snake_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
|
31
|
+
workflow = Path.setup('workflows')[Misc.camel_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
|
29
32
|
if Open.exists?(workflow)
|
30
33
|
workflow = workflow.find if Path === workflow
|
34
|
+
$LOAD_PATH.unshift(File.join(File.dirname(workflow), 'lib'))
|
31
35
|
load workflow
|
36
|
+
else
|
37
|
+
raise "Workflow #{workflow_name} not found"
|
32
38
|
end
|
33
39
|
workflows.last
|
34
40
|
end
|
35
41
|
|
36
42
|
def job(name, *args)
|
37
43
|
task = tasks[name]
|
38
|
-
task.job(*args)
|
44
|
+
step = task.job(*args)
|
45
|
+
step.extend step_module
|
46
|
+
step
|
39
47
|
end
|
40
48
|
end
|
data/lib/scout-gear.rb
CHANGED
data/lib/scout.rb
CHANGED
data/scout-gear.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: scout-gear
|
5
|
+
# stub: scout-gear 7.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-gear".freeze
|
9
|
-
s.version = "
|
9
|
+
s.version = "7.2.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Miguel Vazquez".freeze]
|
14
|
-
s.date = "2023-
|
14
|
+
s.date = "2023-05-09"
|
15
15
|
s.description = "Temporary files, logs, etc.".freeze
|
16
16
|
s.email = "mikisvaz@gmail.com".freeze
|
17
17
|
s.executables = ["scout".freeze]
|
@@ -28,10 +28,12 @@ Gem::Specification.new do |s|
|
|
28
28
|
"Rakefile",
|
29
29
|
"VERSION",
|
30
30
|
"bin/scout",
|
31
|
+
"lib/rbbt-scout.rb",
|
31
32
|
"lib/scout-gear.rb",
|
32
33
|
"lib/scout.rb",
|
33
34
|
"lib/scout/cmd.rb",
|
34
35
|
"lib/scout/concurrent_stream.rb",
|
36
|
+
"lib/scout/config.rb",
|
35
37
|
"lib/scout/exceptions.rb",
|
36
38
|
"lib/scout/indiferent_hash.rb",
|
37
39
|
"lib/scout/indiferent_hash/case_insensitive.rb",
|
@@ -50,6 +52,8 @@ Gem::Specification.new do |s|
|
|
50
52
|
"lib/scout/misc/format.rb",
|
51
53
|
"lib/scout/misc/insist.rb",
|
52
54
|
"lib/scout/misc/monitor.rb",
|
55
|
+
"lib/scout/misc/system.rb",
|
56
|
+
"lib/scout/named_array.rb",
|
53
57
|
"lib/scout/open.rb",
|
54
58
|
"lib/scout/open/lock.rb",
|
55
59
|
"lib/scout/open/remote.rb",
|
@@ -68,6 +72,7 @@ Gem::Specification.new do |s|
|
|
68
72
|
"lib/scout/resource/produce.rb",
|
69
73
|
"lib/scout/resource/produce/rake.rb",
|
70
74
|
"lib/scout/resource/scout.rb",
|
75
|
+
"lib/scout/resource/software.rb",
|
71
76
|
"lib/scout/resource/util.rb",
|
72
77
|
"lib/scout/semaphore.rb",
|
73
78
|
"lib/scout/simple_opt.rb",
|
@@ -77,6 +82,16 @@ Gem::Specification.new do |s|
|
|
77
82
|
"lib/scout/simple_opt/parse.rb",
|
78
83
|
"lib/scout/simple_opt/setup.rb",
|
79
84
|
"lib/scout/tmpfile.rb",
|
85
|
+
"lib/scout/tsv.rb",
|
86
|
+
"lib/scout/tsv/dumper.rb",
|
87
|
+
"lib/scout/tsv/index.rb",
|
88
|
+
"lib/scout/tsv/parser.rb",
|
89
|
+
"lib/scout/tsv/path.rb",
|
90
|
+
"lib/scout/tsv/persist.rb",
|
91
|
+
"lib/scout/tsv/persist/adapter.rb",
|
92
|
+
"lib/scout/tsv/persist/tokyocabinet.rb",
|
93
|
+
"lib/scout/tsv/traverse.rb",
|
94
|
+
"lib/scout/tsv/util.rb",
|
80
95
|
"lib/scout/work_queue.rb",
|
81
96
|
"lib/scout/work_queue/socket.rb",
|
82
97
|
"lib/scout/work_queue/worker.rb",
|
@@ -84,8 +99,12 @@ Gem::Specification.new do |s|
|
|
84
99
|
"lib/scout/workflow/definition.rb",
|
85
100
|
"lib/scout/workflow/documentation.rb",
|
86
101
|
"lib/scout/workflow/step.rb",
|
102
|
+
"lib/scout/workflow/step/config.rb",
|
103
|
+
"lib/scout/workflow/step/dependencies.rb",
|
104
|
+
"lib/scout/workflow/step/file.rb",
|
87
105
|
"lib/scout/workflow/step/info.rb",
|
88
106
|
"lib/scout/workflow/step/load.rb",
|
107
|
+
"lib/scout/workflow/step/provenance.rb",
|
89
108
|
"lib/scout/workflow/task.rb",
|
90
109
|
"lib/scout/workflow/task/inputs.rb",
|
91
110
|
"lib/scout/workflow/usage.rb",
|
@@ -102,6 +121,7 @@ Gem::Specification.new do |s|
|
|
102
121
|
"scout_commands/workflow/task_old",
|
103
122
|
"share/color/color_names",
|
104
123
|
"share/color/diverging_colors.hex",
|
124
|
+
"share/software/install_helpers",
|
105
125
|
"test/scout/indiferent_hash/test_case_insensitive.rb",
|
106
126
|
"test/scout/indiferent_hash/test_options.rb",
|
107
127
|
"test/scout/log/test_color.rb",
|
@@ -109,6 +129,7 @@ Gem::Specification.new do |s|
|
|
109
129
|
"test/scout/misc/test_digest.rb",
|
110
130
|
"test/scout/misc/test_filesystem.rb",
|
111
131
|
"test/scout/misc/test_insist.rb",
|
132
|
+
"test/scout/misc/test_system.rb",
|
112
133
|
"test/scout/open/test_lock.rb",
|
113
134
|
"test/scout/open/test_remote.rb",
|
114
135
|
"test/scout/open/test_stream.rb",
|
@@ -120,6 +141,7 @@ Gem::Specification.new do |s|
|
|
120
141
|
"test/scout/persist/test_serialize.rb",
|
121
142
|
"test/scout/resource/test_path.rb",
|
122
143
|
"test/scout/resource/test_produce.rb",
|
144
|
+
"test/scout/resource/test_software.rb",
|
123
145
|
"test/scout/resource/test_util.rb",
|
124
146
|
"test/scout/simple_opt/test_doc.rb",
|
125
147
|
"test/scout/simple_opt/test_get.rb",
|
@@ -127,22 +149,35 @@ Gem::Specification.new do |s|
|
|
127
149
|
"test/scout/simple_opt/test_setup.rb",
|
128
150
|
"test/scout/test_cmd.rb",
|
129
151
|
"test/scout/test_concurrent_stream.rb",
|
152
|
+
"test/scout/test_config.rb",
|
130
153
|
"test/scout/test_indiferent_hash.rb",
|
131
154
|
"test/scout/test_log.rb",
|
132
155
|
"test/scout/test_meta_extension.rb",
|
133
156
|
"test/scout/test_misc.rb",
|
157
|
+
"test/scout/test_named_array.rb",
|
134
158
|
"test/scout/test_open.rb",
|
135
159
|
"test/scout/test_path.rb",
|
136
160
|
"test/scout/test_persist.rb",
|
137
161
|
"test/scout/test_resource.rb",
|
138
162
|
"test/scout/test_semaphore.rb",
|
139
163
|
"test/scout/test_tmpfile.rb",
|
164
|
+
"test/scout/test_tsv.rb",
|
140
165
|
"test/scout/test_work_queue.rb",
|
141
166
|
"test/scout/test_workflow.rb",
|
167
|
+
"test/scout/tsv/persist/test_adapter.rb",
|
168
|
+
"test/scout/tsv/persist/test_tokyocabinet.rb",
|
169
|
+
"test/scout/tsv/test_dumper.rb",
|
170
|
+
"test/scout/tsv/test_index.rb",
|
171
|
+
"test/scout/tsv/test_parser.rb",
|
172
|
+
"test/scout/tsv/test_persist.rb",
|
173
|
+
"test/scout/tsv/test_traverse.rb",
|
174
|
+
"test/scout/tsv/test_util.rb",
|
142
175
|
"test/scout/work_queue/test_socket.rb",
|
143
176
|
"test/scout/work_queue/test_worker.rb",
|
177
|
+
"test/scout/workflow/step/test_dependencies.rb",
|
144
178
|
"test/scout/workflow/step/test_info.rb",
|
145
179
|
"test/scout/workflow/step/test_load.rb",
|
180
|
+
"test/scout/workflow/step/test_provenance.rb",
|
146
181
|
"test/scout/workflow/task/test_inputs.rb",
|
147
182
|
"test/scout/workflow/test_definition.rb",
|
148
183
|
"test/scout/workflow/test_documentation.rb",
|
data/scout_commands/find
CHANGED
@@ -69,7 +69,7 @@ end if resource
|
|
69
69
|
|
70
70
|
path = (resource || Scout)[path.dup]
|
71
71
|
|
72
|
-
if where.nil? || where == 'all' || path.
|
72
|
+
if where.nil? || where == 'all' || path.path_maps.include?(where.to_sym)
|
73
73
|
location = path.find(where)
|
74
74
|
|
75
75
|
if Array === location
|
@@ -13,6 +13,7 @@ $ #{$0} [<options>] <workflow> <task>
|
|
13
13
|
-h--help Print this help
|
14
14
|
-jn--job_name* Name to use as job identifier
|
15
15
|
-pf--print_filepath Print the file path
|
16
|
+
-prov--provenance Print the step provenance
|
16
17
|
-cl--clean Clean the last step
|
17
18
|
-rcl--recursive_clean Clean all steps
|
18
19
|
EOF
|
@@ -22,7 +23,8 @@ workflow_name, task_name = ARGV
|
|
22
23
|
raise MissingParameterException.new :workflow if workflow_name.nil?
|
23
24
|
|
24
25
|
workflow = Workflow.require_workflow workflow_name
|
25
|
-
|
26
|
+
task_name = task_name.to_sym if task_name
|
27
|
+
task = workflow.tasks[task_name.to_sym]
|
26
28
|
|
27
29
|
options[:help] = true if task.nil?
|
28
30
|
|
@@ -38,20 +40,24 @@ if options[:help]
|
|
38
40
|
end
|
39
41
|
|
40
42
|
job_options = task.get_SOPT(task)
|
41
|
-
job =
|
43
|
+
job = workflow.job(task_name, options[:job_name], job_options)
|
42
44
|
|
43
45
|
job.recursive_clean if options[:recursive_clean]
|
44
46
|
job.clean if options[:clean]
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
if options[:print_filepath]
|
49
|
-
path = job.path
|
50
|
-
path = path.find if Path === path
|
51
|
-
puts path
|
48
|
+
if options[:provenance]
|
49
|
+
puts Step.prov_report(job)
|
52
50
|
else
|
53
|
-
|
54
|
-
|
51
|
+
job.run unless job.done?
|
52
|
+
|
53
|
+
if options[:print_filepath]
|
54
|
+
path = job.path
|
55
|
+
path = path.find if Path === path
|
56
|
+
puts path
|
57
|
+
else
|
58
|
+
if ! ((c = Open.consume_stream(job.get_stream, false, STDOUT, false)) && c.end_with?("\n"))
|
59
|
+
puts
|
60
|
+
end
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|