rbbt-util 5.33.3 → 5.33.6
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/hpc/batch.rb +4 -1
- data/lib/rbbt/hpc/orchestrate.rb +5 -2
- data/lib/rbbt/hpc/slurm.rb +4 -1
- data/lib/rbbt/resource.rb +11 -0
- data/lib/rbbt/workflow/definition.rb +12 -12
- data/lib/rbbt/workflow/util/orchestrator.rb +3 -3
- data/share/Rlib/plot.R +1 -0
- 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
- data/share/rbbt_commands/workflow/prov +1 -1
- 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: 7ef9895840235ea220e85895364588fca0c56b1ed8673483474465bfbf94a32b
|
4
|
+
data.tar.gz: 68ba6769881c9118256efd14c8d05ed1ca6f8ab56733800c45c25631016647d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53c4c81fcfafd8e001f33886323829e230a93731ba23379e1f40358f3bcfae72931d3978d2db3a490b48f22c618462947d5f63a3cc7d135564588d4f6b48aae8
|
7
|
+
data.tar.gz: c53364bbc000b098d4b80afaab6fa8fb16802f9106bfcb8a0aa847b6b8d970e373f102a0fec6021e817a6ebec58d7dc7586c315c9f3aee67481d975d02558abc
|
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
|
|
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 = []
|
@@ -59,7 +60,9 @@ module HPC
|
|
59
60
|
|
60
61
|
if options[:dry_run]
|
61
62
|
puts Log.color(:magenta, "Manifest: ") + Log.color(:blue, job_options[:manifest] * ", ") + " - tasks: #{job_options[:task_cpus] || 1} - time: #{job_options[:time]} - config: #{job_options[:config_keys]}"
|
62
|
-
puts Log.color(:
|
63
|
+
puts Log.color(:magenta, "Deps: ") + Log.color(:blue, job_options[:batch_dependencies]*", ")
|
64
|
+
puts Log.color(:yellow, "Path: ") + top[:top_level].path
|
65
|
+
puts Log.color(:yellow, "Options: ") + Misc.fingerprint(job_options)
|
63
66
|
batch_ids[top] = top[:top_level].task_signature
|
64
67
|
else
|
65
68
|
id = run_job(top[:top_level], job_options)
|
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
|
@@ -93,22 +93,22 @@ module Workflow
|
|
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
95
|
|
96
|
-
if dep.overriden
|
96
|
+
if dep.overriden || ! Workflow.job_path?(dep.path)
|
97
97
|
Open.link dep.path, self.tmp_path
|
98
98
|
else
|
99
99
|
Open.ln_h dep.path, self.tmp_path
|
100
|
-
end
|
101
100
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
112
112
|
else
|
113
113
|
if Open.exists?(dep.files_dir)
|
114
114
|
Open.rm_rf self.files_dir
|
@@ -5,10 +5,10 @@ module Workflow
|
|
5
5
|
|
6
6
|
def self.job_workload(job)
|
7
7
|
workload = {job => []}
|
8
|
-
return workload if job.done?
|
8
|
+
return workload if job.done? && ! job.dirty?
|
9
9
|
|
10
10
|
job.dependencies.each do |dep|
|
11
|
-
next if dep.done?
|
11
|
+
next if dep.done? && ! job.dirty?
|
12
12
|
workload.merge!(job_workload(dep))
|
13
13
|
workload[job] += workload[dep]
|
14
14
|
workload[job] << dep
|
@@ -16,7 +16,7 @@ module Workflow
|
|
16
16
|
end
|
17
17
|
|
18
18
|
job.input_dependencies.each do |dep|
|
19
|
-
next if dep.done?
|
19
|
+
next if dep.done? && ! job.dirty?
|
20
20
|
workload.merge!(job_workload(dep))
|
21
21
|
workload[job] += workload[dep]
|
22
22
|
workload[job] << dep
|
data/share/Rlib/plot.R
CHANGED
@@ -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.6
|
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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|