rbbt-util 5.33.6 → 5.33.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ef9895840235ea220e85895364588fca0c56b1ed8673483474465bfbf94a32b
4
- data.tar.gz: 68ba6769881c9118256efd14c8d05ed1ca6f8ab56733800c45c25631016647d0
3
+ metadata.gz: f4272048a5c86e74b051600f0db895ea42f4ad51509a0de9ce88452d27133746
4
+ data.tar.gz: f10d19e028de390beb5e2649c7d2f1e0a7754d3235abe3eeba2790946b347f64
5
5
  SHA512:
6
- metadata.gz: 53c4c81fcfafd8e001f33886323829e230a93731ba23379e1f40358f3bcfae72931d3978d2db3a490b48f22c618462947d5f63a3cc7d135564588d4f6b48aae8
7
- data.tar.gz: c53364bbc000b098d4b80afaab6fa8fb16802f9106bfcb8a0aa847b6b8d970e373f102a0fec6021e817a6ebec58d7dc7586c315c9f3aee67481d975d02558abc
6
+ metadata.gz: 0667eb9d5783d7722c33f72a66a1c406d330d086a37660aa7682006d10fe15860a9e4cbfcb461f17ed15b146fa294a6f6d8158d937884f14dc7952908f63c357
7
+ data.tar.gz: f3ba25b347bc4a7f7b56ecdbd1a0bef932b646ac030b3d98fe6ddb76f36a6863073f4692747ceef32c42e4344538a7ee19b531a25b16cc2fa208b201887b441e
@@ -544,7 +544,7 @@ env > #{batch_options[:fenv]}
544
544
  Misc.add_defaults options,
545
545
  :batch_dir => batch_dir,
546
546
  :inputs_dir => File.join(batch_dir, "inputs_dir"),
547
- :workflows => workflows_to_load * ","
547
+ :workflows => workflows_to_load.uniq * ","
548
548
 
549
549
  options[:procpath_performance] ||= File.join(batch_dir, "procpath##{procpath.gsub(',', '#')}") if procpath
550
550
 
@@ -1,6 +1,7 @@
1
1
  module HPC
2
2
  module Orchestration
3
3
  def self.check_chains(chains, job)
4
+ return [] if Symbol === job.overriden
4
5
  matches = []
5
6
  chains.each do |name, chain|
6
7
  next unless chain[:tasks].include?(job.workflow.to_s)
@@ -36,95 +37,6 @@ module HPC
36
37
  (job.dependencies + job.input_dependencies).uniq.select{|d| ! d.done? || d.dirty? }
37
38
  end
38
39
 
39
- #def self.job_workload(job)
40
- # workload = []
41
- # heap = []
42
- # heap << job
43
- # while job = heap.pop
44
- # next if job.done?
45
- # workload << job
46
- # heap.concat job_dependencies(job)
47
- # heap.uniq!
48
- # end
49
- # workload.uniq
50
- #end
51
-
52
- #def self.top_level_job(jobs)
53
- # top = jobs.select do |job|
54
- # (jobs - job_workload(job)).empty? &&
55
- # (job_workload(job) - jobs).select{|j| (job_workload(j) & jobs).any? }.empty?
56
- # end
57
- # return nil if top.length != 1
58
- # top.first
59
- #end
60
-
61
- #def self.job_chains(rules, job)
62
- # workload = job_workload(job)
63
- # chains = parse_chains(rules)
64
-
65
- # chain_jobs = {}
66
- # workload.each do |job|
67
- # check_chains(chains, job).each do |match|
68
- # chain_jobs[match] ||= []
69
- # chain_jobs[match] << job
70
- # end
71
- # end
72
-
73
- # job_chains = []
74
-
75
- # seen = []
76
- # chain_jobs.sort_by{|name,jobs| jobs.length }.reverse.each do |name,jobs|
77
- # remain = jobs - seen
78
- # next unless remain.length > 1
79
- # top_level_job = top_level_job(jobs)
80
- # next if top_level_job.nil?
81
- # job_chains << {:jobs => remain, :rules => chains[name][:rules], :top_level_job => top_level_job}
82
- # seen.concat remain
83
- # end
84
-
85
- # job_chains
86
- #end
87
-
88
- #def self._job_chains(rules, job)
89
- # workload = job_workload(job)
90
- # chains = parse_chains(rules)
91
-
92
- # matches = check_chains(chains, job)
93
-
94
- # job_chains = {}
95
- # job.dependencies.each do |dep|
96
- # dep_chains = _job_chains(rules, dep)
97
- # matches.each do |match|
98
- # if dep_chains[match] && dep_chains[match].include?(dep)
99
- # dep_chains[match].prepend job
100
- # end
101
- # end
102
- # job_chains.merge!(dep_chains)
103
- # end
104
-
105
- # matches.each do |match|
106
- # job_chains[match] ||= [job]
107
- # end
108
-
109
- # job_chains
110
- #end
111
-
112
- #def self.job_chains(rules, job)
113
- # job_chains = self._job_chains(rules, job)
114
- # iif job_chains
115
- # chains = parse_chains(rules)
116
-
117
- # seen = []
118
- # job_chains.collect do |name,jobs|
119
- # remain = jobs - seen
120
- # next unless remain.length > 1
121
- # top_level_job = top_level_job(jobs)
122
- # next if top_level_job.nil?
123
- # seen.concat remain
124
- # {:jobs => remain, :rules => chains[name][:rules], :top_level_job => top_level_job}
125
- # end.compact
126
- #end
127
-
128
40
  def self.job_chains(rules, job)
129
41
  chains = self.parse_chains(rules)
130
42
 
@@ -5,6 +5,19 @@ require 'rbbt/hpc/orchestrate/batches'
5
5
  module HPC
6
6
  module Orchestration
7
7
 
8
+ def prepare_for_execution(job)
9
+ rec_dependencies = job.rec_dependencies(true)
10
+
11
+ return if rec_dependencies.empty?
12
+
13
+ all_deps = rec_dependencies + [job]
14
+
15
+ all_deps.each do |dep|
16
+ Step.prepare_for_execution(dep)
17
+ end
18
+
19
+ end
20
+
8
21
  def orchestrate_job(job, options)
9
22
  options.delete "recursive_clean"
10
23
  options.delete "clean_task"
@@ -14,6 +27,9 @@ module HPC
14
27
  options.delete "detach"
15
28
  options.delete "jobname"
16
29
 
30
+ Log.high "Prepare for exec"
31
+ prepare_for_execution(job)
32
+
17
33
  if options[:orchestration_rules]
18
34
  rules = YAML.load(Open.read(options[:orchestration_rules]))
19
35
  elsif Rbbt.etc.slurm["default.yaml"].exists?
@@ -24,6 +40,7 @@ module HPC
24
40
 
25
41
  IndiferentHash.setup(rules)
26
42
 
43
+ Log.high "Compute batches"
27
44
  batches = HPC::Orchestration.job_batches(rules, job)
28
45
 
29
46
  batch_ids = {}
@@ -1,4 +1,6 @@
1
1
  module Rbbt
2
+
3
+ prepare_for_execution(job)
2
4
  def self.migrate_source_paths(path, resource = Rbbt, source = nil)
3
5
  if source
4
6
  lpath, *paths = Misc.ssh_run(source, <<-EOF).split("\n")
@@ -44,6 +46,8 @@ puts resource[path].find(search_path)
44
46
  excludes += (options[:exclude] || "").split(/,\s*/)
45
47
  excludes_str = excludes.collect{|s| "--exclude '#{s}'" } * " "
46
48
 
49
+ hard_link = options[:hard_link]
50
+
47
51
  other = options[:other] || []
48
52
 
49
53
  test_str = options[:test] ? '-nv' : ''
@@ -82,6 +86,8 @@ puts resource[path].find(search_path)
82
86
  # rsync_args = "-avztAXHP --copy-unsafe-links"
83
87
  rsync_args = "-avztAHP --copy-unsafe-links"
84
88
 
89
+ rsync_args << " --link-dest '#{source_path}'" if hard_link && ! options[:source]
90
+
85
91
  cmd = "rsync #{rsync_args} #{test_str} #{files_from_str} #{excludes_str} '#{source_path}' #{target_path} #{other * " "}"
86
92
 
87
93
  cmd << " && rm -Rf #{source_path}" if options[:delete] && ! options[:files]
@@ -181,8 +181,8 @@ class Step
181
181
  # end
182
182
  #end
183
183
 
184
- Log.high "Some newer files found: #{Misc.fingerprint outdated_time}" if outdated_time.any?
185
- Log.high "Some outdated files found: #{Misc.fingerprint outdated_dep}" if outdated_dep.any?
184
+ Log.medium "Some newer files found: #{Misc.fingerprint outdated_time}" if outdated_time.any?
185
+ Log.medium "Some outdated files found: #{Misc.fingerprint outdated_dep}" if outdated_dep.any?
186
186
 
187
187
  outdated_time + outdated_dep
188
188
  end
@@ -284,7 +284,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
284
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
285
285
  else
286
286
  puts Log.color(:magenta, "Log tail: ")
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
287
+ puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | grep -v -e '^[[:space:]]*$' | grep -v \"\\(STDOUT\\|STDERR\\):[[:space:]]*$\" | tail -n #{tail.to_i} ").read
288
288
  end
289
289
  end
290
290
 
@@ -284,7 +284,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
284
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
285
285
  else
286
286
  puts Log.color(:magenta, "Log tail: ")
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
287
+ puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | grep -v -e '^[[:space:]]*$' | grep -v \"\\(STDOUT\\|STDERR\\):[[:space:]]*$\" | tail -n #{tail.to_i} ").read
288
288
  end
289
289
  end
290
290
 
@@ -284,7 +284,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
284
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
285
285
  else
286
286
  puts Log.color(:magenta, "Log tail: ")
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
287
+ puts CMD.cmd(" cat #{File.join(dir, 'std.err')} | grep -v '^[^\\s:]*\\[3.m' | grep -v -e '^[[:space:]]*$' | grep -v \"\\(STDOUT\\|STDERR\\):[[:space:]]*$\" | tail -n #{tail.to_i} ").read
288
288
  end
289
289
  end
290
290
 
@@ -219,8 +219,8 @@ help = !!options.delete(:help)
219
219
  do_fork = !!options.delete(:fork)
220
220
  detach = !!options.delete(:detach)
221
221
  do_exec = !!options.delete(:exec)
222
- clean = !!options.delete(:clean)
223
222
  clean_task = options.delete(:clean_task)
223
+ clean = !!options.delete(:clean) || clean_task
224
224
  override_deps = options.delete(:override_deps)
225
225
  recursive_clean = !!options.delete(:recursive_clean)
226
226
  out = options.include?(:output) ? File.open(options[:output], 'wb') : STDOUT
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.6
4
+ version: 5.33.7
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-03-09 00:00:00.000000000 Z
11
+ date: 2022-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake