rbbt-util 5.30.9 → 5.30.10

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: 8985df2e0e2353224b5b075acb1bb04243d12351b8d904441009b93ccf490288
4
- data.tar.gz: 3a1e7d8561fcc72a83c2b0006c49cf50f35a87cfa037c0186bdc3563435a0e8f
3
+ metadata.gz: 48bec783cd5a61ffb37cb7cd80379ed9c90bbcfd2cecdb756cff0f2efd6240ed
4
+ data.tar.gz: 9da9e93fc5c89be3ca8f57f87ca2808f298e6a300cd13dfff4dd602a2bf1b4b0
5
5
  SHA512:
6
- metadata.gz: baae9121f3d757bcda2add9f666c740e5647f38d4bbc511d3456e36d466fc443c8a04b0ae12431bbf226e4e0c75eec5700b28720c117954005fe836ad74b76e8
7
- data.tar.gz: ea61b36cec82f6634546aecf5de356d7d3b3c9d28eccfad52282f309e5ad6e1e28c2bfb627a100970d6a553fdc90b3900a4247101210cfbaae461c35d8e0399a
6
+ metadata.gz: 23976e1fcc0a216a822fa19ec9f4510d87f5d19d334245f6cea87746d3b7b85cf3c41110ce2d36f3a793f6e5af1bd08ad2299ad0acb08f11efe711f3417da590
7
+ data.tar.gz: 2fe9f8dbea015d105076926f0407c1029a400f6eafce7f17edca075e4975ef5a4bd455f416cad4e2d4deadb2d7486988c00500687fc41352020ba71fa07a0f0c
@@ -67,6 +67,7 @@ module HPC
67
67
  def self.piggyback(job, job_rules, job_deps)
68
68
  return false unless job_rules["skip"]
69
69
  final_deps = job_deps - job_deps.collect{|dep| get_recursive_job_dependencies(dep)}.flatten.uniq
70
+ final_deps = final_deps.reject{|dep| dep.done? && dep.status == :noinfo }
70
71
  return final_deps.first if final_deps.length == 1
71
72
  return false
72
73
  end
@@ -104,19 +105,19 @@ module HPC
104
105
  def self.workload(job, rules, chains, options, seen = nil)
105
106
  return [] if job.done?
106
107
  if seen.nil?
107
- seen = {}
108
+ seen = {}
108
109
  target_job = true
109
110
  end
110
111
 
111
112
  job_rules = self.job_rules(rules, job)
112
113
  job_deps = get_job_dependencies(job)
113
114
 
114
-
115
115
  chain = chains[job]
116
- chain -= seen.keys if chain
116
+ chain = chain.reject{|j| seen.include? j.path} if chain
117
+ chain = chain.reject{|dep| dep.done? } if chain
117
118
  piggyback = piggyback(job, job_rules, job_deps)
118
119
  dep_ids = job_deps.collect do |dep|
119
- seen[dep] = nil if chain && chain.include?(dep) #&& ! job.input_dependencies.include?(dep)
120
+ seen[dep.path] ||= nil if chain && chain.include?(dep) #&& ! job.input_dependencies.include?(dep)
120
121
  next_options = IndiferentHash.setup(options.dup)
121
122
  if piggyback and piggyback == dep
122
123
  next_options[:piggyback] ||= []
@@ -129,12 +130,15 @@ module HPC
129
130
 
130
131
  ids = [ids].flatten.compact.collect{|id| ['canfail', id] * ":"} if job.canfail_paths.include? dep.path
131
132
 
132
- seen[dep] = ids
133
+ seen[dep.path] = ids
133
134
  ids
134
135
  end.compact.flatten.uniq
135
136
 
136
- return seen[job] || dep_ids if seen.include?(job)
137
- return seen[piggyback] if piggyback
137
+ return seen[job.path] || dep_ids if seen.include?(job.path)
138
+
139
+ if piggyback and seen[piggyback.path]
140
+ return seen[job.path] = seen[piggyback.path]
141
+ end
138
142
 
139
143
  job_rules.delete :chain_tasks
140
144
  job_rules.delete :tasks
@@ -172,7 +176,7 @@ module HPC
172
176
 
173
177
  manifest.uniq!
174
178
 
175
- job_options[:manifest] = manifest.collect{|j| j.workflow_short_path }
179
+ job_options[:manifest] = manifest.collect{|j| j.task_signature }
176
180
 
177
181
  job_options[:config_keys] = job_options[:config_keys].split(",").uniq * "," if job_options[:config_keys]
178
182
 
@@ -90,6 +90,8 @@ module Rbbt::Config
90
90
  options = tokens.pop if Hash === tokens.last
91
91
  default = options.nil? ? nil : options[:default]
92
92
 
93
+ tokens = ["key:" + key] if tokens.empty?
94
+
93
95
  tokens = tokens.flatten
94
96
  file, _sep, line = caller.reject{|l|
95
97
  l =~ /rbbt\/(?:resource\.rb|workflow\.rb)/ or
@@ -106,7 +108,6 @@ module Rbbt::Config
106
108
 
107
109
  entries = CACHE[key.to_s]
108
110
  priorities = {}
109
- tokens = tokens + ["key:" << key.to_s]
110
111
  tokens.each do |token|
111
112
  token_prio = match entries, token.to_s
112
113
  token_prio.each do |prio, values|
@@ -145,7 +146,6 @@ module Rbbt::Config
145
146
  Rbbt::Config.load_file(Rbbt.etc.config_profile[config].find)
146
147
  else
147
148
  key, value, *tokens = config.split(/\s/)
148
- tokens = ['key:' << key << '::0'] if tokens.empty?
149
149
  tokens = tokens.collect do |tok|
150
150
  tok, _sep, prio = tok.partition("::")
151
151
  prio = "0" if prio.nil? or prio.empty?
@@ -79,9 +79,10 @@ module Workflow
79
79
  dep = dependencies.last.join
80
80
  raise dep.get_exception if dep.error?
81
81
  set_info :result_type, dep.info[:result_type]
82
- forget = config :forget_dep_tasks, :forget_dep_tasks, :default => FORGET_DEP_TASKS
82
+ forget = config :forget_dep_tasks, "key:forget_dep_tasks", :default => FORGET_DEP_TASKS
83
83
  if forget
84
- remove = config :remove_dep_tasks, :remove_dep_tasks, :default => REMOVE_DEP_TASKS
84
+ remove = config :remove_dep_tasks, "key:remove_dep_tasks", :default => REMOVE_DEP_TASKS
85
+
85
86
  self.archive_deps
86
87
  self.copy_files_dir
87
88
  self.dependencies = self.dependencies - [dep]
@@ -92,7 +93,10 @@ module Workflow
92
93
  when 'true'
93
94
  dep.clean
94
95
  when 'recursive'
95
- dep.recursive_clean
96
+ dep.rec_dependencies.each do |d|
97
+ d.clean unless config(:remove_dep, d.task_signature, d.task_name, d.workflow.to_s, :default => true).to_s == 'false'
98
+ end
99
+ dep.clean unless config(:remove_dep, dep.task_signature, dep.task_name, dep.workflow.to_s, :default => true).to_s == 'false'
96
100
  end
97
101
  else
98
102
  if Open.exists?(dep.files_dir)
@@ -51,7 +51,7 @@ class Step
51
51
  end
52
52
  end
53
53
 
54
- def self.job_files_for_archive(files, recursive = false)
54
+ def self.job_files_for_archive(files, recursive = false, skip_overriden = false)
55
55
  job_files = Set.new
56
56
 
57
57
  jobs = files.collect do |file|
@@ -65,6 +65,8 @@ class Step
65
65
 
66
66
  jobs.each do |step|
67
67
  next unless File.exists?(step.path)
68
+ next if skip_overriden && step.overriden
69
+
68
70
  job_files << step.path
69
71
  job_files << step.info_file if File.exists?(step.info_file)
70
72
  job_files << Step.md5_file(step.path) if File.exists?(Step.md5_file step.path)
@@ -258,9 +260,9 @@ puts resource[path].find(search_path)
258
260
  end
259
261
  end
260
262
 
261
- def self.purge(path, recursive = false)
263
+ def self.purge(path, recursive = false, skip_overriden = true)
262
264
  path = [path] if String === path
263
- job_files = job_files_for_archive path, recursive
265
+ job_files = job_files_for_archive path, recursive, skip_overriden
264
266
 
265
267
  job_files.each do |file|
266
268
  begin
@@ -5,8 +5,9 @@ class TestConfig < Test::Unit::TestCase
5
5
  def setup
6
6
  Rbbt::Config.set({:cpus => 30}, :test_config, :test)
7
7
  Rbbt::Config.set(:cpus, 5, "slow::2", :test)
8
- Rbbt::Config.set({:token => "token"}, "token", "key:token")
8
+ Rbbt::Config.set({:token => "token"}, "token")
9
9
  Rbbt::Config.set(:notoken, "no_token")
10
+ Rbbt::Config.set({:emptytoken => "empty"})
10
11
  end
11
12
 
12
13
  def test_simple
@@ -19,8 +20,12 @@ class TestConfig < Test::Unit::TestCase
19
20
 
20
21
  def test_simple_no_token
21
22
  assert_equal "token", Rbbt::Config.get("token", "token")
22
- assert_equal "token", Rbbt::Config.get("token")
23
- assert_equal "no_token", Rbbt::Config.get("notoken")
23
+ assert_equal "no_token", Rbbt::Config.get("notoken", "key:notoken")
24
+ assert_equal 'token', Rbbt::Config.get("token", "key:token")
25
+ assert_equal 'token', Rbbt::Config.get("token")
26
+ assert_equal nil, Rbbt::Config.get("token", "someotherthing")
27
+ assert_equal "default_token", Rbbt::Config.get("token", 'unknown', :default => 'default_token')
28
+ assert_equal 'empty', Rbbt::Config.get("emptytoken", 'key:emptytoken')
24
29
  end
25
30
 
26
31
  def test_prio
@@ -54,6 +59,11 @@ class TestConfig < Test::Unit::TestCase
54
59
  assert_equal "V1", Rbbt::Config.get('key', 'token1', 'token2')
55
60
  end
56
61
 
62
+ def test_default
63
+ Rbbt::Config.add_entry 'key', 'V1', 'token1'
64
+ assert_equal "V3", Rbbt::Config.get('key', 'token2', :default => 'V3')
65
+ end
66
+
57
67
 
58
68
  end
59
69
 
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.30.9
4
+ version: 5.30.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2021-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake