rbbt-util 5.32.15 → 5.32.16

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: 54a6869616f33a2c526e35ddddf90c1e7c29e79c5df9fabaa51d9711e0aba249
4
- data.tar.gz: 7a6c7290ff27c00ba5911a609897eb9104b357adec7a38b892ad5a8c01267e26
3
+ metadata.gz: c2898a052d60bd9d6c05e3d277482e2221d07c18067b592fe7b8fefd796e8a6a
4
+ data.tar.gz: 55bdd8b9a78d2d35a2c4c1574da11113c66b7621128076f29128941a5a0caf77
5
5
  SHA512:
6
- metadata.gz: 1d7f69b1680ffc9cc8d30435da870ed50411d02ac285ab8b98f98f4fd8f9b3e07bf3b228904f5dc5ea03a987e4b37de398e99d50e8679f833682a0ecba8f632a
7
- data.tar.gz: 35ff2212eccbb3fbb2141f7aa7ec1c6d6de4ae77f3e2289ce8d99b11ff5d657d967a25367e5710e0f1fa13f0e7cff2a6f525b13ce68b82b933a7113b16146b10
6
+ metadata.gz: 3dd350c68a0c931da771f789aa934e3a94cf52be343101743a14eb2e049b782665db8f941da1f28e7503386af3f17c6ef4e53afa0ef388aecb65c9571ea974a5
7
+ data.tar.gz: 110a0a0eed2343835e3c4598f9c91c0280e28c64911a4fa18662c423d4f3d1774893b2e0ed848676a60878cae608a9b3d2e50de7c1c724935894971320628f2e
data/lib/rbbt/tsv.rb CHANGED
@@ -98,6 +98,11 @@ module TSV
98
98
  stream = get_stream source, options.merge(open_options)
99
99
  parse stream, data, options.merge(:tsv_grep => tsv_grep)
100
100
 
101
+ if ! open_options[:noclose]
102
+ stream.close unless stream.closed?
103
+ stream.join if stream.respond_to?(:join)
104
+ end
105
+
101
106
  data.filename = filename.to_s unless filename.nil?
102
107
 
103
108
  if data.identifiers.nil? and Path === filename and filename.identifier_file_path
@@ -389,7 +389,7 @@ module TSV
389
389
  when Set
390
390
  traverse_array(obj.to_a, options, &block)
391
391
  when String
392
- if Open.remote? obj or Misc.is_filename? obj
392
+ if Open.remote?(obj) or Misc.is_filename?(obj)
393
393
  Open.open(obj) do |s|
394
394
  traverse_obj(s, options, &block)
395
395
  end
data/lib/rbbt/workflow.rb CHANGED
@@ -411,12 +411,22 @@ module Workflow
411
411
 
412
412
  overriden = has_overriden_inputs || overriden_deps.any?
413
413
 
414
+ extension = task.extension
415
+
416
+ if extension == :dep_task
417
+ extension = nil
418
+ if dependencies.any?
419
+ dep_basename = File.basename(dependencies.last.path)
420
+ extension = dep_path.split(".").last if dep_basename.include?('.')
421
+ end
422
+ end
423
+
414
424
  if real_inputs.empty? && Workflow::TAG != :inputs && ! overriden
415
- step_path = step_path taskname, jobname, [], [], task.extension
425
+ step_path = step_path taskname, jobname, [], [], extension
416
426
  input_values = task.take_input_values(inputs)
417
427
  else
418
428
  input_values = task.take_input_values(inputs)
419
- step_path = step_path taskname, jobname, input_values, dependencies, task.extension
429
+ step_path = step_path taskname, jobname, input_values, dependencies, extension
420
430
  end
421
431
 
422
432
  job = get_job_step step_path, task, input_values, dependencies
@@ -73,7 +73,7 @@ module Workflow
73
73
  REMOVE_DEP_TASKS = ENV["RBBT_REMOVE_DEP_TASKS"] == "true"
74
74
  def dep_task(name, workflow, oname, *rest, &block)
75
75
  dep(workflow, oname, *rest, &block)
76
- extension workflow.tasks[oname].extension if workflow.tasks.include?(oname) unless @extension
76
+ extension :dep_task unless @extension
77
77
  returns workflow.tasks[oname].result_description if workflow.tasks.include?(oname) unless @result_description
78
78
  task name do
79
79
  raise RbbtException, "dependency not found in dep_task" if dependencies.empty?
@@ -26,7 +26,7 @@ class Step
26
26
  Log.color(color, status.to_s)
27
27
  end
28
28
 
29
- def self.prov_report_msg(status, name, path, info = nil)
29
+ def self.prov_report_msg(status, name, path, info, input = nil)
30
30
  parts = path.sub(/\{.*/,'').split "/"
31
31
 
32
32
  parts.pop
@@ -43,10 +43,17 @@ class Step
43
43
  rescue Exception
44
44
  nil
45
45
  end
46
+
47
+ if input.nil? || input.empty?
48
+ input_str = nil
49
+ else
50
+ input_str = Log.color(:magenta, "-> ") + input.collect{|dep,name| Log.color(:yellow, dep.task_name.to_s) + ":" + Log.color(:yellow, name) }.uniq * " "
51
+ end
52
+
46
53
  str = if ! (Open.remote?(path) || Open.ssh?(path)) && (Open.exists?(path) && $main_mtime && path_mtime && ($main_mtime - path_mtime) < -2)
47
- prov_status_msg(status.to_s) << " " << [workflow, task, path].compact * " " << " (#{Log.color(:red, "Mtime out of sync") })"
54
+ prov_status_msg(status.to_s) << " " << [workflow, task, path, input_str].compact * " " << " (#{Log.color(:red, "Mtime out of sync") })"
48
55
  else
49
- prov_status_msg(status.to_s) << " " << [workflow, task, path].compact * " "
56
+ prov_status_msg(status.to_s) << " " << [workflow, task, path, input_str].compact * " "
50
57
  end
51
58
 
52
59
  if $inputs and $inputs.any?
@@ -74,7 +81,7 @@ class Step
74
81
  str << "\n"
75
82
  end
76
83
 
77
- def self.prov_report(step, offset = 0, task = nil, seen = [], expand_repeats = false)
84
+ def self.prov_report(step, offset = 0, task = nil, seen = [], expand_repeats = false, input = nil)
78
85
  info = step.info || {}
79
86
  info[:task_name] = task
80
87
  path = step.path
@@ -85,13 +92,25 @@ class Step
85
92
  status = :notfound if status == :noinfo and not Open.exist?(path)
86
93
 
87
94
  str = " " * offset
88
- str << prov_report_msg(status, name, path, info)
95
+ str << prov_report_msg(status, name, path, info, input)
96
+
97
+ input_dependencies = {}
98
+ step.dependencies.each do |dep|
99
+ if dep.input_dependencies.any?
100
+ dep.input_dependencies.each do |id|
101
+ input_name = dep.inputs.fields.zip(dep.inputs).select{|f,d| d == id || String === d && d.start_with?(id.files_dir) }.first.first
102
+ input_dependencies[id] ||= []
103
+ input_dependencies[id] << [dep, input_name]
104
+ end
105
+ end
106
+ end
107
+
89
108
  step.dependencies.reverse.each do |dep|
90
109
  path = dep.path
91
110
  new = ! seen.include?(path)
92
111
  if new
93
112
  seen << path
94
- str << prov_report(dep, offset + 1, task, seen, expand_repeats)
113
+ str << prov_report(dep, offset + 1, task, seen, expand_repeats, input_dependencies[dep])
95
114
  else
96
115
  if expand_repeats
97
116
  str << Log.color(Step.status_color(dep.status), Log.uncolor(prov_report(dep, offset+1, task)))
@@ -103,7 +122,7 @@ class Step
103
122
  status = :unsync if status == :done and not Open.exist?(path)
104
123
  status = :notfound if status == :noinfo and not Open.exist?(path)
105
124
 
106
- str << Log.color(Step.status_color(status), " " * (offset + 1) + Log.uncolor(prov_report_msg(status, name, path, info)))
125
+ str << Log.color(Step.status_color(status), " " * (offset + 1) + Log.uncolor(prov_report_msg(status, name, path, info, input_dependencies[dep])))
107
126
  end
108
127
  end
109
128
  end if step.dependencies
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.15
4
+ version: 5.32.16
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-06-25 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake