rbbt-util 5.21.133 → 5.21.134

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
  SHA1:
3
- metadata.gz: a9b38322d267fc80b9c85230ca46ac6b9c241de0
4
- data.tar.gz: e42a40b18fb7a7f2071bdc7421c533f4d04c6839
3
+ metadata.gz: 9227ad4cb1b0693292f83fa73b32a7e93e394962
4
+ data.tar.gz: edffcead7218ee6b035ec40cf83ec81000225eec
5
5
  SHA512:
6
- metadata.gz: b0774253cc2ce55866e974c64c1be394d9490ae474a686fcebc43b1701b752a8fd34e62e066059eab71f576850924aa0509bf19825d0c8a64c288ae2c39c36b9
7
- data.tar.gz: aaaf89742fa53a166d1fe25398f4112ace03d447f2e7f17e6a606dcc5d8a939d61f676593ede4ff19435ea10f3b6ae37df4502af95c0f0a6d1824fd45e8cbb70
6
+ metadata.gz: 71f104a48e0be07359ce59f196818d5fef1dabf9b9a8293bb75243216cd154b48ffce3912911033bfc9981583c43c391d3f22c2d115272e0bf38f1901fb7d5dd
7
+ data.tar.gz: 909e1acf886e349d1e37a5e3f71c370a4c79abce82d9c05601a12b99dda9d6a4611081aaf19098d3fdd0d89127149263e0454b737fb5f15c8d2ae844f9020e0d
data/lib/rbbt/workflow.rb CHANGED
@@ -405,6 +405,14 @@ module Workflow
405
405
  end
406
406
  end
407
407
 
408
+ def self.load_step(path)
409
+ step = Step.new path
410
+ step.dependencies = step.info[:dependencies].collect do |task,name,dep_path|
411
+ Workflow.load_step dep_path
412
+ end
413
+ step
414
+ end
415
+
408
416
  def load_name(task, name)
409
417
  return remote_tasks[task].load_step(path) if remote_tasks and remote_tasks.include? task
410
418
  task = tasks[task.to_sym] if String === task or Symbol === task
@@ -919,6 +919,14 @@ module Workflow
919
919
  Misc.path_relative_to workdir_find, path
920
920
  end
921
921
 
922
+ def self.workflow_for(path)
923
+ begin
924
+ Kernel.const_get File.dirname(File.dirname(path))
925
+ rescue
926
+ nil
927
+ end
928
+ end
929
+
922
930
  def task_for(path)
923
931
  if workdir.respond_to? :find
924
932
  workdir_find = workdir.find
@@ -67,6 +67,7 @@ class Step
67
67
  end
68
68
  end
69
69
 
70
+
70
71
  def inputs
71
72
  return @inputs if NamedArray === @inputs
72
73
 
@@ -27,7 +27,8 @@ recursive = options.delete :recursive
27
27
 
28
28
  def get_step(file)
29
29
  file = file.sub(/\.(info|files)/,'')
30
- Step.new file
30
+ step = Workflow.load_step file
31
+ step
31
32
  end
32
33
 
33
34
  def status_msg(status)
@@ -84,7 +85,7 @@ exception = info[:exception]
84
85
  rest = info.keys - [:inputs, :dependencies, :status, :time_elapsed, :messages, :backtrace, :exception, :pid]
85
86
 
86
87
  puts Log.color(:magenta, "File") << ": " << step.path
87
- puts Log.color(:magenta, "Status") << ": " << status_msg(status) << ((step.aborted? || step.error?) && step.recoverable_error? ? " (recoverable)" : "" )
88
+ puts Log.color(:magenta, "Status") << ": " << status_msg(status) << ((step.aborted? || step.error?) && step.recoverable_error? ? " (recoverable)" : "" ) << (step.dirty? ? " (dirty)" : "")
88
89
  puts Log.color(:magenta, "Pid") << ": " << pid_msg(pid, status.to_s == "done")
89
90
  puts Log.color(:magenta, "Time") << ": " << time.to_i.to_s << " sec." if time
90
91
  puts Log.color(:magenta, "Total time") << ": " << total_time.to_i.to_s << " sec." if time
@@ -20,17 +20,22 @@ $ rbbt workflow prov <job-result>
20
20
 
21
21
  -h--help Help
22
22
  -p--plot* draw the dependency plot into <file.png>
23
+ -i--inputs* List of inputs to print
24
+ -if--info_fields* List of info fields to print
23
25
  EOF
24
26
 
25
27
  SOPT.usage if options[:help]
26
28
 
29
+ $inputs = (options[:inputs] || "").split(",")
30
+ $info_fields = (options[:info_fields] || "").split(",")
31
+
27
32
  file = ARGV.shift
28
33
 
29
34
  $seen = []
30
35
  def get_step(file)
31
36
  file = file.sub(/\.(info|files)/,'')
32
37
  $seen << file
33
- Step.new file
38
+ Workflow.load_step file
34
39
  end
35
40
 
36
41
  def status_msg(status)
@@ -53,18 +58,42 @@ def status_msg(status)
53
58
  Log.color(color, status.to_s)
54
59
  end
55
60
 
56
- def report_msg(status, name, path)
61
+ def report_msg(status, name, path, info = nil)
57
62
 
58
63
  parts = path.sub(/\{.*/,'').sub(/#{Regexp.quote(name)}$/,'').split "/"
59
64
 
60
65
  task = Log.color(:yellow, parts.pop)
61
66
  workflow = Log.color(:magenta, parts.pop)
62
67
 
63
- if not Open.remote?(path) and (File.exists?(path) and $main_mtime and ($main_mtime - File.mtime(path)) < 0)
64
- status_msg(status.to_s) << " " << [workflow, task, path] * " " << " (#{Log.color(:red, "Mtime out of sync") })\n"
68
+ str = if not Open.remote?(path) and (File.exists?(path) and $main_mtime and ($main_mtime - File.mtime(path)) < 0)
69
+ status_msg(status.to_s) << " " << [workflow, task, path] * " " << " (#{Log.color(:red, "Mtime out of sync") })"
65
70
  else
66
- status_msg(status.to_s) << " " << [workflow, task, path] * " " << "\n"
71
+ status_msg(status.to_s) << " " << [workflow, task, path] * " "
72
+ end
73
+
74
+ if $inputs and $inputs.any?
75
+ job_inputs = info[:inputs]
76
+ IndiferentHash.setup(job_inputs)
77
+
78
+ $inputs.each do |input|
79
+ value = job_inputs[input]
80
+ next if value.nil?
81
+ value_str = Misc.fingerprint(value)
82
+ str << " #{input}=#{value_str}"
83
+ end
67
84
  end
85
+
86
+ if $info_fields and $info_fields.any?
87
+ $info_fields.each do |field|
88
+ IndiferentHash.setup(info)
89
+ value = info[field]
90
+ next if value.nil?
91
+ value_str = Misc.fingerprint(value)
92
+ str << " #{field}=#{value_str}"
93
+ end
94
+ end
95
+
96
+ str << "\n"
68
97
  end
69
98
 
70
99
  def report(step, offset = 0)
@@ -75,7 +104,7 @@ def report(step, offset = 0)
75
104
  name = info[:name] || File.basename(path)
76
105
  status = :unsync if status == :done and not File.exist? path
77
106
  str = " " * offset
78
- str << report_msg(status, name, path)
107
+ str << report_msg(status, name, path, info)
79
108
  info[:dependencies].each do |task,name,path|
80
109
  new = ! $seen.include?(path)
81
110
  dep = get_step path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.21.133
4
+ version: 5.21.134
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez