rbbt-util 5.33.2 → 5.33.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/hpc/batch.rb +4 -1
- data/lib/rbbt/hpc/orchestrate/batches.rb +3 -3
- data/lib/rbbt/hpc/orchestrate.rb +2 -1
- data/lib/rbbt/hpc/slurm.rb +4 -1
- data/lib/rbbt/resource.rb +11 -0
- data/lib/rbbt/util/cmd.rb +1 -1
- data/lib/rbbt/workflow/definition.rb +17 -12
- data/lib/rbbt/workflow/integration/nextflow.rb +32 -14
- data/share/rbbt_commands/hpc/list +13 -10
- data/share/rbbt_commands/hpc/tail +22 -2
- data/share/rbbt_commands/lsf/list +13 -10
- data/share/rbbt_commands/lsf/tail +22 -2
- data/share/rbbt_commands/slurm/list +13 -10
- data/share/rbbt_commands/slurm/tail +22 -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: bea55b2e4dd5972cf0e9646e84db4ce6ffd0556bb54796927640dbe3a3ba6611
|
4
|
+
data.tar.gz: 281d52e1685badaba8427e5ffd2226e1a1ab61d66df30cc7cd88acb79ef5aa18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 459b75076980833dc1be3bd60d9fc98707270c626ab837e76a6c09180aaa2bd3328b4dea8776cf09c8fca0358e38258a30a90d17cd615450a38398c53bacfef0
|
7
|
+
data.tar.gz: 1bb336e1a592b64fbb3e87453042e3f6f220b76c92f5e9ff7550aa25401fd3e36a823f31bddb0e8be6878fa7646b28a010ac320d6fd8e00066bd1ebf2e9f774f
|
data/lib/rbbt/hpc/batch.rb
CHANGED
@@ -538,10 +538,13 @@ env > #{batch_options[:fenv]}
|
|
538
538
|
workflow = job.workflow
|
539
539
|
task_name = job.task_name
|
540
540
|
|
541
|
+
workflows_to_load = job.rec_dependencies.select{|d| Step === d}.collect{|d| d.workflow }.compact.collect(&:to_s) - [workflow.to_s]
|
542
|
+
|
541
543
|
TmpFile.with_file(nil, remove_batch_dir, :tmpdir => batch_base_dir, :prefix => "#{system}_rbbt_job-#{workflow.to_s}-#{task_name}-") do |batch_dir|
|
542
544
|
Misc.add_defaults options,
|
543
545
|
:batch_dir => batch_dir,
|
544
|
-
:inputs_dir => File.join(batch_dir, "inputs_dir")
|
546
|
+
:inputs_dir => File.join(batch_dir, "inputs_dir"),
|
547
|
+
:workflows => workflows_to_load * ","
|
545
548
|
|
546
549
|
options[:procpath_performance] ||= File.join(batch_dir, "procpath##{procpath.gsub(',', '#')}") if procpath
|
547
550
|
|
@@ -11,7 +11,7 @@ module HPC
|
|
11
11
|
iii :END_BATCHES
|
12
12
|
else
|
13
13
|
n = batch.dup
|
14
|
-
n[:deps] = n[:deps].collect{|b| b[:top_level] }
|
14
|
+
n[:deps] = n[:deps].collect{|b| b[:top_level] } if n[:deps]
|
15
15
|
iif n
|
16
16
|
end
|
17
17
|
end
|
@@ -79,14 +79,14 @@ module HPC
|
|
79
79
|
|
80
80
|
batches.each do |batch|
|
81
81
|
jobs = batch[:jobs]
|
82
|
-
all_deps = jobs.collect{|d| job_dependencies(d) }.flatten.uniq
|
82
|
+
all_deps = jobs.collect{|d| job_dependencies(d) }.flatten.uniq - jobs
|
83
83
|
|
84
84
|
minimum = all_deps
|
85
85
|
all_deps.each do |dep|
|
86
86
|
minimum -= job_dependencies(dep)
|
87
87
|
end
|
88
88
|
|
89
|
-
all_deps = minimum
|
89
|
+
all_deps = minimum
|
90
90
|
deps = all_deps.collect do |d|
|
91
91
|
(batches - [batch]).select{|batch| batch[:jobs].collect(&:path).include? d.path }
|
92
92
|
end.flatten.uniq
|
data/lib/rbbt/hpc/orchestrate.rb
CHANGED
@@ -31,7 +31,8 @@ module HPC
|
|
31
31
|
top = batches.select{|b| b[:deps].nil? || (b[:deps] - batch_ids.keys).empty? }.first
|
32
32
|
raise "No batch without unmet dependencies" if top.nil?
|
33
33
|
batches.delete top
|
34
|
-
|
34
|
+
|
35
|
+
job_options = HPC::Orchestration.merge_rules(options, top[:rules])
|
35
36
|
|
36
37
|
if top[:deps].nil?
|
37
38
|
batch_dependencies = []
|
data/lib/rbbt/hpc/slurm.rb
CHANGED
@@ -32,6 +32,8 @@ export BATCH_SYSTEM=SLURM
|
|
32
32
|
constraint = Misc.process_options options, :constraint
|
33
33
|
gres = Misc.process_options options, :gres
|
34
34
|
|
35
|
+
constraint = [constraint, "highmem"].compact * "&" if highmem
|
36
|
+
|
35
37
|
mem = Misc.process_options options, :mem
|
36
38
|
mem_per_cpu = Misc.process_options options, :mem_per_cpu
|
37
39
|
|
@@ -50,14 +52,15 @@ export BATCH_SYSTEM=SLURM
|
|
50
52
|
"cpus-per-task" => task_cpus,
|
51
53
|
"nodes" => nodes,
|
52
54
|
"time" => time,
|
55
|
+
"constraint" => constraint,
|
53
56
|
"exclusive" => exclusive,
|
54
|
-
"highmem" => highmem,
|
55
57
|
"licenses" => licenses,
|
56
58
|
"gres" => gres,
|
57
59
|
"mem" => mem,
|
58
60
|
"mem-per-cpu" => mem_per_cpu,
|
59
61
|
}
|
60
62
|
|
63
|
+
|
61
64
|
header =<<-EOF
|
62
65
|
#!/bin/bash
|
63
66
|
EOF
|
data/lib/rbbt/resource.rb
CHANGED
@@ -270,6 +270,7 @@ source "$INSTALL_HELPER_FILE"
|
|
270
270
|
git = content[:git]
|
271
271
|
src = content[:src]
|
272
272
|
url = content[:url]
|
273
|
+
jar = content[:jar]
|
273
274
|
extra = content[:extra]
|
274
275
|
commands = content[:commands]
|
275
276
|
if git
|
@@ -290,6 +291,16 @@ url='#{src}'
|
|
290
291
|
|
291
292
|
install_src "$name" "$url" #{extra}
|
292
293
|
|
294
|
+
#{commands}
|
295
|
+
EOF
|
296
|
+
elsif jar
|
297
|
+
<<-EOF
|
298
|
+
|
299
|
+
name='#{name}'
|
300
|
+
url='#{jar}'
|
301
|
+
|
302
|
+
install_jar "$name" "$url" #{extra}
|
303
|
+
|
293
304
|
#{commands}
|
294
305
|
EOF
|
295
306
|
else
|
data/lib/rbbt/util/cmd.rb
CHANGED
@@ -75,7 +75,7 @@ module CMD
|
|
75
75
|
|
76
76
|
string = ""
|
77
77
|
options.each do |option, value|
|
78
|
-
raise "Invalid option key: #{option.inspect}" if option.to_s !~ /^[a-z_0-9
|
78
|
+
raise "Invalid option key: #{option.inspect}" if option.to_s !~ /^[a-z_0-9\-=.]+$/i
|
79
79
|
#raise "Invalid option value: #{value.inspect}" if value.to_s.include? "'"
|
80
80
|
value = value.gsub("'","\\'") if value.to_s.include? "'"
|
81
81
|
|
@@ -92,18 +92,23 @@ module Workflow
|
|
92
92
|
self.dependencies = self.dependencies - [dep]
|
93
93
|
Open.rm_rf self.files_dir if Open.exist? self.files_dir
|
94
94
|
FileUtils.cp_r dep.files_dir, self.files_dir if Open.exist?(dep.files_dir)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
dep.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
95
|
+
|
96
|
+
if dep.overriden || ! Workflow.job_path?(dep.path)
|
97
|
+
Open.link dep.path, self.tmp_path
|
98
|
+
else
|
99
|
+
Open.ln_h dep.path, self.tmp_path
|
100
|
+
|
101
|
+
case remove.to_s
|
102
|
+
when 'true'
|
103
|
+
dep.clean
|
104
|
+
when 'recursive'
|
105
|
+
(dep.dependencies + dep.rec_dependencies).uniq.each do |d|
|
106
|
+
next if d.overriden
|
107
|
+
d.clean unless config(:remove_dep, d.task_signature, d.task_name, d.workflow.to_s, :default => true).to_s == 'false'
|
108
|
+
end
|
109
|
+
dep.clean unless config(:remove_dep, dep.task_signature, dep.task_name, dep.workflow.to_s, :default => true).to_s == 'false'
|
110
|
+
end
|
111
|
+
end
|
107
112
|
else
|
108
113
|
if Open.exists?(dep.files_dir)
|
109
114
|
Open.rm_rf self.files_dir
|
@@ -4,7 +4,7 @@ module Workflow
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.nextflow_includes(file)
|
7
|
-
Open.read(file).scan(/^include\s*{\s*(
|
7
|
+
Open.read(file).scan(/^include\s*{\s*([^\s]*?)\s+.*?}\s*from\s+["'](.*?)["'](?:\s*params.*)?/).collect{|p| p}.uniq
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.nextflow_recursive_params(file)
|
@@ -48,25 +48,43 @@ module Workflow
|
|
48
48
|
task name => result do
|
49
49
|
work = file('work')
|
50
50
|
profile = config :profile, :nextflow
|
51
|
+
config_file = config :config, :nextflow
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
nextflow_inputs = {}
|
54
|
+
|
55
|
+
inputs.zip(inputs.fields).collect do |v,f|
|
56
|
+
v = if String === v && m = v.match(/^JOB_FILE:(.*)/)
|
57
|
+
file(m[1])
|
58
|
+
elsif v.nil?
|
59
|
+
Rbbt::Config.get(['nextflow', f] * "_", 'default', f)
|
60
|
+
else
|
61
|
+
v
|
62
|
+
end
|
63
|
+
|
64
|
+
if f.to_s.include?("-")
|
65
|
+
p,_sep, section = f.to_s.partition("-")
|
66
|
+
name = [section, p] * "."
|
57
67
|
else
|
58
|
-
|
68
|
+
name = f
|
59
69
|
end
|
70
|
+
|
71
|
+
nextflow_inputs[name] = v
|
60
72
|
end
|
61
73
|
|
62
|
-
inputs.replace new_inputs
|
63
|
-
|
64
74
|
Misc.in_dir file('stage') do
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
75
|
+
|
76
|
+
cmd = "nextflow "
|
77
|
+
|
78
|
+
cmd += " -C #{config_file}" if config_file
|
79
|
+
|
80
|
+
cmd += " run"
|
81
|
+
|
82
|
+
cmd += " -work-dir #{work} -ansi-log false"
|
83
|
+
|
84
|
+
cmd += " -profile #{profile}" if profile
|
85
|
+
|
86
|
+
|
87
|
+
cmd("#{cmd} #{file}", nextflow_inputs.merge('add_option_dashes' => true))
|
70
88
|
end
|
71
89
|
|
72
90
|
output_file = file(output).glob.first if output
|
@@ -21,6 +21,7 @@ $ rbbt slurm list [options]
|
|
21
21
|
-j--job* Job ids
|
22
22
|
-s--search* Regular expression
|
23
23
|
-t--tail* Show the last lines of the STDERR
|
24
|
+
-l--long Show more entries
|
24
25
|
-p--progress Report progress of job and the dependencies
|
25
26
|
-BP--batch_parameters show batch parameters
|
26
27
|
-BPP--batch_procpath show Procpath performance summary
|
@@ -40,6 +41,8 @@ end
|
|
40
41
|
batch_system = options.delete :batch_system
|
41
42
|
batch_system ||= 'auto'
|
42
43
|
|
44
|
+
long = options.delete :long
|
45
|
+
|
43
46
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
44
47
|
|
45
48
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
@@ -183,24 +186,24 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
183
186
|
|
184
187
|
|
185
188
|
puts Log.color :blue, dir
|
186
|
-
puts Log.color(:magenta, "Creation: ") << File.mtime(File.join(dir, 'command.batch')).to_s
|
187
|
-
puts Log.color(:magenta, "Started: ") << File.ctime(File.join(dir, 'std.err')).to_s if File.exist?(File.join(dir, 'std.err'))
|
188
|
-
puts Log.color(:magenta, "Manifest: ") << Log.color(:yellow, manifest)
|
189
|
+
puts Log.color(:magenta, "Creation: ") << File.mtime(File.join(dir, 'command.batch')).to_s if long
|
190
|
+
puts Log.color(:magenta, "Started: ") << File.ctime(File.join(dir, 'std.err')).to_s if File.exist?(File.join(dir, 'std.err')) && long
|
191
|
+
puts Log.color(:magenta, "Manifest: ") << Log.color(:yellow, manifest) if long
|
189
192
|
puts Log.color(:magenta, "Step path: ") << Log.color(:yellow, step_path)
|
190
193
|
puts Log.color(:magenta, "Done: ") << File.mtime(File.join(dir, 'exit.status')).to_s if File.exist?(File.join(dir, 'exit.status'))
|
191
|
-
puts Log.color(:magenta, "Exec: ") << (exe || "Missing")
|
192
|
-
puts Log.color(:magenta, "CMD: ") << (Log.color(:yellow, cmd) || "Missing")
|
193
|
-
puts Log.color(:magenta, "HOME: ") << Log.color(:yellow, container_home) if container_home
|
194
|
+
puts Log.color(:magenta, "Exec: ") << (exe || "Missing") if long
|
195
|
+
puts Log.color(:magenta, "CMD: ") << (Log.color(:yellow, cmd) || "Missing") if long
|
196
|
+
puts Log.color(:magenta, "HOME: ") << Log.color(:yellow, container_home) if container_home && long
|
194
197
|
if different_system
|
195
198
|
puts Log.color(:magenta, "Job ID (#{Log.color(:red, job_batch_system)}): ") << (exit_status ? (exit_status == 0 ? Log.color(:green, "Done") : Log.color(:red, "Error")) + " (#{ id })" : Log.color(:green, id) )
|
196
199
|
else
|
197
200
|
puts Log.color(:magenta, "Job ID: ") << (exit_status ? (exit_status == 0 ? Log.color(:green, "Done") : Log.color(:red, "Error")) + " (#{ id })" : (running_jobs.include?(id) || $norunningjobs ? Log.color(:green, id) : Log.color(:red, id) ))
|
198
|
-
end
|
201
|
+
end
|
199
202
|
puts Log.color(:magenta, "Dependencies: ") << deps * ", " if deps
|
200
203
|
puts Log.color(:magenta, "Dependencies (can fail): ") << cadeps * ", " if cadeps
|
201
|
-
puts Log.color(:magenta, "Nodes: ") << nodes * ", "
|
204
|
+
puts Log.color(:magenta, "Nodes: ") << nodes * ", " if long
|
202
205
|
puts Log.color(:magenta, "Time elapsed: ") << Misc.format_seconds(time_elapsed) if time_elapsed
|
203
|
-
puts Log.color(:magenta, "Output: ") << File.exists?(File.join(dir, 'std.out')).to_s << (id.nil? || File.exists?(File.join(dir, 'exit.status')) ? "" : " (last update " + Misc.format_seconds(time_diff) + " ago)")
|
206
|
+
puts Log.color(:magenta, "Output: ") << File.exists?(File.join(dir, 'std.out')).to_s << (id.nil? || File.exists?(File.join(dir, 'exit.status')) ? "" : " (last update " + Misc.format_seconds(time_diff) + " ago)") if long
|
204
207
|
|
205
208
|
if options[:batch_parameters]
|
206
209
|
puts Log.color(:magenta, "BATCH parameters: ")
|
@@ -281,7 +284,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
281
284
|
puts CMD.cmd("grep -i -w 'Completed step' #{File.join(dir, 'std.err')} | grep -v 'Retrying dep.' | tail -n #{tail.to_i}", :no_fail => true).read
|
282
285
|
else
|
283
286
|
puts Log.color(:magenta, "Log tail: ")
|
284
|
-
puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | tail -n #{tail.to_i} ").read
|
287
|
+
puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | grep -v -e '^[[:space:]]*$' | tail -n #{tail.to_i} ").read
|
285
288
|
end
|
286
289
|
end
|
287
290
|
|
@@ -10,7 +10,7 @@ options = SOPT.setup <<EOF
|
|
10
10
|
|
11
11
|
Queue a job in Marenostrum
|
12
12
|
|
13
|
-
$ rbbt slurm tail <directory> [options]
|
13
|
+
$ rbbt slurm tail <directory|jobid> [options]
|
14
14
|
|
15
15
|
-h--help Print this help
|
16
16
|
EOF
|
@@ -35,8 +35,28 @@ directory = ARGV.shift
|
|
35
35
|
|
36
36
|
raise ParameterException if directory.nil?
|
37
37
|
|
38
|
-
|
38
|
+
if directory =~ /^[0-9]*$/
|
39
|
+
workdir = File.expand_path('~/rbbt-batch')
|
40
|
+
Path.setup(workdir)
|
41
|
+
|
42
|
+
workdir.glob("**/job.id").each do |file|
|
43
|
+
next unless directory == Open.read(file).strip
|
44
|
+
directory = File.dirname(file)
|
45
|
+
break
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
raise ParameterException, "Could not identify job #{directory}" unless File.exists?(directory)
|
39
50
|
|
40
51
|
require 'rbbt/hpc/slurm'
|
41
52
|
|
53
|
+
command_txt = Open.read(File.join(directory, 'command.batch'))
|
54
|
+
if m = command_txt.match(/#STEP_PATH: (.*)/)
|
55
|
+
step_path = m[1]
|
56
|
+
else
|
57
|
+
step_path = nil
|
58
|
+
end
|
59
|
+
|
60
|
+
puts Log.color(:magenta, "Step path: ") + step_path if step_path
|
61
|
+
|
42
62
|
HPC::BATCH_MODULE.follow_job directory, true
|
@@ -21,6 +21,7 @@ $ rbbt slurm list [options]
|
|
21
21
|
-j--job* Job ids
|
22
22
|
-s--search* Regular expression
|
23
23
|
-t--tail* Show the last lines of the STDERR
|
24
|
+
-l--long Show more entries
|
24
25
|
-p--progress Report progress of job and the dependencies
|
25
26
|
-BP--batch_parameters show batch parameters
|
26
27
|
-BPP--batch_procpath show Procpath performance summary
|
@@ -40,6 +41,8 @@ end
|
|
40
41
|
batch_system = options.delete :batch_system
|
41
42
|
batch_system ||= 'auto'
|
42
43
|
|
44
|
+
long = options.delete :long
|
45
|
+
|
43
46
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
44
47
|
|
45
48
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
@@ -183,24 +186,24 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
183
186
|
|
184
187
|
|
185
188
|
puts Log.color :blue, dir
|
186
|
-
puts Log.color(:magenta, "Creation: ") << File.mtime(File.join(dir, 'command.batch')).to_s
|
187
|
-
puts Log.color(:magenta, "Started: ") << File.ctime(File.join(dir, 'std.err')).to_s if File.exist?(File.join(dir, 'std.err'))
|
188
|
-
puts Log.color(:magenta, "Manifest: ") << Log.color(:yellow, manifest)
|
189
|
+
puts Log.color(:magenta, "Creation: ") << File.mtime(File.join(dir, 'command.batch')).to_s if long
|
190
|
+
puts Log.color(:magenta, "Started: ") << File.ctime(File.join(dir, 'std.err')).to_s if File.exist?(File.join(dir, 'std.err')) && long
|
191
|
+
puts Log.color(:magenta, "Manifest: ") << Log.color(:yellow, manifest) if long
|
189
192
|
puts Log.color(:magenta, "Step path: ") << Log.color(:yellow, step_path)
|
190
193
|
puts Log.color(:magenta, "Done: ") << File.mtime(File.join(dir, 'exit.status')).to_s if File.exist?(File.join(dir, 'exit.status'))
|
191
|
-
puts Log.color(:magenta, "Exec: ") << (exe || "Missing")
|
192
|
-
puts Log.color(:magenta, "CMD: ") << (Log.color(:yellow, cmd) || "Missing")
|
193
|
-
puts Log.color(:magenta, "HOME: ") << Log.color(:yellow, container_home) if container_home
|
194
|
+
puts Log.color(:magenta, "Exec: ") << (exe || "Missing") if long
|
195
|
+
puts Log.color(:magenta, "CMD: ") << (Log.color(:yellow, cmd) || "Missing") if long
|
196
|
+
puts Log.color(:magenta, "HOME: ") << Log.color(:yellow, container_home) if container_home && long
|
194
197
|
if different_system
|
195
198
|
puts Log.color(:magenta, "Job ID (#{Log.color(:red, job_batch_system)}): ") << (exit_status ? (exit_status == 0 ? Log.color(:green, "Done") : Log.color(:red, "Error")) + " (#{ id })" : Log.color(:green, id) )
|
196
199
|
else
|
197
200
|
puts Log.color(:magenta, "Job ID: ") << (exit_status ? (exit_status == 0 ? Log.color(:green, "Done") : Log.color(:red, "Error")) + " (#{ id })" : (running_jobs.include?(id) || $norunningjobs ? Log.color(:green, id) : Log.color(:red, id) ))
|
198
|
-
end
|
201
|
+
end
|
199
202
|
puts Log.color(:magenta, "Dependencies: ") << deps * ", " if deps
|
200
203
|
puts Log.color(:magenta, "Dependencies (can fail): ") << cadeps * ", " if cadeps
|
201
|
-
puts Log.color(:magenta, "Nodes: ") << nodes * ", "
|
204
|
+
puts Log.color(:magenta, "Nodes: ") << nodes * ", " if long
|
202
205
|
puts Log.color(:magenta, "Time elapsed: ") << Misc.format_seconds(time_elapsed) if time_elapsed
|
203
|
-
puts Log.color(:magenta, "Output: ") << File.exists?(File.join(dir, 'std.out')).to_s << (id.nil? || File.exists?(File.join(dir, 'exit.status')) ? "" : " (last update " + Misc.format_seconds(time_diff) + " ago)")
|
206
|
+
puts Log.color(:magenta, "Output: ") << File.exists?(File.join(dir, 'std.out')).to_s << (id.nil? || File.exists?(File.join(dir, 'exit.status')) ? "" : " (last update " + Misc.format_seconds(time_diff) + " ago)") if long
|
204
207
|
|
205
208
|
if options[:batch_parameters]
|
206
209
|
puts Log.color(:magenta, "BATCH parameters: ")
|
@@ -281,7 +284,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
281
284
|
puts CMD.cmd("grep -i -w 'Completed step' #{File.join(dir, 'std.err')} | grep -v 'Retrying dep.' | tail -n #{tail.to_i}", :no_fail => true).read
|
282
285
|
else
|
283
286
|
puts Log.color(:magenta, "Log tail: ")
|
284
|
-
puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | tail -n #{tail.to_i} ").read
|
287
|
+
puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | grep -v -e '^[[:space:]]*$' | tail -n #{tail.to_i} ").read
|
285
288
|
end
|
286
289
|
end
|
287
290
|
|
@@ -10,7 +10,7 @@ options = SOPT.setup <<EOF
|
|
10
10
|
|
11
11
|
Queue a job in Marenostrum
|
12
12
|
|
13
|
-
$ rbbt slurm tail <directory> [options]
|
13
|
+
$ rbbt slurm tail <directory|jobid> [options]
|
14
14
|
|
15
15
|
-h--help Print this help
|
16
16
|
EOF
|
@@ -35,8 +35,28 @@ directory = ARGV.shift
|
|
35
35
|
|
36
36
|
raise ParameterException if directory.nil?
|
37
37
|
|
38
|
-
|
38
|
+
if directory =~ /^[0-9]*$/
|
39
|
+
workdir = File.expand_path('~/rbbt-batch')
|
40
|
+
Path.setup(workdir)
|
41
|
+
|
42
|
+
workdir.glob("**/job.id").each do |file|
|
43
|
+
next unless directory == Open.read(file).strip
|
44
|
+
directory = File.dirname(file)
|
45
|
+
break
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
raise ParameterException, "Could not identify job #{directory}" unless File.exists?(directory)
|
39
50
|
|
40
51
|
require 'rbbt/hpc/slurm'
|
41
52
|
|
53
|
+
command_txt = Open.read(File.join(directory, 'command.batch'))
|
54
|
+
if m = command_txt.match(/#STEP_PATH: (.*)/)
|
55
|
+
step_path = m[1]
|
56
|
+
else
|
57
|
+
step_path = nil
|
58
|
+
end
|
59
|
+
|
60
|
+
puts Log.color(:magenta, "Step path: ") + step_path if step_path
|
61
|
+
|
42
62
|
HPC::BATCH_MODULE.follow_job directory, true
|
@@ -21,6 +21,7 @@ $ rbbt slurm list [options]
|
|
21
21
|
-j--job* Job ids
|
22
22
|
-s--search* Regular expression
|
23
23
|
-t--tail* Show the last lines of the STDERR
|
24
|
+
-l--long Show more entries
|
24
25
|
-p--progress Report progress of job and the dependencies
|
25
26
|
-BP--batch_parameters show batch parameters
|
26
27
|
-BPP--batch_procpath show Procpath performance summary
|
@@ -40,6 +41,8 @@ end
|
|
40
41
|
batch_system = options.delete :batch_system
|
41
42
|
batch_system ||= 'auto'
|
42
43
|
|
44
|
+
long = options.delete :long
|
45
|
+
|
43
46
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
44
47
|
|
45
48
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
@@ -183,24 +186,24 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
183
186
|
|
184
187
|
|
185
188
|
puts Log.color :blue, dir
|
186
|
-
puts Log.color(:magenta, "Creation: ") << File.mtime(File.join(dir, 'command.batch')).to_s
|
187
|
-
puts Log.color(:magenta, "Started: ") << File.ctime(File.join(dir, 'std.err')).to_s if File.exist?(File.join(dir, 'std.err'))
|
188
|
-
puts Log.color(:magenta, "Manifest: ") << Log.color(:yellow, manifest)
|
189
|
+
puts Log.color(:magenta, "Creation: ") << File.mtime(File.join(dir, 'command.batch')).to_s if long
|
190
|
+
puts Log.color(:magenta, "Started: ") << File.ctime(File.join(dir, 'std.err')).to_s if File.exist?(File.join(dir, 'std.err')) && long
|
191
|
+
puts Log.color(:magenta, "Manifest: ") << Log.color(:yellow, manifest) if long
|
189
192
|
puts Log.color(:magenta, "Step path: ") << Log.color(:yellow, step_path)
|
190
193
|
puts Log.color(:magenta, "Done: ") << File.mtime(File.join(dir, 'exit.status')).to_s if File.exist?(File.join(dir, 'exit.status'))
|
191
|
-
puts Log.color(:magenta, "Exec: ") << (exe || "Missing")
|
192
|
-
puts Log.color(:magenta, "CMD: ") << (Log.color(:yellow, cmd) || "Missing")
|
193
|
-
puts Log.color(:magenta, "HOME: ") << Log.color(:yellow, container_home) if container_home
|
194
|
+
puts Log.color(:magenta, "Exec: ") << (exe || "Missing") if long
|
195
|
+
puts Log.color(:magenta, "CMD: ") << (Log.color(:yellow, cmd) || "Missing") if long
|
196
|
+
puts Log.color(:magenta, "HOME: ") << Log.color(:yellow, container_home) if container_home && long
|
194
197
|
if different_system
|
195
198
|
puts Log.color(:magenta, "Job ID (#{Log.color(:red, job_batch_system)}): ") << (exit_status ? (exit_status == 0 ? Log.color(:green, "Done") : Log.color(:red, "Error")) + " (#{ id })" : Log.color(:green, id) )
|
196
199
|
else
|
197
200
|
puts Log.color(:magenta, "Job ID: ") << (exit_status ? (exit_status == 0 ? Log.color(:green, "Done") : Log.color(:red, "Error")) + " (#{ id })" : (running_jobs.include?(id) || $norunningjobs ? Log.color(:green, id) : Log.color(:red, id) ))
|
198
|
-
end
|
201
|
+
end
|
199
202
|
puts Log.color(:magenta, "Dependencies: ") << deps * ", " if deps
|
200
203
|
puts Log.color(:magenta, "Dependencies (can fail): ") << cadeps * ", " if cadeps
|
201
|
-
puts Log.color(:magenta, "Nodes: ") << nodes * ", "
|
204
|
+
puts Log.color(:magenta, "Nodes: ") << nodes * ", " if long
|
202
205
|
puts Log.color(:magenta, "Time elapsed: ") << Misc.format_seconds(time_elapsed) if time_elapsed
|
203
|
-
puts Log.color(:magenta, "Output: ") << File.exists?(File.join(dir, 'std.out')).to_s << (id.nil? || File.exists?(File.join(dir, 'exit.status')) ? "" : " (last update " + Misc.format_seconds(time_diff) + " ago)")
|
206
|
+
puts Log.color(:magenta, "Output: ") << File.exists?(File.join(dir, 'std.out')).to_s << (id.nil? || File.exists?(File.join(dir, 'exit.status')) ? "" : " (last update " + Misc.format_seconds(time_diff) + " ago)") if long
|
204
207
|
|
205
208
|
if options[:batch_parameters]
|
206
209
|
puts Log.color(:magenta, "BATCH parameters: ")
|
@@ -281,7 +284,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
281
284
|
puts CMD.cmd("grep -i -w 'Completed step' #{File.join(dir, 'std.err')} | grep -v 'Retrying dep.' | tail -n #{tail.to_i}", :no_fail => true).read
|
282
285
|
else
|
283
286
|
puts Log.color(:magenta, "Log tail: ")
|
284
|
-
puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | tail -n #{tail.to_i} ").read
|
287
|
+
puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | grep -v -e '^[[:space:]]*$' | tail -n #{tail.to_i} ").read
|
285
288
|
end
|
286
289
|
end
|
287
290
|
|
@@ -10,7 +10,7 @@ options = SOPT.setup <<EOF
|
|
10
10
|
|
11
11
|
Queue a job in Marenostrum
|
12
12
|
|
13
|
-
$ rbbt slurm tail <directory> [options]
|
13
|
+
$ rbbt slurm tail <directory|jobid> [options]
|
14
14
|
|
15
15
|
-h--help Print this help
|
16
16
|
EOF
|
@@ -35,8 +35,28 @@ directory = ARGV.shift
|
|
35
35
|
|
36
36
|
raise ParameterException if directory.nil?
|
37
37
|
|
38
|
-
|
38
|
+
if directory =~ /^[0-9]*$/
|
39
|
+
workdir = File.expand_path('~/rbbt-batch')
|
40
|
+
Path.setup(workdir)
|
41
|
+
|
42
|
+
workdir.glob("**/job.id").each do |file|
|
43
|
+
next unless directory == Open.read(file).strip
|
44
|
+
directory = File.dirname(file)
|
45
|
+
break
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
raise ParameterException, "Could not identify job #{directory}" unless File.exists?(directory)
|
39
50
|
|
40
51
|
require 'rbbt/hpc/slurm'
|
41
52
|
|
53
|
+
command_txt = Open.read(File.join(directory, 'command.batch'))
|
54
|
+
if m = command_txt.match(/#STEP_PATH: (.*)/)
|
55
|
+
step_path = m[1]
|
56
|
+
else
|
57
|
+
step_path = nil
|
58
|
+
end
|
59
|
+
|
60
|
+
puts Log.color(:magenta, "Step path: ") + step_path if step_path
|
61
|
+
|
42
62
|
HPC::BATCH_MODULE.follow_job directory, true
|
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.33.
|
4
|
+
version: 5.33.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|