rbbt-util 5.32.20 → 5.32.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rbbt +2 -3
- data/lib/rbbt/tsv/manipulate.rb +10 -0
- data/lib/rbbt/tsv/parser.rb +1 -1
- data/lib/rbbt/util/config.rb +6 -1
- data/lib/rbbt/workflow/accessor.rb +0 -44
- data/lib/rbbt/workflow/definition.rb +3 -2
- data/lib/rbbt/workflow/dependencies.rb +48 -2
- data/lib/rbbt/workflow/examples.rb +1 -1
- data/lib/rbbt/workflow/step/dependencies.rb +33 -1
- data/lib/rbbt/workflow/step.rb +4 -32
- data/lib/rbbt/workflow/util/data.rb +141 -11
- data/lib/rbbt/workflow.rb +20 -14
- data/share/rbbt_commands/workflow/task +5 -3
- data/test/rbbt/workflow/util/test_data.rb +21 -2
- 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: 7a7eebab331a8908a290e4a3ad8db2ee3dc3c3dec07b93ec1c74f504f9f7ea29
|
4
|
+
data.tar.gz: 0f9a2ce6019676118ab439dea57f16605555d9ef850c35998704b9215c477ffb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d81532c2babaae631ca98784e7b7e36039fed68544b6bce9fc8fc2d74a155ffd98fe0752477c7ad245aaa0c65e82c47f330f65c5d70a7f5f20a77de4bc4dbd6
|
7
|
+
data.tar.gz: 2914786ec23349cabccbb6e8a1c561336b60dd5d862e89c3a95802f040c66f8107d5a2135455f00d8bc7b9e06e390fd6462a861419b78ae25bf3a58c14a33350
|
data/bin/rbbt
CHANGED
@@ -262,9 +262,8 @@ rescue ParameterException
|
|
262
262
|
puts
|
263
263
|
exit_status = -1
|
264
264
|
exit exit_status
|
265
|
-
rescue SystemExit
|
266
|
-
|
267
|
-
exit_status = $!.exit_status
|
265
|
+
rescue SystemExit,CmdStop
|
266
|
+
exit_status = $!.status
|
268
267
|
exit exit_status
|
269
268
|
rescue Exception
|
270
269
|
Log.exception $!
|
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -356,6 +356,16 @@ module TSV
|
|
356
356
|
elems.sort_by{|k,v| v}.collect{|k,v| k}
|
357
357
|
end
|
358
358
|
|
359
|
+
def subset(keys)
|
360
|
+
new = TSV.setup({}, :key_field => key_field, :fields => fields, :type => type, :filename => filename, :identifiers => identifiers)
|
361
|
+
self.with_unnamed do
|
362
|
+
keys.each do |k|
|
363
|
+
new[k] = self[k]
|
364
|
+
end
|
365
|
+
end
|
366
|
+
new
|
367
|
+
end
|
368
|
+
|
359
369
|
def select(method = nil, invert = false, &block)
|
360
370
|
new = TSV.setup({}, :key_field => key_field, :fields => fields, :type => type, :filename => filename, :identifiers => identifiers)
|
361
371
|
|
data/lib/rbbt/tsv/parser.rb
CHANGED
data/lib/rbbt/util/config.rb
CHANGED
@@ -122,7 +122,12 @@ module Rbbt::Config
|
|
122
122
|
Log.debug "Value #{value.inspect} for config key '#{ key }': #{tokens * ", "}"
|
123
123
|
GOT_KEYS << [key, value, tokens]
|
124
124
|
|
125
|
-
value
|
125
|
+
if String === value && m = value.match(/^env:(.*)/)
|
126
|
+
variable = m.captures.first
|
127
|
+
ENV[variable]
|
128
|
+
else
|
129
|
+
value
|
130
|
+
end
|
126
131
|
end
|
127
132
|
|
128
133
|
def self.with_config
|
@@ -172,50 +172,6 @@ module Workflow
|
|
172
172
|
}.tap{|h| IndiferentHash.setup(h)}
|
173
173
|
end
|
174
174
|
|
175
|
-
def assign_dep_inputs(_inputs, options, all_d, task_info)
|
176
|
-
IndiferentHash.setup(_inputs)
|
177
|
-
|
178
|
-
options.each{|i,v|
|
179
|
-
next if i == :compute or i == "compute"
|
180
|
-
case v
|
181
|
-
when :compute
|
182
|
-
compute = v
|
183
|
-
when Symbol
|
184
|
-
rec_dependency = all_d.flatten.select{|d| d.task_name.to_sym == v }.first
|
185
|
-
|
186
|
-
if rec_dependency.nil?
|
187
|
-
if _inputs.include?(v)
|
188
|
-
#_inputs[i] = _inputs.delete(v)
|
189
|
-
_inputs[i] = _inputs[v] unless _inputs.include? i #_inputs.delete(v)
|
190
|
-
else
|
191
|
-
_inputs[i] = v unless _inputs.include? i
|
192
|
-
end
|
193
|
-
else
|
194
|
-
input_options = task_info[:input_options][i] || {}
|
195
|
-
|
196
|
-
#ToDo why was this always true?
|
197
|
-
if input_options[:stream] or true
|
198
|
-
#rec_dependency.run(true).grace unless rec_dependency.done? or rec_dependency.running?
|
199
|
-
_inputs[i] = rec_dependency
|
200
|
-
else
|
201
|
-
rec_dependency.abort if rec_dependency.streaming? and not rec_dependency.running?
|
202
|
-
rec_dependency.clean if rec_dependency.error? or rec_dependency.aborted?
|
203
|
-
if rec_dependency.streaming? and rec_dependency.running?
|
204
|
-
_inputs[i] = rec_dependency.join.load
|
205
|
-
else
|
206
|
-
rec_dependency.run(true)
|
207
|
-
rec_dependency.join
|
208
|
-
_inputs[i] = rec_dependency.load
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
else
|
213
|
-
_inputs[i] = v
|
214
|
-
end
|
215
|
-
} if options
|
216
|
-
|
217
|
-
_inputs
|
218
|
-
end
|
219
175
|
|
220
176
|
def task_from_dep(dep)
|
221
177
|
task = case dep
|
@@ -98,11 +98,12 @@ module Workflow
|
|
98
98
|
when 'true'
|
99
99
|
dep.clean
|
100
100
|
when 'recursive'
|
101
|
-
dep.rec_dependencies.each do |d|
|
101
|
+
(dep.dependencies + dep.rec_dependencies).uniq.each do |d|
|
102
|
+
next if d.overriden
|
102
103
|
d.clean unless config(:remove_dep, d.task_signature, d.task_name, d.workflow.to_s, :default => true).to_s == 'false'
|
103
104
|
end
|
104
105
|
dep.clean unless config(:remove_dep, dep.task_signature, dep.task_name, dep.workflow.to_s, :default => true).to_s == 'false'
|
105
|
-
end
|
106
|
+
end unless dep.overriden
|
106
107
|
else
|
107
108
|
if Open.exists?(dep.files_dir)
|
108
109
|
Open.rm_rf self.files_dir
|
@@ -71,7 +71,7 @@ module Workflow
|
|
71
71
|
|
72
72
|
def setup_override_dependency(dep, workflow, task_name)
|
73
73
|
return [] if dep == :skip || dep == 'skip'
|
74
|
-
dep = Step === dep ? dep : Workflow.load_step(dep)
|
74
|
+
dep = Step === dep ? dep.dup : Workflow.load_step(dep)
|
75
75
|
dep.workflow = workflow
|
76
76
|
dep.info[:name] = dep.name
|
77
77
|
dep.original_task_name ||= dep.task_name if dep.workflow
|
@@ -83,14 +83,60 @@ module Workflow
|
|
83
83
|
rescue
|
84
84
|
Log.exception $!
|
85
85
|
end
|
86
|
+
|
86
87
|
dep.task_name = task_name
|
87
|
-
dep.overriden = dep.original_task_name.to_sym
|
88
|
+
dep.overriden = dep.original_task_name.to_sym if dep.original_task_name
|
88
89
|
|
89
90
|
dep.extend step_module
|
90
91
|
|
91
92
|
dep
|
92
93
|
end
|
93
94
|
|
95
|
+
def assign_dep_inputs(_inputs, options, all_d, task_info)
|
96
|
+
IndiferentHash.setup(_inputs)
|
97
|
+
|
98
|
+
options.each{|i,v|
|
99
|
+
next if i == :compute or i == "compute"
|
100
|
+
case v
|
101
|
+
when :compute
|
102
|
+
compute = v
|
103
|
+
when Symbol
|
104
|
+
rec_dependency = all_d.flatten.select{|d| d.task_name.to_sym == v }.first
|
105
|
+
|
106
|
+
if rec_dependency.nil?
|
107
|
+
if _inputs.include?(v)
|
108
|
+
#_inputs[i] = _inputs.delete(v)
|
109
|
+
_inputs[i] = _inputs[v] unless _inputs.include? i #_inputs.delete(v)
|
110
|
+
else
|
111
|
+
_inputs[i] = v unless _inputs.include? i
|
112
|
+
end
|
113
|
+
else
|
114
|
+
input_options = task_info[:input_options][i] || {}
|
115
|
+
|
116
|
+
#ToDo why was this always true?
|
117
|
+
if input_options[:stream] or true
|
118
|
+
#rec_dependency.run(true).grace unless rec_dependency.done? or rec_dependency.running?
|
119
|
+
_inputs[i] = rec_dependency
|
120
|
+
else
|
121
|
+
rec_dependency.abort if rec_dependency.streaming? and not rec_dependency.running?
|
122
|
+
rec_dependency.clean if rec_dependency.error? or rec_dependency.aborted?
|
123
|
+
if rec_dependency.streaming? and rec_dependency.running?
|
124
|
+
_inputs[i] = rec_dependency.join.load
|
125
|
+
else
|
126
|
+
rec_dependency.run(true)
|
127
|
+
rec_dependency.join
|
128
|
+
_inputs[i] = rec_dependency.load
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
else
|
133
|
+
_inputs[i] = v
|
134
|
+
end
|
135
|
+
} if options
|
136
|
+
|
137
|
+
_inputs
|
138
|
+
end
|
139
|
+
|
94
140
|
def real_dependencies(task, orig_jobname, inputs, dependencies)
|
95
141
|
real_dependencies = []
|
96
142
|
path_deps = {}
|
@@ -206,7 +206,7 @@ class Step
|
|
206
206
|
if dup and step.streaming? and not step.result.nil?
|
207
207
|
if dep_step[step.path] and dep_step[step.path].length > 1
|
208
208
|
stream = step.result
|
209
|
-
other_steps = dep_step[step.path].uniq
|
209
|
+
other_steps = dep_step[step.path].uniq.reject{|d| d.overriden }
|
210
210
|
return unless other_steps.length > 1
|
211
211
|
log_dependency_exec(step, "duplicating #{other_steps.length}")
|
212
212
|
copies = Misc.tee_stream_thread_multiple(stream, other_steps.length)
|
@@ -523,4 +523,36 @@ class Step
|
|
523
523
|
set_info :dependencies, dependencies.collect{|dep| [dep.task_name, dep.name, dep.path]} if dependencies
|
524
524
|
end
|
525
525
|
|
526
|
+
#connected = true means that dependency searching ends when a result is done
|
527
|
+
#but dependencies are absent, meanining that the file could have been dropped
|
528
|
+
#in
|
529
|
+
def rec_dependencies(connected = false, seen = [])
|
530
|
+
|
531
|
+
# A step result with no info_file means that it was manually
|
532
|
+
# placed. In that case, do not consider its dependencies
|
533
|
+
return [] if ! (defined? WorkflowRemoteClient && WorkflowRemoteClient::RemoteStep === self) && ! Open.exists?(self.info_file) && Open.exists?(self.path.to_s)
|
534
|
+
|
535
|
+
return [] if dependencies.nil? or dependencies.empty?
|
536
|
+
|
537
|
+
new_dependencies = []
|
538
|
+
if self.overriden?
|
539
|
+
archived_deps = []
|
540
|
+
else
|
541
|
+
archived_deps = self.info[:archived_info] ? self.info[:archived_info].keys : []
|
542
|
+
end
|
543
|
+
|
544
|
+
dependencies.each{|step|
|
545
|
+
#next if self.done? && Open.exists?(info_file) && info[:dependencies] && info[:dependencies].select{|task,name,path| path == step.path }.empty?
|
546
|
+
next if archived_deps.include? step.path
|
547
|
+
next if seen.include? step.path
|
548
|
+
next if self.done? && connected && ! updatable?
|
549
|
+
|
550
|
+
r = step.rec_dependencies(connected, new_dependencies.collect{|d| d.path})
|
551
|
+
new_dependencies.concat r
|
552
|
+
new_dependencies << step
|
553
|
+
}
|
554
|
+
|
555
|
+
new_dependencies.uniq
|
556
|
+
end
|
557
|
+
|
526
558
|
end
|
data/lib/rbbt/workflow/step.rb
CHANGED
@@ -179,6 +179,10 @@ class Step
|
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
182
|
+
def result_type=(type)
|
183
|
+
@result_type = type
|
184
|
+
end
|
185
|
+
|
182
186
|
def result_description
|
183
187
|
@result_description ||= if @task.nil?
|
184
188
|
info[:result_description]
|
@@ -351,38 +355,6 @@ class Step
|
|
351
355
|
end
|
352
356
|
end
|
353
357
|
|
354
|
-
#connected = true means that dependency searching ends when a result is done
|
355
|
-
#but dependencies are absent, meanining that the file could have been dropped
|
356
|
-
#in
|
357
|
-
def rec_dependencies(connected = false, seen = [])
|
358
|
-
|
359
|
-
# A step result with no info_file means that it was manually
|
360
|
-
# placed. In that case, do not consider its dependencies
|
361
|
-
return [] if ! (defined? WorkflowRemoteClient && WorkflowRemoteClient::RemoteStep === self) && ! Open.exists?(self.info_file) && Open.exists?(self.path.to_s)
|
362
|
-
|
363
|
-
return [] if dependencies.nil? or dependencies.empty?
|
364
|
-
|
365
|
-
new_dependencies = []
|
366
|
-
if self.overriden?
|
367
|
-
archived_deps = []
|
368
|
-
else
|
369
|
-
archived_deps = self.info[:archived_info] ? self.info[:archived_info].keys : []
|
370
|
-
end
|
371
|
-
|
372
|
-
dependencies.each{|step|
|
373
|
-
#next if self.done? && Open.exists?(info_file) && info[:dependencies] && info[:dependencies].select{|task,name,path| path == step.path }.empty?
|
374
|
-
next if archived_deps.include? step.path
|
375
|
-
next if seen.include? step.path
|
376
|
-
next if self.done? && connected && ! updatable?
|
377
|
-
|
378
|
-
r = step.rec_dependencies(connected, new_dependencies.collect{|d| d.path})
|
379
|
-
new_dependencies.concat r
|
380
|
-
new_dependencies << step
|
381
|
-
}
|
382
|
-
|
383
|
-
new_dependencies.uniq
|
384
|
-
end
|
385
|
-
|
386
358
|
def writable?
|
387
359
|
Open.writable?(self.path) && Open.writable?(self.info_file)
|
388
360
|
end
|
@@ -3,13 +3,15 @@ require 'rbbt/workflow/examples'
|
|
3
3
|
|
4
4
|
module Workflow
|
5
5
|
module Data
|
6
|
-
|
6
|
+
class DataNotFound < RbbtException; end
|
7
|
+
|
8
|
+
def data_dir(directory)
|
7
9
|
@@data_directory = directory
|
8
10
|
end
|
9
11
|
|
10
12
|
def get_datadir(clean_name)
|
11
13
|
data_dir = File.join(@@data_directory, clean_name)
|
12
|
-
raise "Data dir not found #{
|
14
|
+
raise DataNotFound, "Data dir not found for #{clean_name} in #{@@data_directory}" unless File.directory?(data_dir)
|
13
15
|
if Path === @@data_directory
|
14
16
|
@@data_directory.annotate data_dir
|
15
17
|
else
|
@@ -17,19 +19,147 @@ module Workflow
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
22
|
+
def get_file(clean_name, type = nil, extension = nil)
|
23
|
+
begin
|
24
|
+
extension = nil if String === extension && extension.empty?
|
25
|
+
file1 = File.join(@@data_directory, type.to_s, (extension.nil? ? clean_name.to_s : clean_name.to_s + ".#{extension}"))
|
26
|
+
file2 = File.join(@@data_directory, clean_name.to_s, (extension.nil? ? type.to_s : type.to_s + ".#{extension}"))
|
27
|
+
if Open.exists?(file1)
|
28
|
+
data_file = file1
|
29
|
+
elsif Open.exists?(file2)
|
30
|
+
data_file = file2
|
31
|
+
else
|
32
|
+
raise DataNotFound, "Data type #{type} not found for #{clean_name} in #{@@data_directory}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
if Path === @@data_directory
|
37
|
+
@@data_directory.annotate data_file
|
38
|
+
else
|
39
|
+
Path.setup(data_file)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
20
43
|
def data_task(name, workflow, oname, *rest, &block)
|
21
|
-
dep_task(name, workflow, oname, *rest) do |jobname, options|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
44
|
+
dep_task(name, workflow, oname, *rest) do |jobname, options,dependencies|
|
45
|
+
begin
|
46
|
+
task_info = workflow.nil? ? nil : workflow.task_info(oname)
|
47
|
+
options[:extension] ||= task_info[:extension]
|
48
|
+
path = get_file jobname, name, options[:extension]
|
49
|
+
job = Step.new path
|
50
|
+
job.task_name = name
|
51
|
+
job.result_type = options[:result_type] || options[:type] || options[:extension]
|
52
|
+
job
|
53
|
+
rescue DataNotFound
|
54
|
+
end
|
55
|
+
|
56
|
+
next job if job
|
57
|
+
|
58
|
+
data_options = {}
|
59
|
+
data_options = data_options.merge(Workflow.load_inputs(File.join(@@data_directory,"options"), task_info[:inputs], task_info[:input_types]))
|
60
|
+
|
61
|
+
begin
|
62
|
+
data_options = data_options.merge(Workflow.load_inputs(get_file(jobname, :options), task_info[:inputs], task_info[:input_types]))
|
63
|
+
rescue DataNotFound
|
64
|
+
end
|
65
|
+
|
66
|
+
begin
|
67
|
+
data_options = data_options.merge(Workflow.load_inputs(get_datadir(jobname).options, task_info[:inputs], task_info[:input_types]))
|
68
|
+
rescue DataNotFound
|
69
|
+
end
|
70
|
+
|
71
|
+
begin
|
72
|
+
task_info = workflow.nil? ? nil : workflow.task_info(oname)
|
73
|
+
data_options = block.call get_datadir(jobname), data_options, task_info
|
74
|
+
rescue
|
75
|
+
Log.exception $!
|
76
|
+
end if block_given?
|
77
|
+
|
78
|
+
case data_options
|
79
|
+
when Step
|
80
|
+
next data_options
|
81
|
+
when Hash
|
82
|
+
if data_options.include?(:inputs)
|
83
|
+
data_options = data_options.merge(options)
|
84
|
+
workflow = data_options[:workflow] if data_options[:workflow]
|
85
|
+
oname = data_options[:task] if data_options[:task]
|
86
|
+
inputs = options.merge(data_options[:inputs])
|
87
|
+
else
|
88
|
+
inputs = options.merge(data_options)
|
89
|
+
end
|
90
|
+
|
91
|
+
{:workflow => workflow, :task => oname, :jobname => jobname, :inputs => inputs}
|
28
92
|
else
|
29
|
-
|
93
|
+
raise "Cannot understand data_options: #{data_options}"
|
30
94
|
end
|
95
|
+
|
31
96
|
end
|
32
97
|
end
|
33
|
-
end
|
34
98
|
|
99
|
+
def data(name, options = {}, &block)
|
100
|
+
dep do |jobname, job_options, dependencies|
|
101
|
+
if block_given?
|
102
|
+
block.call jobname, job_options.merge(options), dependencies
|
103
|
+
else
|
104
|
+
begin
|
105
|
+
path = get_file jobname, name, options[:extension]
|
106
|
+
job = Step.new path
|
107
|
+
job.task_name = name
|
108
|
+
job.result_type = options[:result_type] || options[:type] || options[:extension]
|
109
|
+
job
|
110
|
+
rescue DataNotFound
|
111
|
+
{:task => name, :options => options, :jobname => jobname}
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
35
117
|
end
|
118
|
+
#module Workflow
|
119
|
+
# module Data
|
120
|
+
# def data(directory)
|
121
|
+
# @@data_directory = directory
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# def get_datadir(clean_name)
|
125
|
+
# data_dir = File.join(@@data_directory, clean_name)
|
126
|
+
# raise "Data dir not found #{data_dir}" unless File.directory?(data_dir)
|
127
|
+
# if Path === @@data_directory
|
128
|
+
# @@data_directory.annotate data_dir
|
129
|
+
# else
|
130
|
+
# Path.setup(data_dir)
|
131
|
+
# end
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# def data_task(name, workflow, oname, *rest, &block)
|
135
|
+
# dep_task(name, workflow, oname, *rest) do |jobname, options|
|
136
|
+
# data_dir = self.get_datadir(jobname)
|
137
|
+
# task_info = workflow.task_info(oname)
|
138
|
+
#
|
139
|
+
# dir_options = Workflow.load_inputs(data_dir.options, task_info[:inputs], task_info[:input_types])
|
140
|
+
# data_options = block.call data_dir, dir_options, task_info
|
141
|
+
#
|
142
|
+
# case data_options
|
143
|
+
# when Step
|
144
|
+
# job = data_options
|
145
|
+
# when Hash
|
146
|
+
# if data_options.include?(:inputs)
|
147
|
+
# data_options = data_options.merge(options)
|
148
|
+
# workflow = data_options[:workflow] if data_options[:workflow]
|
149
|
+
# oname = data_options[:task] if data_options[:task]
|
150
|
+
# inputs = options.merge(data_options[:inputs])
|
151
|
+
# else
|
152
|
+
# inputs = options.merge(data_options)
|
153
|
+
# end
|
154
|
+
#
|
155
|
+
# job = workflow.job(oname, jobname, inputs)
|
156
|
+
# else
|
157
|
+
# raise "Cannot understand data_options: #{data_options}"
|
158
|
+
# end
|
159
|
+
#
|
160
|
+
# job
|
161
|
+
# end
|
162
|
+
# end
|
163
|
+
# end
|
164
|
+
#
|
165
|
+
#end
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -45,14 +45,10 @@ module Workflow
|
|
45
45
|
load_remote_tasks(Rbbt.root.etc.remote_tasks.find) if Rbbt.root.etc.remote_tasks.exists?
|
46
46
|
end
|
47
47
|
|
48
|
-
def self.require_remote_workflow(wf_name, url)
|
49
|
-
require 'rbbt/workflow/remote_workflow'
|
50
|
-
eval "Object::#{wf_name} = RemoteWorkflow.new '#{ url }', '#{wf_name}'"
|
51
|
-
end
|
52
48
|
|
53
49
|
def self.require_remote_workflow(wf_name, url)
|
54
50
|
require 'rbbt/workflow/remote_workflow'
|
55
|
-
eval "Object::#{wf_name} = RemoteWorkflow.new '#{ url }', '#{wf_name}'"
|
51
|
+
eval "Object::#{wf_name.split("+").first} = RemoteWorkflow.new '#{ url }', '#{wf_name}'"
|
56
52
|
end
|
57
53
|
|
58
54
|
def self.load_workflow_libdir(filename)
|
@@ -134,9 +130,10 @@ module Workflow
|
|
134
130
|
end
|
135
131
|
|
136
132
|
def self.require_local_workflow(wf_name)
|
133
|
+
|
137
134
|
filename = local_workflow_filename(wf_name)
|
138
135
|
|
139
|
-
if filename and File.exist?
|
136
|
+
if filename and File.exist?(filename)
|
140
137
|
load_workflow_file filename
|
141
138
|
else
|
142
139
|
return false
|
@@ -194,14 +191,23 @@ module Workflow
|
|
194
191
|
end
|
195
192
|
|
196
193
|
Log.high{"Loading workflow #{wf_name}"}
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
194
|
+
|
195
|
+
first = nil
|
196
|
+
wf_name.split("+").each do |wf_name|
|
197
|
+
require_local_workflow(wf_name) or
|
198
|
+
(Workflow.autoinstall and `rbbt workflow install #{Misc.snake_case(wf_name)} || rbbt workflow install #{wf_name}` and require_local_workflow(wf_name)) or raise("Workflow not found or could not be loaded: #{ wf_name }")
|
199
|
+
|
200
|
+
workflow = begin
|
201
|
+
Misc.string2const Misc.camel_case(wf_name.split("+").first)
|
202
|
+
rescue
|
203
|
+
Workflow.workflows.last || true
|
204
|
+
end
|
205
|
+
workflow.load_documentation
|
206
|
+
|
207
|
+
first ||= workflow
|
208
|
+
end
|
209
|
+
return first
|
210
|
+
|
205
211
|
workflow
|
206
212
|
end
|
207
213
|
|
@@ -287,8 +287,8 @@ else
|
|
287
287
|
puts
|
288
288
|
puts $!.message
|
289
289
|
puts
|
290
|
-
|
291
|
-
exit
|
290
|
+
|
291
|
+
exit -1
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
@@ -572,7 +572,9 @@ when Step
|
|
572
572
|
exit! 0
|
573
573
|
else
|
574
574
|
res.join
|
575
|
-
|
575
|
+
Open.open(res.path, :mode => 'rb') do |io|
|
576
|
+
Misc.consume_stream(io, false, out)
|
577
|
+
end if Open.exist?(res.path) || Open.remote?(res.path) || Open.ssh?(res.path)
|
576
578
|
end
|
577
579
|
else
|
578
580
|
if Array === res
|
@@ -1,6 +1,16 @@
|
|
1
1
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
|
2
2
|
require 'rbbt/workflow/util/data'
|
3
3
|
|
4
|
+
module TestDataWF2
|
5
|
+
extend Workflow
|
6
|
+
extend Workflow::Data
|
7
|
+
|
8
|
+
input :salutation, :string
|
9
|
+
task :salute_antonio => :string do |name,salutation|
|
10
|
+
"Hi Antonio: #{salutation}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
4
14
|
module TestDataWF
|
5
15
|
extend Workflow
|
6
16
|
extend Workflow::Data
|
@@ -23,6 +33,11 @@ module TestDataWF
|
|
23
33
|
data_task :salute_data2, TestDataWF, :salute, :salutation => :placeholder do |directory,options|
|
24
34
|
{:task => :salute_luis, :inputs => options.merge({:salutation => directory.salutation.read})}
|
25
35
|
end
|
36
|
+
|
37
|
+
data_task :salute_data3, TestDataWF, :salute, :salutation => :placeholder do |directory,options|
|
38
|
+
{:task => :salute_antonio, :workflow => TestDataWF2, :inputs => options.merge({:salutation => directory.salutation.read})}
|
39
|
+
end
|
40
|
+
|
26
41
|
end
|
27
42
|
|
28
43
|
class TestWorkflowData < Test::Unit::TestCase
|
@@ -33,15 +48,19 @@ class TestWorkflowData < Test::Unit::TestCase
|
|
33
48
|
Open.write(tmpdir.TestDir.options.name, "Miguel")
|
34
49
|
Open.write(tmpdir.TestDir.salutation, "My salutations")
|
35
50
|
|
36
|
-
TestDataWF.
|
51
|
+
TestDataWF.data_dir tmpdir
|
37
52
|
|
38
53
|
job = TestDataWF.job(:salute_data, "TestDir")
|
39
54
|
job.recursive_clean.run
|
40
55
|
assert job.run.include? "Miguel"
|
41
56
|
|
42
57
|
job = TestDataWF.job(:salute_data2, "TestDir")
|
43
|
-
job.recursive_clean.run
|
58
|
+
puts job.recursive_clean.run
|
44
59
|
assert job.run.include? "Luis"
|
60
|
+
|
61
|
+
job = TestDataWF.job(:salute_data3, "TestDir")
|
62
|
+
job.recursive_clean.run
|
63
|
+
assert job.run.include? "Antonio"
|
45
64
|
end
|
46
65
|
end
|
47
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.32.
|
4
|
+
version: 5.32.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|