rbbt-util 5.32.1 → 5.32.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4491182540571f16f4059ec742f210152862e77bda8c31355285c81daf8bfd8e
4
- data.tar.gz: 313a4e9252f8b443fef52b4267e94b177f9cacd36a89d6db63010b4ae7fb275f
3
+ metadata.gz: 612e1472bae3839b68f143d639025a9bb19294525ecc0e95df99702883af31d3
4
+ data.tar.gz: bea8c5ec09525363447c5bdc140f899f8a22ccb311d225da061b01d6f68bcf10
5
5
  SHA512:
6
- metadata.gz: 81b4b06eac8a44027a0c0f97510c75a2b0f3daf6594da4cd977c5d197318ee7e22db35e0c12f68dced5ab5aa0c1f0c152be77ed7bafe8c5588f2d274292b2035
7
- data.tar.gz: 5ea83c058de9bde5bbae17b1c08308a7311c5c48d1c589f236300c3f437b667bd7012ad48a2c4890ab0c924168916809569367155b3a9300723a9c6596837d52
6
+ metadata.gz: 0aef55d55b97f40011aeaa3f09450dd623ad6d682b4b3ef5dc3f2df603efeeede2e50b3be2f4f586e502adb6a4a0fd898113d3c5c892212170edb4cde7b7f6a7
7
+ data.tar.gz: 81261ef8e8da6ada5c1d8e672fdbd31ff6dc67a7a08edb4b6a3dcee10cfc6ed3f7abacf0c3628d604839e2743de043793c5169a147bd9b528c2afd614dca62b9
data/lib/rbbt/hpc/lsf.rb CHANGED
@@ -8,7 +8,7 @@ module HPC
8
8
  def self.batch_system_variables
9
9
  <<-EOF
10
10
  let TOTAL_PROCESORS="$(cat /proc/cpuinfo|grep ^processor |wc -l)"
11
- let MAX_MEMORY_DEFAULT="$(grep MemTotal /proc/meminfo|grep -o "[[:digit:]]*") / ( (1024 * $TOTAL_PROCESORS) / $SLURM_CPUS_PER_TASK )"
11
+ let MAX_MEMORY_DEFAULT="$(grep MemTotal /proc/meminfo|grep -o "[[:digit:]]*") / ( (1024 * $TOTAL_PROCESORS) / $LSB_MAX_NUM_PROCESSORS )"
12
12
  [ ! -z $LSB_MAX_MEM_RUSAGE ] && let MAX_MEMORY="$LSB_MAX_MEM_RUSAGE" || MAX_MEMORY="$MAX_MEMORY_DEFAULT"
13
13
  export MAX_MEMORY_DEFAULT
14
14
  export MAX_MEMORY
@@ -132,7 +132,7 @@ module Persist
132
132
 
133
133
  def read_lock
134
134
  read if closed?
135
- if read?
135
+ if read? || write?
136
136
  return yield
137
137
  end
138
138
 
@@ -40,7 +40,7 @@ module TSV
40
40
  # Process fields line
41
41
 
42
42
  preamble << line if line
43
- while line and (TrueClass === @header_hash or (String === @header_hash and Misc.fixutf8(line) =~ /^#{@header_hash}/ ))
43
+ while line && (TrueClass === @header_hash || (String === @header_hash && Misc.fixutf8(line) =~ /^#{@header_hash}/ ))
44
44
  @fields = line.split(@sep, -1)
45
45
  @key_field = @fields.shift
46
46
  @key_field = @key_field[(0 + header_hash.length)..-1] if String === @header_hash
@@ -49,7 +49,7 @@ module TSV
49
49
  line = (@header_hash != "" ? stream.gets : nil)
50
50
  line = Misc.fixutf8 line.chomp if line
51
51
  preamble << line if line
52
- @header_hash = false if TrueClass === @header_hash
52
+ @header_hash = false if TrueClass === @header_hash || @header_hash == ""
53
53
  end
54
54
 
55
55
  @preamble = preamble[0..-3] * "\n"
@@ -56,6 +56,7 @@ module TSV
56
56
  preambles = []
57
57
 
58
58
  streams = streams.collect do |stream|
59
+
59
60
  parser = TSV::Parser.new stream, options.dup
60
61
  sfields = parser.fields
61
62
 
@@ -43,7 +43,7 @@ module Misc
43
43
  File.mkfifo path
44
44
  yield path
45
45
  ensure
46
- FileUtils.rm path if erase
46
+ FileUtils.rm path if erase && File.exists?(path)
47
47
  end
48
48
  end
49
49
 
data/lib/rbbt/workflow.rb CHANGED
@@ -187,17 +187,21 @@ module Workflow
187
187
  clean_name = wf_name.sub(/::.*/,'')
188
188
  Log.info{"Looking for '#{wf_name}' in '#{clean_name}'"}
189
189
  require_workflow clean_name
190
- return Misc.string2const Misc.camel_case(wf_name)
190
+ workflow = Misc.string2const Misc.camel_case(wf_name)
191
+ workflow.load_documentation
192
+ return workflow
191
193
  end
192
194
 
193
195
  Log.high{"Loading workflow #{wf_name}"}
194
196
  require_local_workflow(wf_name) or
195
197
  (Workflow.autoinstall and `rbbt workflow install #{Misc.snake_case(wf_name)} || rbbt workflow install #{wf_name}` and require_local_workflow(wf_name)) or raise("Workflow not found or could not be loaded: #{ wf_name }")
196
- begin
197
- Misc.string2const Misc.camel_case(wf_name)
198
- rescue
199
- Workflow.workflows.last || true
200
- end
198
+ workflow = begin
199
+ Misc.string2const Misc.camel_case(wf_name)
200
+ rescue
201
+ Workflow.workflows.last || true
202
+ end
203
+ workflow.load_documentation
204
+ workflow
201
205
  end
202
206
 
203
207
  attr_accessor :description
@@ -74,6 +74,7 @@ module Workflow
74
74
  def dep_task(name, workflow, oname, *rest, &block)
75
75
  dep(workflow, oname, *rest, &block)
76
76
  extension workflow.tasks[oname].extension if workflow.tasks.include?(oname) unless @extension
77
+ returns workflow.tasks[oname].result_description if workflow.tasks.include?(oname) unless @result_description
77
78
  task name do
78
79
  raise RbbtException, "dependency not found in dep_task" if dependencies.empty?
79
80
  dep = dependencies.last
@@ -45,10 +45,25 @@ module Workflow
45
45
  end
46
46
 
47
47
  def load_documentation
48
- @documentation = Workflow.parse_workflow_doc documentation_markdown
48
+ return if @documentation
49
+ @documentation ||= Workflow.parse_workflow_doc documentation_markdown
49
50
  @documentation[:tasks].each do |task, description|
50
- raise "Documentation for #{ task }, but not a #{ self.to_s } task" unless tasks.include? task.to_sym
51
- tasks[task.to_sym].description = description
51
+ if task.include? "#"
52
+ workflow, task = task.split("#")
53
+ workflow = begin
54
+ Kernel.const_get workflow
55
+ rescue
56
+ next
57
+ end
58
+ else
59
+ workflow = self
60
+ end
61
+
62
+ if workflow.tasks.include? task.to_sym
63
+ workflow.tasks[task.to_sym].description = description
64
+ else
65
+ Log.low "Documentation for #{ task }, but not a #{ workflow.to_s } task"
66
+ end
52
67
  end
53
68
  end
54
69
 
@@ -180,11 +180,17 @@ rbbt.png_plot('#{plot}', 'plot(timeline)', width=#{width}, height=#{height}, poi
180
180
  jobs += step.rec_dependencies + [step]
181
181
  step.info[:archived_info].each do |path,ainfo|
182
182
  archived_step = Step.new path
183
- class << archived_step
184
- self
185
- end.define_method :info do
183
+
184
+ archived_step.define_singleton_method :info do
186
185
  ainfo
187
186
  end
187
+
188
+ #class << archived_step
189
+ # self
190
+ #end.define_method :info do
191
+ # ainfo
192
+ #end
193
+
188
194
  jobs << archived_step
189
195
  end if step.info[:archived_info]
190
196
 
@@ -8,9 +8,11 @@ $0 = "rbbt #{$previous_commands*" "} #{ File.basename(__FILE__) }" if $previous_
8
8
 
9
9
  options = SOPT.setup <<EOF
10
10
 
11
- Make a job forget all its dependencies and archive their meta-data
11
+ Make a job forget its dependencies and archive their meta-data
12
12
 
13
- $ #{$0} [options] <job_path>
13
+ $ #{$0} [options] <job_path> [<task_name>|<workflow>#<task_name>] ...
14
+
15
+ Specific dependencies can be specified as . Otherwise, all are forgoten.
14
16
 
15
17
  -h--help Print this help
16
18
  -p--purge Purge dependencies
@@ -26,7 +28,7 @@ if options[:help]
26
28
  exit 0
27
29
  end
28
30
 
29
- path = ARGV[0]
31
+ path, *remove = ARGV
30
32
 
31
33
  raise ParameterException, "No path given" if path.nil?
32
34
  step = Workflow.load_step path
@@ -34,10 +36,20 @@ step = Workflow.load_step path
34
36
  step.archive_deps
35
37
  step.copy_files_dir
36
38
  dependencies = step.dependencies
37
- step.set_info :dependencies, []
38
39
 
39
- if options[:purge]
40
+ if remove && remove.any?
41
+ remove_paths = dependencies.select do |dep|
42
+ remove.include?(dep.task_name) || remove.include?([dep.workflow.to_s, dep.task_name] * "#")
43
+ end.collect{|dep| dep.path }
44
+ else
45
+ remove_paths = dependencies.collect{|dep| dep.path }
46
+ end
47
+
48
+ step.set_info :dependencies, step.info[:dependencies].reject{|info| remove_paths.include? info.last}
49
+
50
+ if options[:purge] || options[:recursive_purge]
40
51
  dependencies.each do |dependency|
52
+ next unless remove_paths.include? dependency.path
41
53
  Step.purge(dependency.path, options[:recursive_purge])
42
54
  end
43
55
  end
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.32.1
4
+ version: 5.32.2
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-04-21 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake