rbbt-util 5.44.1 → 6.0.4
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/LICENSE +1 -1
- data/bin/rbbt +67 -90
- data/bin/rbbt_exec.rb +2 -2
- data/etc/app.d/base.rb +2 -2
- data/etc/app.d/semaphores.rb +3 -3
- data/lib/rbbt/annotations/annotated_array.rb +207 -207
- data/lib/rbbt/annotations/refactor.rb +27 -0
- data/lib/rbbt/annotations/util.rb +282 -282
- data/lib/rbbt/annotations.rb +343 -320
- data/lib/rbbt/association/database.rb +200 -225
- data/lib/rbbt/association/index.rb +294 -291
- data/lib/rbbt/association/item.rb +227 -227
- data/lib/rbbt/association/open.rb +35 -34
- data/lib/rbbt/association/util.rb +0 -169
- data/lib/rbbt/association.rb +2 -4
- data/lib/rbbt/entity/identifiers.rb +119 -118
- data/lib/rbbt/entity/refactor.rb +12 -0
- data/lib/rbbt/entity.rb +319 -315
- data/lib/rbbt/hpc/batch.rb +72 -53
- data/lib/rbbt/hpc/lsf.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/batches.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/chains.rb +25 -5
- data/lib/rbbt/hpc/orchestrate/rules.rb +2 -2
- data/lib/rbbt/hpc/orchestrate.rb +19 -13
- data/lib/rbbt/hpc/slurm.rb +18 -18
- data/lib/rbbt/knowledge_base/entity.rb +13 -5
- data/lib/rbbt/knowledge_base/query.rb +2 -2
- data/lib/rbbt/knowledge_base/registry.rb +32 -31
- data/lib/rbbt/knowledge_base/traverse.rb +1 -1
- data/lib/rbbt/knowledge_base.rb +1 -1
- data/lib/rbbt/monitor.rb +36 -25
- data/lib/rbbt/persist/refactor.rb +166 -0
- data/lib/rbbt/persist/tsv/tokyocabinet.rb +105 -105
- data/lib/rbbt/persist/tsv.rb +187 -185
- data/lib/rbbt/persist.rb +556 -551
- data/lib/rbbt/refactor.rb +20 -0
- data/lib/rbbt/resource/path/refactor.rb +178 -0
- data/lib/rbbt/resource/path.rb +317 -497
- data/lib/rbbt/resource/util.rb +0 -48
- data/lib/rbbt/resource.rb +3 -390
- data/lib/rbbt/tsv/accessor.rb +2 -838
- data/lib/rbbt/tsv/attach.rb +303 -299
- data/lib/rbbt/tsv/change_id.rb +244 -245
- data/lib/rbbt/tsv/csv.rb +87 -85
- data/lib/rbbt/tsv/dumper.rb +2 -100
- data/lib/rbbt/tsv/excel.rb +26 -24
- data/lib/rbbt/tsv/field_index.rb +4 -1
- data/lib/rbbt/tsv/filter.rb +3 -2
- data/lib/rbbt/tsv/index.rb +2 -284
- data/lib/rbbt/tsv/manipulate.rb +750 -747
- data/lib/rbbt/tsv/marshal.rb +3 -3
- data/lib/rbbt/tsv/matrix.rb +2 -2
- data/lib/rbbt/tsv/parallel/through.rb +2 -1
- data/lib/rbbt/tsv/parallel/traverse.rb +783 -781
- data/lib/rbbt/tsv/parser.rb +678 -678
- data/lib/rbbt/tsv/refactor.rb +195 -0
- data/lib/rbbt/tsv/stream.rb +253 -251
- data/lib/rbbt/tsv/util.rb +420 -420
- data/lib/rbbt/tsv.rb +210 -208
- data/lib/rbbt/util/R/eval.rb +4 -4
- data/lib/rbbt/util/R/plot.rb +62 -166
- data/lib/rbbt/util/R.rb +21 -18
- data/lib/rbbt/util/cmd.rb +2 -318
- data/lib/rbbt/util/color.rb +269 -269
- data/lib/rbbt/util/colorize.rb +89 -89
- data/lib/rbbt/util/concurrency/processes/refactor.rb +22 -0
- data/lib/rbbt/util/concurrency/processes/worker.rb +2 -2
- data/lib/rbbt/util/concurrency/processes.rb +389 -386
- data/lib/rbbt/util/config.rb +169 -167
- data/lib/rbbt/util/filecache.rb +1 -1
- data/lib/rbbt/util/iruby.rb +20 -0
- data/lib/rbbt/util/log/progress/report.rb +241 -241
- data/lib/rbbt/util/log/progress/util.rb +99 -99
- data/lib/rbbt/util/log/progress.rb +102 -102
- data/lib/rbbt/util/log/refactor.rb +49 -0
- data/lib/rbbt/util/log.rb +486 -532
- data/lib/rbbt/util/migrate.rb +2 -2
- data/lib/rbbt/util/misc/concurrent_stream.rb +248 -246
- data/lib/rbbt/util/misc/development.rb +12 -11
- data/lib/rbbt/util/misc/exceptions.rb +117 -112
- data/lib/rbbt/util/misc/format.rb +2 -230
- data/lib/rbbt/util/misc/indiferent_hash.rb +2 -107
- data/lib/rbbt/util/misc/inspect.rb +2 -476
- data/lib/rbbt/util/misc/lock.rb +109 -106
- data/lib/rbbt/util/misc/omics.rb +9 -1
- data/lib/rbbt/util/misc/pipes.rb +765 -793
- data/lib/rbbt/util/misc/refactor.rb +20 -0
- data/lib/rbbt/util/misc/ssw.rb +27 -17
- data/lib/rbbt/util/misc/system.rb +92 -105
- data/lib/rbbt/util/misc.rb +39 -20
- data/lib/rbbt/util/named_array/refactor.rb +4 -0
- data/lib/rbbt/util/named_array.rb +3 -220
- data/lib/rbbt/util/open/refactor.rb +7 -0
- data/lib/rbbt/util/open.rb +3 -857
- data/lib/rbbt/util/procpath.rb +6 -6
- data/lib/rbbt/util/python/paths.rb +27 -0
- data/lib/rbbt/util/python/run.rb +115 -0
- data/lib/rbbt/util/python/script.rb +110 -0
- data/lib/rbbt/util/python/util.rb +3 -3
- data/lib/rbbt/util/python.rb +22 -81
- data/lib/rbbt/util/semaphore.rb +152 -148
- data/lib/rbbt/util/simpleopt.rb +9 -8
- data/lib/rbbt/util/ssh/refactor.rb +19 -0
- data/lib/rbbt/util/ssh.rb +122 -118
- data/lib/rbbt/util/tar.rb +117 -115
- data/lib/rbbt/util/tmpfile.rb +69 -67
- data/lib/rbbt/util/version.rb +2 -0
- data/lib/rbbt/workflow/refactor/entity.rb +11 -0
- data/lib/rbbt/workflow/refactor/export.rb +66 -0
- data/lib/rbbt/workflow/refactor/inputs.rb +24 -0
- data/lib/rbbt/workflow/refactor/recursive.rb +64 -0
- data/lib/rbbt/workflow/refactor/task_info.rb +66 -0
- data/lib/rbbt/workflow/refactor.rb +150 -0
- data/lib/rbbt/workflow/remote_workflow/driver/rest.rb +1 -2
- data/lib/rbbt/workflow/remote_workflow/driver/ssh.rb +55 -32
- data/lib/rbbt/workflow/remote_workflow/remote_step/rest.rb +3 -1
- data/lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb +14 -5
- data/lib/rbbt/workflow/remote_workflow/remote_step.rb +19 -7
- data/lib/rbbt/workflow/remote_workflow.rb +6 -1
- data/lib/rbbt/workflow/step/run.rb +766 -766
- data/lib/rbbt/workflow/step/save_load_inputs.rb +254 -254
- data/lib/rbbt/workflow/step.rb +2 -362
- data/lib/rbbt/workflow/task.rb +118 -118
- data/lib/rbbt/workflow/usage.rb +289 -287
- data/lib/rbbt/workflow/util/archive.rb +6 -5
- data/lib/rbbt/workflow/util/data.rb +1 -1
- data/lib/rbbt/workflow/util/orchestrator.rb +249 -246
- data/lib/rbbt/workflow/util/trace.rb +79 -44
- data/lib/rbbt/workflow.rb +4 -882
- data/lib/rbbt-util.rb +21 -13
- data/lib/rbbt.rb +16 -3
- data/python/rbbt/__init__.py +96 -4
- data/python/rbbt/workflow/remote.py +104 -0
- data/python/rbbt/workflow.py +64 -0
- data/python/test.py +10 -0
- data/share/Rlib/plot.R +37 -37
- data/share/Rlib/svg.R +22 -5
- data/share/install/software/lib/install_helpers +1 -1
- data/share/rbbt_commands/hpc/list +2 -3
- data/share/rbbt_commands/hpc/orchestrate +4 -4
- data/share/rbbt_commands/hpc/tail +2 -0
- data/share/rbbt_commands/hpc/task +10 -7
- data/share/rbbt_commands/lsf/list +2 -3
- data/share/rbbt_commands/lsf/orchestrate +4 -4
- data/share/rbbt_commands/lsf/tail +2 -0
- data/share/rbbt_commands/lsf/task +10 -7
- data/share/rbbt_commands/migrate +1 -1
- data/share/rbbt_commands/pbs/list +2 -3
- data/share/rbbt_commands/pbs/orchestrate +4 -4
- data/share/rbbt_commands/pbs/tail +2 -0
- data/share/rbbt_commands/pbs/task +10 -7
- data/share/rbbt_commands/resource/produce +8 -1
- data/share/rbbt_commands/slurm/list +2 -3
- data/share/rbbt_commands/slurm/orchestrate +4 -4
- data/share/rbbt_commands/slurm/tail +2 -0
- data/share/rbbt_commands/slurm/task +10 -7
- data/share/rbbt_commands/system/clean +5 -5
- data/share/rbbt_commands/system/status +5 -5
- data/share/rbbt_commands/tsv/get +2 -3
- data/share/rbbt_commands/tsv/info +10 -13
- data/share/rbbt_commands/tsv/keys +18 -14
- data/share/rbbt_commands/tsv/slice +2 -2
- data/share/rbbt_commands/tsv/transpose +6 -2
- data/share/rbbt_commands/workflow/info +20 -24
- data/share/rbbt_commands/workflow/list +1 -1
- data/share/rbbt_commands/workflow/prov +20 -13
- data/share/rbbt_commands/workflow/retry +43 -0
- data/share/rbbt_commands/workflow/server +12 -2
- data/share/rbbt_commands/workflow/task +80 -73
- data/share/rbbt_commands/workflow/write_info +26 -9
- data/share/software/opt/ssw/ssw.c +861 -0
- data/share/software/opt/ssw/ssw.h +130 -0
- data/share/workflow_config.ru +3 -3
- metadata +45 -6
@@ -6,7 +6,7 @@ require 'rbbt/util/simpleopt'
|
|
6
6
|
|
7
7
|
options = SOPT.get('-wd--workflow_dir*:-d--describe')
|
8
8
|
|
9
|
-
workflow_dir = options[:workflow_dir] ||
|
9
|
+
workflow_dir = options[:workflow_dir] || Rbbt.workflows
|
10
10
|
|
11
11
|
Path.setup(workflow_dir) unless Path === workflow_dir
|
12
12
|
|
@@ -1,23 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require '
|
4
|
-
|
5
|
-
require 'rbbt
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require 'rbbt/
|
9
|
-
require 'rbbt/workflow/
|
10
|
-
require 'rbbt/util/
|
11
|
-
|
12
|
-
|
13
|
-
require 'rbbt
|
3
|
+
require 'scout/workflow'
|
4
|
+
|
5
|
+
#require 'rbbt/workflow'
|
6
|
+
#require 'rbbt-util'
|
7
|
+
#require 'fileutils'
|
8
|
+
#require 'rbbt/util/simpleopt'
|
9
|
+
#require 'rbbt/workflow/step'
|
10
|
+
#require 'rbbt/workflow/util/provenance'
|
11
|
+
#require 'rbbt/util/misc'
|
12
|
+
#
|
13
|
+
#require 'rbbt-util'
|
14
|
+
#require 'rbbt/util/simpleopt'
|
14
15
|
|
15
16
|
$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
|
16
17
|
|
17
18
|
options = SOPT.setup <<EOF
|
18
19
|
Examine the provenance of a job result
|
19
20
|
|
20
|
-
$ rbbt workflow prov <
|
21
|
+
$ rbbt workflow prov <job_result> [<dependency_task>]
|
21
22
|
|
22
23
|
-h--help Help
|
23
24
|
-p--plot* draw the dependency plot into <file.png>
|
@@ -34,12 +35,15 @@ $info_fields = (options[:info_fields] || "").split(",")
|
|
34
35
|
|
35
36
|
file = ARGV.shift
|
36
37
|
|
38
|
+
raise MissingParameterException, :job_result if file.nil?
|
39
|
+
dependency_task = ARGV.shift
|
40
|
+
|
37
41
|
$seen = []
|
38
42
|
def get_step(file)
|
39
43
|
file = File.expand_path(file) if File.exist?(file)
|
40
44
|
file = file.sub(/\.(info|files)$/,'')
|
41
45
|
$seen << file
|
42
|
-
|
46
|
+
Step.load file
|
43
47
|
end
|
44
48
|
|
45
49
|
def touch(step)
|
@@ -130,6 +134,9 @@ if options[:plot]
|
|
130
134
|
end
|
131
135
|
end
|
132
136
|
|
137
|
+
elsif dependency_task
|
138
|
+
deps = step.rec_dependencies.select{|dep| dep.task_name.to_s == dependency_task}
|
139
|
+
puts deps.collect{|dep| dep.path } * "\n"
|
133
140
|
else
|
134
141
|
puts Step.prov_report(step, 0, nil, [], options[:expand_repeats])
|
135
142
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbbt/workflow'
|
4
|
+
|
5
|
+
require 'rbbt-util'
|
6
|
+
require 'rbbt-util'
|
7
|
+
require 'rbbt/util/simpleopt'
|
8
|
+
|
9
|
+
$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
|
10
|
+
|
11
|
+
options = SOPT.setup <<EOF
|
12
|
+
Retry a failed job
|
13
|
+
|
14
|
+
$ rbbt workflow retry <job-path>
|
15
|
+
|
16
|
+
Does not retry if job is done unless clean is specified
|
17
|
+
|
18
|
+
-h--help Help
|
19
|
+
-cl--clean Clean the job
|
20
|
+
-rcl--recursive_clean Recursively clean the job
|
21
|
+
EOF
|
22
|
+
|
23
|
+
SOPT.usage if options[:help]
|
24
|
+
|
25
|
+
file = ARGV.shift
|
26
|
+
def get_step(file)
|
27
|
+
file = file.sub(/\.(info|files)/,'')
|
28
|
+
step = Workflow.load_step file
|
29
|
+
step
|
30
|
+
end
|
31
|
+
|
32
|
+
step = get_step(file)
|
33
|
+
inputs = step.recursive_inputs
|
34
|
+
|
35
|
+
step.clean if options[:clean]
|
36
|
+
step.recursive_clean if options[:recursive_clean]
|
37
|
+
|
38
|
+
if ! step.done?
|
39
|
+
wf = Workflow.require_workflow step.workflow
|
40
|
+
job = wf.job(step.task_name, step.clean_name, inputs.to_hash)
|
41
|
+
job.run
|
42
|
+
end
|
43
|
+
|
@@ -127,7 +127,11 @@ TmpFile.with_file do |app_dir|
|
|
127
127
|
when 'puma_production'
|
128
128
|
#`puma '#{config_ru_file}' -p #{options[:Port] || "2887"} -w 3 -t 8:32 --preload`
|
129
129
|
CMD.cmd_log("env RBBT_LOG=#{Log.severity.to_s} puma '#{config_ru_file}' -p #{options[:Port] || "2887"} -w 20 -t 10:160 --preload")
|
130
|
+
when 'puma_single'
|
131
|
+
#`puma '#{config_ru_file}' -p #{options[:Port] || "2887"} -w 3 -t 8:32 --preload`
|
132
|
+
CMD.cmd_log("env RBBT_LOG=#{Log.severity.to_s} puma '#{config_ru_file}' -p #{options[:Port] || "2887"} -w 1 -t 1:1 ")
|
130
133
|
else
|
134
|
+
|
131
135
|
options[:config] = config_ru_file
|
132
136
|
|
133
137
|
fixed_options = {}
|
@@ -136,9 +140,15 @@ TmpFile.with_file do |app_dir|
|
|
136
140
|
|
137
141
|
begin
|
138
142
|
Rack::Server.start(options)
|
139
|
-
rescue LoadError
|
143
|
+
rescue LoadError, Exception
|
140
144
|
require 'rackup'
|
141
|
-
|
145
|
+
|
146
|
+
begin
|
147
|
+
Rackup::Server.start(options)
|
148
|
+
rescue Exception
|
149
|
+
Log.exception $!
|
150
|
+
raise $!
|
151
|
+
end
|
142
152
|
end
|
143
153
|
end
|
144
154
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'rbbt-util'
|
3
4
|
require 'rbbt/util/simpleopt'
|
4
5
|
require 'rbbt/workflow'
|
5
|
-
require 'rbbt/workflow/usage'
|
6
6
|
require 'time'
|
7
7
|
|
8
8
|
def report_options(options)
|
@@ -25,7 +25,7 @@ def usage(workflow = nil, task = nil, exception=nil, abridge = false)
|
|
25
25
|
|
26
26
|
if task.nil?
|
27
27
|
workflow.load_tasks if workflow.respond_to? :load_tasks
|
28
|
-
workflow.
|
28
|
+
workflow.usage nil, abridge
|
29
29
|
puts
|
30
30
|
puts "E.g. rbbt workflow task #{workflow.to_s} #{workflow.tasks.keys.first.to_s} -h"
|
31
31
|
else
|
@@ -40,7 +40,7 @@ def usage(workflow = nil, task = nil, exception=nil, abridge = false)
|
|
40
40
|
puts Misc.format_paragraph workflow.documentation[:description]
|
41
41
|
end
|
42
42
|
puts
|
43
|
-
workflow.
|
43
|
+
workflow.usage task, abridge
|
44
44
|
end
|
45
45
|
|
46
46
|
print_error(exception.message, exception.backtrace) if exception
|
@@ -75,6 +75,7 @@ def fix_options(workflow, task, job_options)
|
|
75
75
|
job_options.each do |name, value|
|
76
76
|
type = input_types[name]
|
77
77
|
type = type.to_sym if type
|
78
|
+
noload = input_options[name] && (input_options[name][:nofile] || input_options[name][:noload])
|
78
79
|
|
79
80
|
if Step === value
|
80
81
|
job_options_cleaned[name] = value
|
@@ -82,19 +83,19 @@ def fix_options(workflow, task, job_options)
|
|
82
83
|
end
|
83
84
|
|
84
85
|
if Path === value && Step === value.resource
|
85
|
-
|
86
|
-
|
86
|
+
job_options_cleaned[name] = value
|
87
|
+
next
|
87
88
|
end
|
88
89
|
|
89
90
|
value = case type
|
90
91
|
when nil
|
91
|
-
|
92
|
+
value
|
92
93
|
when :boolean
|
93
94
|
TrueClass === value or %w(true TRUE T yes).include? value
|
94
95
|
when :float
|
95
96
|
value.to_f
|
96
97
|
when :path
|
97
|
-
Path.setup(value)
|
98
|
+
Path.setup(value.dup)
|
98
99
|
when :integer
|
99
100
|
value.to_i
|
100
101
|
when :text
|
@@ -111,10 +112,12 @@ def fix_options(workflow, task, job_options)
|
|
111
112
|
end
|
112
113
|
end
|
113
114
|
when :array
|
114
|
-
if input_options[name] && input_options[name][:stream] && String === value && Misc.is_filename?(value) &&
|
115
|
+
if input_options[name] && input_options[name][:stream] && String === value && Misc.is_filename?(value) && noload
|
115
116
|
get_value_stream(value)
|
116
117
|
elsif input_options[name] and input_options[name][:stream] and value == "-"
|
117
118
|
STDIN
|
119
|
+
elsif Path.is_filename?(value) && (Path.step_file?(value) || Open.exists?(value))
|
120
|
+
value
|
118
121
|
else
|
119
122
|
if Array === value || IO === value
|
120
123
|
value
|
@@ -124,7 +127,7 @@ def fix_options(workflow, task, job_options)
|
|
124
127
|
when value == '-'
|
125
128
|
array_separator ||= "\n"
|
126
129
|
STDIN.read
|
127
|
-
when (String === value and File.exist?(value) and
|
130
|
+
when (String === value and File.exist?(value) and ! noload)
|
128
131
|
array_separator ||= "\n"
|
129
132
|
Open.read(value)
|
130
133
|
else
|
@@ -141,6 +144,8 @@ def fix_options(workflow, task, job_options)
|
|
141
144
|
when :tsv
|
142
145
|
if input_options[name] and input_options[name][:stream] and String === value
|
143
146
|
TSV::Parser.new(value == '-' ? STDIN : Open.open(value), :filename => value )
|
147
|
+
elsif noload
|
148
|
+
value
|
144
149
|
else
|
145
150
|
case value
|
146
151
|
when TSV
|
@@ -180,7 +185,7 @@ available. Examples can be enacted using `rbbt workflow example <workflow>
|
|
180
185
|
[<task>] [<example>]`.
|
181
186
|
|
182
187
|
When a task is enacted a job is instantiated. This job is identified by the
|
183
|
-
`jobname` (which is *#{
|
188
|
+
`jobname` (which is *#{Task::DEFAULT_NAME}* unless specified otherwise) and the values of the
|
184
189
|
parameters; these two things determine the filename under which the job result
|
185
190
|
will be saved. If the taks is enacted using the same `jobname` and parameters
|
186
191
|
it will result in the same job, pointing to the same result file.
|
@@ -196,12 +201,13 @@ The `recursive_clean` cleans all the job dependency steps recursively.
|
|
196
201
|
-wda--workdir_all* Change the working directory of ALL workflow
|
197
202
|
-as--array_separator* Change the character that separates elements of Arrays, ',', '|', or '\\n' by default
|
198
203
|
-fs--field_separator* Change the character that separates fields of TSV files '\\t' by default
|
199
|
-
-jn--jobname* Job name to use. The name '#{
|
204
|
+
-jn--jobname* Job name to use. The name '#{Task::DEFAULT_NAME}' is used by default
|
200
205
|
-pn--printname Print the name of the job and exit without starting it
|
201
206
|
-pf--printpath Print the path of the job result
|
202
207
|
-cl--clean Clean the last step of the job so that it gets recomputed
|
203
208
|
-ct--clean_task* Clean a particular dependency task
|
204
209
|
-rcl--recursive_clean Clean the last step and its dependencies to recompute the job completely
|
210
|
+
-u--update Update jobs if dependencies are newer
|
205
211
|
-uaj--update_all_jobs Consider all dependencies when checking for updates, even when they have no info files
|
206
212
|
--fork Run job asyncronously and monitor progress. It monitors detached processes as well
|
207
213
|
--orchestrate* Run the job through the orchestrator
|
@@ -217,6 +223,7 @@ The `recursive_clean` cleans all the job dependency steps recursively.
|
|
217
223
|
-R--requires* Require a list of files
|
218
224
|
-pro--produce* Prepare dependencies
|
219
225
|
-proc--produce_cpus* Number of dependencies prepared in parallel
|
226
|
+
-prot--produce_timer* Time step for refreshing the orchestrator status
|
220
227
|
-rwt--remote_workflow_tasks* Load a yaml file describing remote workflow tasks
|
221
228
|
-od--override_deps* Override deps using 'Workflow#task=<path>' array_separated
|
222
229
|
-PERF--procpath_performance* Measure performance using procpath
|
@@ -229,7 +236,9 @@ EOF
|
|
229
236
|
workflow = ARGV.shift
|
230
237
|
usage and exit! -1 if workflow.nil?
|
231
238
|
|
232
|
-
|
239
|
+
task_name = ARGV.shift
|
240
|
+
|
241
|
+
task_name = task_name.to_sym if task_name
|
233
242
|
|
234
243
|
# Set log, fork, clean, recursive_clean and help
|
235
244
|
help = !!options.delete(:help)
|
@@ -241,6 +250,7 @@ clean = !!options.delete(:clean) || clean_task
|
|
241
250
|
override_deps = options.delete(:override_deps)
|
242
251
|
recursive_clean = !!options.delete(:recursive_clean)
|
243
252
|
out = options.include?(:output) ? File.open(options[:output], 'wb') : STDOUT
|
253
|
+
provenance = options.delete(:provenance)
|
244
254
|
|
245
255
|
$array_separator = options.delete(:array_separator)
|
246
256
|
$field_separator = options.delete(:field_separator) || "\t"
|
@@ -257,14 +267,17 @@ end
|
|
257
267
|
Workflow.workdir.search_paths.merge!({:workdir => File.expand_path(options.delete(:workdir_all)), :default => :workdir }) if options[:workdir_all]
|
258
268
|
|
259
269
|
workflow = Workflow.require_workflow workflow
|
260
|
-
|
261
270
|
if clean_task
|
262
|
-
ENV["
|
271
|
+
ENV["SCOUT_UPDATE"] = 'true'
|
272
|
+
end
|
273
|
+
|
274
|
+
if options[:update]
|
275
|
+
ENV["SCOUT_UPDATE"] = 'true'
|
263
276
|
end
|
264
277
|
|
265
278
|
if options[:update_all_jobs]
|
266
|
-
ENV["
|
267
|
-
ENV["
|
279
|
+
ENV["SCOUT_UPDATE_ALL_JOBS"] = 'true'
|
280
|
+
ENV["SCOUT_UPDATE"] = 'true'
|
268
281
|
end
|
269
282
|
|
270
283
|
if options[:workflows]
|
@@ -291,39 +304,36 @@ end
|
|
291
304
|
# Set task
|
292
305
|
namespace = nil, nil
|
293
306
|
|
294
|
-
|
295
|
-
when task.nil?
|
296
|
-
usage workflow, nil, nil, options[:abridge] and exit 0
|
297
|
-
else
|
298
|
-
task_name = task.to_sym
|
299
|
-
begin
|
300
|
-
task = workflow.tasks[task_name]
|
301
|
-
raise Workflow::TaskNotFoundException.new workflow, task_name if task.nil?
|
302
|
-
rescue Workflow::TaskNotFoundException
|
303
|
-
usage workflow, nil, nil, options[:abridge]
|
304
|
-
|
305
|
-
puts
|
306
|
-
puts Log.color :magenta, "## Error"
|
307
|
-
puts
|
308
|
-
puts $!.message
|
309
|
-
puts
|
307
|
+
help = options[:help] = true if task_name.nil?
|
310
308
|
|
311
|
-
|
309
|
+
if help
|
310
|
+
if defined? scout_usage
|
311
|
+
scout_usage
|
312
|
+
else
|
313
|
+
puts SOPT.doc
|
312
314
|
end
|
315
|
+
|
316
|
+
puts workflow.usage(task_name) if workflow
|
317
|
+
exit 0
|
318
|
+
else
|
319
|
+
task = workflow.tasks[task_name.to_sym] if task_name
|
320
|
+
raise ParameterException, "Task #{task_name} not found" if task.nil?
|
313
321
|
end
|
314
322
|
|
315
|
-
usage workflow, task, nil, options[:abridge] and exit 0 if help
|
323
|
+
#usage workflow, task, nil, options[:abridge] and exit 0 if help
|
324
|
+
#puts workflow.usage(task, options[:abridge]) and exit 0 if help
|
316
325
|
|
317
326
|
name = options.delete(:jobname)
|
318
327
|
|
319
328
|
# get job args
|
320
|
-
job_options =
|
329
|
+
job_options = task.get_SOPT
|
321
330
|
|
322
331
|
if options[:load_inputs]
|
323
332
|
task_info = workflow.task_info(task_name)
|
324
|
-
job_options =
|
333
|
+
job_options = workflow.tasks[task_name].load_inputs(options[:load_inputs]).merge(job_options)
|
325
334
|
end
|
326
335
|
|
336
|
+
|
327
337
|
job_options = fix_options(workflow, task, job_options)
|
328
338
|
saved_job_options = job_options
|
329
339
|
|
@@ -343,7 +353,13 @@ $job = job
|
|
343
353
|
|
344
354
|
# clean job
|
345
355
|
if clean
|
346
|
-
job.
|
356
|
+
if job.info[:task_alias]
|
357
|
+
Log.info "Cleaning task_alias #{Log.fingerprint job.dependencies.last}"
|
358
|
+
job.dependencies.last.clean
|
359
|
+
job.clean
|
360
|
+
else
|
361
|
+
job.clean
|
362
|
+
end
|
347
363
|
sleep 1
|
348
364
|
end
|
349
365
|
|
@@ -368,11 +384,11 @@ if recursive_clean
|
|
368
384
|
job.recursive_clean
|
369
385
|
end
|
370
386
|
|
371
|
-
require 'pp'
|
372
387
|
|
373
388
|
# run
|
374
389
|
begin
|
375
390
|
if options[:info]
|
391
|
+
require 'pp'
|
376
392
|
pp job.info
|
377
393
|
exit 0
|
378
394
|
end
|
@@ -385,11 +401,17 @@ begin
|
|
385
401
|
if do_exec or (job.respond_to?(:is_exec) and job.is_exec)
|
386
402
|
res = job.exec(:stream)
|
387
403
|
|
388
|
-
result_type = job.
|
404
|
+
result_type = job.type
|
389
405
|
|
390
406
|
res = JSON.parse(res.read) if (defined?(RemoteStep) and RemoteStep === job) && %w(array float integer boolean).include?(result_type.to_s)
|
391
407
|
|
392
408
|
case
|
409
|
+
when res.respond_to?(:stream)
|
410
|
+
begin
|
411
|
+
Misc.consume_stream(res.stream, false, out)
|
412
|
+
rescue EOFError, IOError
|
413
|
+
end
|
414
|
+
res.join if res.respond_to? :join
|
393
415
|
when res.respond_to?(:gets)
|
394
416
|
begin
|
395
417
|
Misc.consume_stream(res, false, out)
|
@@ -412,7 +434,7 @@ begin
|
|
412
434
|
exit 0
|
413
435
|
end
|
414
436
|
|
415
|
-
if
|
437
|
+
if provenance
|
416
438
|
if options.delete(:printpath)
|
417
439
|
puts job.path
|
418
440
|
else
|
@@ -455,32 +477,21 @@ begin
|
|
455
477
|
else
|
456
478
|
RemoteWorkflow::SSH.relay_job_list([@job], @host, :run_type => run_type, :migrate => true, :produce_dependencies => @produce_dependencies)
|
457
479
|
Step.migrate(@job, 'user', :source => @host)
|
458
|
-
|
480
|
+
nil
|
459
481
|
end
|
460
482
|
end
|
461
|
-
#job.dependencies = []
|
462
|
-
|
463
|
-
#([job] + job.rec_dependencies).each do |j|
|
464
|
-
# next if job.done?
|
465
|
-
# jmeta = class << j; self; end
|
466
|
-
|
467
|
-
# j.instance_variable_set(:@job, job)
|
468
|
-
# j.instance_variable_set(:@host, server)
|
469
|
-
# j.instance_variable_set(:@produce_dependencies, produce_dependencies_for_relay)
|
470
|
-
|
471
|
-
# jmeta.define_method :run do |*args|
|
472
|
-
# if done?
|
473
|
-
# load
|
474
|
-
# else
|
475
|
-
# RemoteWorkflow::SSH.relay_job_list([@job], @host, :run_type => run_type, :migrate => true, :produce_dependencies => @produce_dependencies)
|
476
|
-
# Step.migrate(@job, 'user', :source => @host)
|
477
|
-
# load
|
478
|
-
# end
|
479
|
-
# end
|
480
|
-
#end
|
481
483
|
end
|
482
484
|
end
|
483
485
|
|
486
|
+
if tasks = options.delete(:produce)
|
487
|
+
tasks = tasks.split(",")
|
488
|
+
produce_cpus = (options[:produce_cpus] || 1)
|
489
|
+
produce_timer = (options[:produce_timer] || 5)
|
490
|
+
jobs = Workflow.produce_dependencies(job, tasks, produce_cpus, produce_timer.to_f)
|
491
|
+
puts "Produced #{jobs.length} dependency jobs: #{Log.fingerprint jobs}"
|
492
|
+
exit 0
|
493
|
+
end
|
494
|
+
|
484
495
|
|
485
496
|
if server = options.delete(:relay)
|
486
497
|
require 'rbbt/workflow/remote_workflow'
|
@@ -491,6 +502,7 @@ begin
|
|
491
502
|
jobs_to_relay.reject!{|d| d.done? }
|
492
503
|
|
493
504
|
replace_relayed_jobs(jobs_to_relay, server, produce_dependencies_for_relay, :run)
|
505
|
+
RemoteWorkflow::SSH.relay_job_list(jobs_to_relay, server, :run_type => :run, :migrate => true, :produce_dependencies => produce_dependencies_for_relay)
|
494
506
|
end
|
495
507
|
|
496
508
|
if server = options.delete(:batch_relay)
|
@@ -501,6 +513,7 @@ begin
|
|
501
513
|
jobs_to_relay.reject!{|d| d.done? }
|
502
514
|
|
503
515
|
replace_relayed_jobs(jobs_to_relay, server, produce_dependencies_for_relay, :orchestrate)
|
516
|
+
RemoteWorkflow::SSH.relay_job_list(jobs_to_relay, server, :run_type => :orchestrate, :migrate => true, :produce_dependencies => produce_dependencies_for_relay)
|
504
517
|
end
|
505
518
|
|
506
519
|
|
@@ -522,20 +535,14 @@ begin
|
|
522
535
|
end
|
523
536
|
end
|
524
537
|
|
525
|
-
if
|
526
|
-
|
527
|
-
produce_cpus = (options[:produce_cpus] || 1)
|
528
|
-
puts Step.produce_dependencies(job, tasks, produce_cpus)
|
529
|
-
exit 0
|
530
|
-
end
|
531
|
-
|
532
|
-
|
533
|
-
if do_fork
|
534
|
-
ENV["RBBT_NO_PROGRESS"] = "true"
|
538
|
+
if do_fork || detach
|
539
|
+
ENV["SCOUT_NO_PROGRESS"] = "true"
|
535
540
|
if detach
|
536
541
|
job.fork
|
537
542
|
Process.detach job.pid if job.pid
|
538
|
-
|
543
|
+
Log.info(Log.color(:magenta, "Issued: ") + Log.color(:magenta, job.pid ? job.pid.to_s : 'no pid') + ' -- ' + job.path)
|
544
|
+
puts job.path
|
545
|
+
|
539
546
|
exit 0
|
540
547
|
end
|
541
548
|
|
@@ -690,7 +697,7 @@ when Step
|
|
690
697
|
exit! 0
|
691
698
|
else
|
692
699
|
res.join if res.running?
|
693
|
-
if %w(float integer string boolean).include?(res.
|
700
|
+
if %w(float integer string boolean).include?(res.type.to_s)
|
694
701
|
out.puts res.load
|
695
702
|
else
|
696
703
|
Open.open(res.path, :mode => 'rb') do |io|
|
@@ -42,16 +42,33 @@ step = get_step file
|
|
42
42
|
|
43
43
|
step.set_info key, value if force || ! step.info.include?(key)
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
def recursive_write(step, key, value, force, check_pid)
|
46
|
+
pid = step.info[:pid]
|
47
|
+
host = step.info[:pid_hostname]
|
48
|
+
|
49
|
+
dependencies = step.dependencies + step.input_dependencies
|
50
|
+
dependencies.each do |dep|
|
51
|
+
next if check_pid && (dep.info[:pid].to_s != pid.to_s || dep.info[:pid_hostname] != host)
|
52
|
+
if force || !dep.info.include?(key)
|
53
|
+
begin
|
54
|
+
dep.set_info key, value
|
55
|
+
rescue
|
56
|
+
Log.warn "Could no set info #{key} for #{dep.path}: #{$!.message}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
recursive_write(dep, key, value, force, check_pid)
|
53
60
|
end
|
54
|
-
end
|
61
|
+
end
|
62
|
+
|
63
|
+
recursive_write(step, key, value, force, check_pid) if recursive
|
64
|
+
|
65
|
+
#step.rec_dependencies.each do |dep|
|
66
|
+
# begin
|
67
|
+
# dep.set_info key, value if (force || ! dep.info.include?(key)) && (!check_pid || dep.info[:pid].to_s == pid and dep.info[:pid_hostname] == host)
|
68
|
+
# rescue
|
69
|
+
# Log.warn "Could no set info #{key} for #{dep.path}: #{$!.message}"
|
70
|
+
# end
|
71
|
+
#end if recursive
|
55
72
|
|
56
73
|
if recursive && step.info[:archived_info]
|
57
74
|
ad = step.info[:archived_info]
|