rbbt-util 5.24.0 → 5.24.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
  SHA1:
3
- metadata.gz: d5f2a21fe3779a6324ef059971dd4493da25a2f7
4
- data.tar.gz: b937c979d3515e7a923f2f229c64dd734f5ae2c6
3
+ metadata.gz: 4785253a5733137474410b83536a9a079b1fda64
4
+ data.tar.gz: 44f40786114ad60851366238366bbb5ef09bd577
5
5
  SHA512:
6
- metadata.gz: cdeeaa01c20aa1cb86abe7b6c9061c9fabc5f84906994d6c6afbea1f9be50f923a4dbb6d777ad05e43ecdb93c5bdb6aceada2334a1004820cde6076948c31dc9
7
- data.tar.gz: e538ce30a9a640baf4210df4e044fadeb213d396b02a9b1c8f0663e75dd4cde0a7b24a11ea0d06068bd9307368db510cd860f09184151de8aa67cd1b63ac7e0c
6
+ metadata.gz: 6cfd642943afb2e512cdf69c2cd02d4ea91180152e0a09134e0312de688e055d7a90138219b97475836855cf97e311516cf8c6a648f381422253d2559bee4ff6
7
+ data.tar.gz: 38e50f7448597c9d309918aa81aba0fc05bbb6a1489c3087177bd6bff4b7988ab11bc0e5e6cd4f2cc36079c882dcdf071988e0f0165b96d4080a8a8b4d9a57a3
@@ -261,10 +261,11 @@ module Misc
261
261
  "{"<< obj.collect{|k,v| obj2str(k) + '=>' << obj2str(v)}*"," << "}"
262
262
  when Symbol
263
263
  obj.to_s
264
- when (defined? Path and Path)
264
+ when (defined?(Path) and Path)
265
265
  if obj.exists?
266
266
  if obj.directory?
267
- "directory: #{obj.glob("**/*")}"
267
+ files = obj.glob("**/*")
268
+ "directory: #{files}"
268
269
  else
269
270
  "file: " << obj << "--" << mtime_str(obj)
270
271
  end
@@ -272,7 +273,7 @@ module Misc
272
273
  obj + " (file missing)"
273
274
  end
274
275
  when String
275
- if Misc.is_filename?(obj)
276
+ if Misc.is_filename?(obj) and ! %w(. ..).include?(obj)
276
277
  obj2str Path.setup(obj.dup)
277
278
  else
278
279
  obj = obj.chomp if String === obj
@@ -204,7 +204,7 @@ module Misc
204
204
 
205
205
  stream.close unless stream.closed?
206
206
  #stream.join if stream.respond_to? :join
207
- in_pipes.first.close
207
+ in_pipes.first.close unless in_pipes.first.closed?
208
208
  #Log.medium "Tee done #{Misc.fingerprint stream}"
209
209
  rescue Aborted, Interrupt
210
210
  stream.abort if stream.respond_to? :abort
@@ -362,6 +362,14 @@ module Open
362
362
  end
363
363
  end
364
364
 
365
+ def self.link(source, target, options = {})
366
+ begin
367
+ Open.ln(source, target, options)
368
+ rescue
369
+ Open.ln_s(source, target, options)
370
+ end
371
+ end
372
+
365
373
  #def self.cp(source, target, options = {})
366
374
  # source = source.find if Path === source
367
375
  # target = target.find if Path === target
@@ -733,6 +741,11 @@ module Open
733
741
  end
734
742
  end
735
743
 
744
+ def self.realpath(file)
745
+ file = file.find if Path === file
746
+ Pathname.new(File.expand_path(file)).realpath.to_s
747
+ end
748
+
736
749
  def self.mtime(file)
737
750
  if (dir_sub_path = find_repo_dir(file))
738
751
  get_time_from_repo(*dir_sub_path)
@@ -63,6 +63,16 @@ module Workflow
63
63
  end
64
64
  end
65
65
 
66
+ def dep_task(name, *dependency, &block)
67
+ dep(*dependency, &block)
68
+ task name do
69
+ dep = dependencies.last.join
70
+ set_info :result_type, dep.info[:result_type]
71
+ Open.link dep.path, self.path
72
+ nil
73
+ end
74
+ end
75
+
66
76
  def task(name, &block)
67
77
  if Hash === name
68
78
  type = name.first.last
@@ -94,7 +94,8 @@ class Step
94
94
  job.clean
95
95
  end
96
96
 
97
- (job.init_info and job.dup_inputs) unless status == 'done' or job.started?
97
+ job.dup_inputs unless status == 'done' or job.started?
98
+ job.init_info unless status == 'noinfo' or status == 'done' or job.started?
98
99
 
99
100
  canfail = ComputeDependency === job && job.canfail?
100
101
  end
@@ -194,10 +195,8 @@ class Step
194
195
  return unless other_steps.length > 1
195
196
  log_dependency_exec(step, "duplicating #{other_steps.length}")
196
197
  copies = Misc.tee_stream_thread_multiple(stream, other_steps.length)
197
- other_steps.zip(copies).each do |other,dupped_stream|
198
- stream.annotate(dupped_stream) if stream.respond_to?(:annotate)
199
- other.instance_variable_set("@result", dupped_stream)
200
- end
198
+ copies.extend StreamArray
199
+ step.instance_variable_set("@result", copies)
201
200
  end
202
201
  end
203
202
  end
@@ -356,7 +355,7 @@ class Step
356
355
  step.dependencies.each do |step_dep|
357
356
  next if step_dep.done? or step_dep.running? or (ComputeDependency === step_dep and (step_dep.compute == :nodup or step_dep.compute == :ignore))
358
357
  dep_step[step_dep.path] ||= []
359
- dep_step[step_dep.path] << step
358
+ dep_step[step_dep.path] << step_dep
360
359
  end
361
360
  step.inputs.each do |inputs|
362
361
  inputs = [inputs] unless Array === inputs
@@ -364,7 +363,7 @@ class Step
364
363
  next unless Step === step_dep
365
364
  next if step_dep.done? or step_dep.running? or (ComputeDependency === step_dep and (step_dep.compute == :nodup or step_dep.compute == :ignore))
366
365
  dep_step[step_dep.path] ||= []
367
- dep_step[step_dep.path] << step
366
+ dep_step[step_dep.path] << step_dep
368
367
  end
369
368
  end
370
369
  end
@@ -1,5 +1,8 @@
1
1
  require 'rbbt/workflow/step/dependencies'
2
2
 
3
+
4
+ module StreamArray; end
5
+
3
6
  class Step
4
7
 
5
8
  attr_reader :stream, :dupped, :saved_stream
@@ -8,10 +11,12 @@ class Step
8
11
  @mutex.synchronize do
9
12
  Log.low "Getting stream from #{path} #{!@saved_stream} [#{object_id}-#{Misc.fingerprint(@result)}]"
10
13
  begin
11
- return nil if @saved_stream
12
14
  if IO === @result
15
+ return nil if @saved_stream
13
16
  @saved_stream = @result
14
- else
17
+ elsif StreamArray === @result and @result.any?
18
+ @saved_stream = @result.pop
19
+ else
15
20
  nil
16
21
  end
17
22
  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.24.0
4
+ version: 5.24.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: 2018-12-05 00:00:00.000000000 Z
11
+ date: 2018-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake