rbbt-util 5.37.16 → 5.38.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/lib/rbbt/annotations.rb +2 -0
- data/lib/rbbt/hpc/batch.rb +15 -6
- data/lib/rbbt/hpc/orchestrate.rb +1 -0
- data/lib/rbbt/persist.rb +2 -2
- data/lib/rbbt/resource/path.rb +1 -0
- data/lib/rbbt/resource/rake.rb +1 -1
- data/lib/rbbt/resource.rb +7 -2
- data/lib/rbbt/tsv/excel.rb +5 -1
- data/lib/rbbt/tsv/parser.rb +2 -2
- data/lib/rbbt/util/misc/development.rb +6 -1
- data/lib/rbbt/util/misc/exceptions.rb +10 -0
- data/lib/rbbt/util/misc/format.rb +3 -0
- data/lib/rbbt/util/misc/indiferent_hash.rb +9 -6
- data/lib/rbbt/util/misc/inspect.rb +22 -8
- data/lib/rbbt/util/misc/options.rb +1 -1
- data/lib/rbbt/util/misc/pipes.rb +3 -3
- data/lib/rbbt/util/open.rb +0 -1
- data/lib/rbbt/util/ssh.rb +107 -14
- data/lib/rbbt/workflow/remote_workflow/driver/ssh.rb +75 -15
- data/lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb +16 -7
- data/lib/rbbt/workflow/remote_workflow/remote_step.rb +1 -0
- data/lib/rbbt/workflow/step/dependencies.rb +6 -5
- data/lib/rbbt/workflow/step/info.rb +1 -1
- data/lib/rbbt/workflow/step/run.rb +1 -1
- data/lib/rbbt/workflow/step/save_load_inputs.rb +9 -8
- data/lib/rbbt/workflow/step.rb +7 -2
- data/lib/rbbt/workflow/usage.rb +3 -3
- data/lib/rbbt/workflow.rb +1 -1
- data/share/rbbt_commands/hpc/list +293 -293
- data/share/rbbt_commands/lsf/list +293 -293
- data/share/rbbt_commands/resource/find +2 -1
- data/share/rbbt_commands/resource/glob +1 -1
- data/share/rbbt_commands/slurm/list +293 -293
- data/share/rbbt_commands/workflow/task +63 -21
- data/test/rbbt/test_resource.rb +7 -2
- data/test/rbbt/tsv/test_accessor.rb +21 -4
- data/test/rbbt/tsv/test_parser.rb +28 -0
- data/test/rbbt/util/misc/test_indiferent_hash.rb +14 -0
- data/test/rbbt/util/test_cmd.rb +7 -1
- data/test/rbbt/util/test_open.rb +3 -3
- data/test/rbbt/util/test_ssh.rb +10 -0
- metadata +7 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
class RemoteStep
|
2
2
|
module SSH
|
3
|
-
attr_accessor :override_dependencies, :run_type, :slurm_options
|
3
|
+
attr_accessor :override_dependencies, :run_type, :slurm_options, :produce_dependencies
|
4
4
|
|
5
5
|
def init_job(cache_type = nil, other_params = {})
|
6
6
|
return self if @url
|
@@ -52,11 +52,12 @@ class RemoteStep
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def _run
|
55
|
-
RemoteWorkflow::SSH.upload_dependencies(self, @server)
|
55
|
+
RemoteWorkflow::SSH.upload_dependencies(self, @server, 'user', @produce_dependencies)
|
56
56
|
RemoteWorkflow::SSH.run_job(File.join(base_url, task.to_s), @input_id, @base_name)
|
57
57
|
end
|
58
58
|
|
59
59
|
def _run_slurm
|
60
|
+
RemoteWorkflow::SSH.upload_dependencies(self, @server, 'user', @produce_dependencies)
|
60
61
|
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, @slurm_options || {})
|
61
62
|
end
|
62
63
|
|
@@ -64,7 +65,7 @@ class RemoteStep
|
|
64
65
|
RemoteWorkflow::SSH.orchestrate_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, @slurm_options || {})
|
65
66
|
end
|
66
67
|
|
67
|
-
def
|
68
|
+
def issue
|
68
69
|
input_types = {}
|
69
70
|
init_job
|
70
71
|
@remote_path = case @run_type
|
@@ -76,6 +77,10 @@ class RemoteStep
|
|
76
77
|
_orchestrate_slurm
|
77
78
|
end
|
78
79
|
@started = true
|
80
|
+
end
|
81
|
+
|
82
|
+
def produce(*args)
|
83
|
+
issue
|
79
84
|
while ! (done? || error? || aborted?)
|
80
85
|
sleep 1
|
81
86
|
end
|
@@ -87,9 +92,13 @@ class RemoteStep
|
|
87
92
|
load_res Open.open(path)
|
88
93
|
end
|
89
94
|
|
90
|
-
def run(
|
91
|
-
|
92
|
-
|
95
|
+
def run(stream = nil)
|
96
|
+
if stream
|
97
|
+
issue
|
98
|
+
else
|
99
|
+
produce
|
100
|
+
self.load unless args.first
|
101
|
+
end
|
93
102
|
end
|
94
103
|
|
95
104
|
def clean
|
@@ -107,7 +116,7 @@ class RemoteStep
|
|
107
116
|
select{|i| Step === i || (defined?(RemoteStep) && RemoteStep === i) } +
|
108
117
|
inputs.values.flatten.
|
109
118
|
select{|dep| Path === dep && Step === dep.resource }.
|
110
|
-
select{|dep| ! dep.resource.started? }. # Ignore input_deps already started
|
119
|
+
#select{|dep| ! dep.resource.started? }. # Ignore input_deps already started
|
111
120
|
collect{|dep| dep.resource }
|
112
121
|
end
|
113
122
|
end
|
@@ -107,7 +107,7 @@ class Step
|
|
107
107
|
canfail = ComputeDependency === job && job.canfail?
|
108
108
|
end
|
109
109
|
|
110
|
-
raise_dependency_error(job) if job.error? and not canfail
|
110
|
+
Step.raise_dependency_error(job) if job.error? and not canfail
|
111
111
|
end
|
112
112
|
|
113
113
|
def self.raise_dependency_error(job)
|
@@ -149,7 +149,7 @@ class Step
|
|
149
149
|
select{|i| Step === i || (defined?(RemoteStep) && RemoteStep === i) } +
|
150
150
|
recursive_inputs.flatten.
|
151
151
|
select{|dep| Path === dep && Step === dep.resource }.
|
152
|
-
select{|dep| ! dep.resource.started? }. # Ignore input_deps already started
|
152
|
+
#select{|dep| ! dep.resource.started? }. # Ignore input_deps already started
|
153
153
|
collect{|dep| dep.resource }
|
154
154
|
end
|
155
155
|
|
@@ -193,7 +193,7 @@ class Step
|
|
193
193
|
|
194
194
|
if dependency.error?
|
195
195
|
log_dependency_exec(dependency, :error)
|
196
|
-
raise_dependency_error dependency
|
196
|
+
Step.raise_dependency_error dependency
|
197
197
|
end
|
198
198
|
|
199
199
|
if dependency.streaming?
|
@@ -382,7 +382,7 @@ class Step
|
|
382
382
|
|
383
383
|
def run_dependencies
|
384
384
|
|
385
|
-
rec_dependencies = self.rec_dependencies(true) + input_dependencies
|
385
|
+
rec_dependencies = self.rec_dependencies(true) + input_dependencies.reject{|d| d.started? }
|
386
386
|
|
387
387
|
return if rec_dependencies.empty?
|
388
388
|
|
@@ -402,7 +402,7 @@ class Step
|
|
402
402
|
seen_paths << step.path
|
403
403
|
|
404
404
|
begin
|
405
|
-
Step.prepare_for_execution(step) unless step == self
|
405
|
+
Step.prepare_for_execution(step) unless step == self
|
406
406
|
rescue DependencyError, DependencyRbbtException
|
407
407
|
raise $! unless canfail_paths.include? step.path
|
408
408
|
end
|
@@ -423,6 +423,7 @@ class Step
|
|
423
423
|
|
424
424
|
produced = []
|
425
425
|
(dependencies + input_dependencies).each do |dep|
|
426
|
+
next if dep.started?
|
426
427
|
next unless ComputeDependency === dep
|
427
428
|
if dep.compute == :produce
|
428
429
|
dep.produce
|
@@ -247,7 +247,7 @@ class Step
|
|
247
247
|
@exec = false
|
248
248
|
init_info(true)
|
249
249
|
|
250
|
-
workflow = @workflow || @task.respond_to?(:workflow) ? @task.workflow : nil
|
250
|
+
#workflow = @workflow || @task.respond_to?(:workflow) ? @task.workflow : nil
|
251
251
|
result_type = @task.respond_to?(:result_type) ? @task.result_type : nil
|
252
252
|
result_description = @task.respond_to?(:result_description) ? @task.result_description : nil
|
253
253
|
|
@@ -49,9 +49,9 @@ module Workflow
|
|
49
49
|
when :nofile
|
50
50
|
inputs[input.to_sym] = Open.realpath(file)
|
51
51
|
when :path_array
|
52
|
-
inputs[input.to_sym] = Open.read(file).strip.split("\n")
|
52
|
+
inputs[input.to_sym] = Open.read(file).strip.split("\n").collect{|p| Path.setup(p) }
|
53
53
|
when :path
|
54
|
-
inputs[input.to_sym] = Open.read(file).strip.split("\n").first
|
54
|
+
inputs[input.to_sym] = Path.setup(Open.read(file).strip.split("\n").first)
|
55
55
|
when :io
|
56
56
|
inputs[input.to_sym] = Open.open(Open.realpath(file))
|
57
57
|
when :io_array
|
@@ -67,9 +67,9 @@ module Workflow
|
|
67
67
|
inputs[input.to_sym] = steps.first
|
68
68
|
when :step_file
|
69
69
|
path = Open.read(file).strip
|
70
|
-
path.
|
71
|
-
|
72
|
-
path
|
70
|
+
step_path, relative = path.match(/(.*)\.files\/(.*)/).values_at 1, 2
|
71
|
+
step = Step.new Path.setup(step_path).find
|
72
|
+
path = step.file(relative)
|
73
73
|
inputs[input.to_sym] = path
|
74
74
|
when :step_file_array
|
75
75
|
paths = Open.read(file).split("\n")
|
@@ -149,12 +149,14 @@ class Step
|
|
149
149
|
case value
|
150
150
|
when Path
|
151
151
|
if Step === value.resource
|
152
|
+
step = value.resource
|
153
|
+
value = File.join('var/jobs', step.workflow.to_s, step.short_path + '.files', Misc.path_relative_to(step.files_dir, value))
|
152
154
|
path = path + '.as_step_file'
|
153
155
|
else
|
154
156
|
path = path + '.as_path'
|
155
157
|
end
|
156
158
|
when String
|
157
|
-
if Misc.is_filename?(value,
|
159
|
+
if Misc.is_filename?(value, true)
|
158
160
|
value = value.dup
|
159
161
|
value.extend Path
|
160
162
|
return save_input(name, value, type, dir)
|
@@ -173,7 +175,7 @@ class Step
|
|
173
175
|
path = path + '.as_path_array'
|
174
176
|
end
|
175
177
|
when String
|
176
|
-
if Misc.is_filename?(value.first,
|
178
|
+
if Misc.is_filename?(value.first, true)
|
177
179
|
path = path + '.as_path_array'
|
178
180
|
end
|
179
181
|
when IO
|
@@ -249,5 +251,4 @@ class Step
|
|
249
251
|
|
250
252
|
inputs.keys
|
251
253
|
end
|
252
|
-
|
253
254
|
end
|
data/lib/rbbt/workflow/step.rb
CHANGED
@@ -57,7 +57,12 @@ class Step
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def workflow
|
60
|
-
@workflow
|
60
|
+
@workflow ||= begin
|
61
|
+
wf = info[:workflow]
|
62
|
+
wf = nil if wf == ""
|
63
|
+
wf ||= @task.workflow if @task && @task.respond_to?(:workflow)
|
64
|
+
wf ||= path.split("/")[-3]
|
65
|
+
end
|
61
66
|
end
|
62
67
|
|
63
68
|
|
@@ -296,7 +301,7 @@ class Step
|
|
296
301
|
res = @result
|
297
302
|
else
|
298
303
|
join if not done?
|
299
|
-
res = @path.exists? ? Persist.load_file(@path, result_type) :
|
304
|
+
res = @path.exists? ? Persist.load_file(@path, result_type) : run
|
300
305
|
end
|
301
306
|
|
302
307
|
if result_description
|
data/lib/rbbt/workflow/usage.rb
CHANGED
@@ -128,7 +128,7 @@ module Workflow
|
|
128
128
|
break if child
|
129
129
|
|
130
130
|
if child
|
131
|
-
description << "->
|
131
|
+
description << "->" << task_name.to_s
|
132
132
|
elsif first
|
133
133
|
description << "" << task_name.to_s
|
134
134
|
else
|
@@ -201,10 +201,10 @@ module Workflow
|
|
201
201
|
description = description.split("\n\n").first
|
202
202
|
|
203
203
|
next if abridge && ! final.include?(name)
|
204
|
-
puts Misc.format_definition_list_item(name.to_s, description, Log.tty_size || 80,
|
204
|
+
puts Misc.format_definition_list_item(name.to_s, description, Log.tty_size || 80, 30, :yellow)
|
205
205
|
|
206
206
|
prov_string = prov_string(dep_tree(name))
|
207
|
-
puts Misc.format_paragraph Log.color(:blue, "->
|
207
|
+
puts Misc.format_paragraph Log.color(:blue, "->" + prov_string) if prov_string && ! prov_string.empty?
|
208
208
|
end
|
209
209
|
|
210
210
|
else
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -486,7 +486,7 @@ module Workflow
|
|
486
486
|
if dep_basename.include? "."
|
487
487
|
parts = dep_basename.split(".")
|
488
488
|
extension = [parts.pop]
|
489
|
-
while parts.last.length <= 4
|
489
|
+
while parts.length > 1 && parts.last.length <= 4
|
490
490
|
extension << parts.pop
|
491
491
|
end
|
492
492
|
extension = extension.reverse * "."
|