rbbt-util 5.23.22 → 5.23.23
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 +4 -4
- data/lib/rbbt/util/misc.rb +2 -0
- data/lib/rbbt/util/tar.rb +9 -2
- data/lib/rbbt/workflow/accessor.rb +2 -1
- data/lib/rbbt/workflow/examples.rb +39 -17
- data/test/rbbt/util/test_misc.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9196b9af288157b75110a6bd4126f7a06caffee0
|
4
|
+
data.tar.gz: 666c7717915b6684ba727d70110a1ca5dd2cca1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21fefbcb643e6ebde8896422b5003deb348c9a9fffbee2b0935aaafd766853bc234ffe37635eaec130718ba5862951206ffe8e8974b3bfc1498b324421ea355d
|
7
|
+
data.tar.gz: '0939898fa00d8b3120e8497abc688aae9832e32a1d276703eca93fd505ab441e2d4284c49658f3d43708d66262034bd479f2b1e7d55f64528c508c834d4d3cad'
|
data/lib/rbbt/util/misc.rb
CHANGED
data/lib/rbbt/util/tar.rb
CHANGED
@@ -85,14 +85,21 @@ module Misc
|
|
85
85
|
|
86
86
|
def self._untar_cmd(io, destination)
|
87
87
|
FileUtils.mkdir_p destination unless File.exist? destination
|
88
|
-
CMD.
|
88
|
+
CMD.cmd_log("tar xvf - -C '#{destination}'", :in => io)
|
89
89
|
nil
|
90
90
|
end
|
91
91
|
|
92
92
|
# untars the given IO into the specified
|
93
93
|
# directory
|
94
94
|
def self.untar(io, destination)
|
95
|
-
|
95
|
+
io = io.find if Path === io
|
96
|
+
if String === io and File.exists?(io)
|
97
|
+
Open.open(io) do |f|
|
98
|
+
untar(f, destination)
|
99
|
+
end
|
100
|
+
else
|
101
|
+
return _untar_cmd(io, destination)
|
102
|
+
end
|
96
103
|
end
|
97
104
|
end
|
98
105
|
|
@@ -1028,6 +1028,7 @@ module Workflow
|
|
1028
1028
|
end
|
1029
1029
|
|
1030
1030
|
TAG = ENV["RBBT_INPUT_JOBNAME"] == "true" ? :inputs : :hash
|
1031
|
+
DEBUG_JOB_HASH = ENV["RBBT_DEBUG_JOB_HASH"] == 'true'
|
1031
1032
|
def step_path(taskname, jobname, inputs, dependencies, extension = nil)
|
1032
1033
|
raise "Jobname makes an invalid path: #{ jobname }" if jobname.include? '..'
|
1033
1034
|
if inputs.length > 0 or dependencies.any?
|
@@ -1039,7 +1040,7 @@ module Workflow
|
|
1039
1040
|
key_obj = {:inputs => clean_inputs, :dependencies => deps_str }
|
1040
1041
|
key_str = Misc.obj2str(key_obj)
|
1041
1042
|
hash_str = Misc.digest(key_str)
|
1042
|
-
|
1043
|
+
Log.debug "Hash for '#{[taskname, jobname] * "/"}' #{hash_str} for #{key_str}" if DEBUG_JOB_HASH
|
1043
1044
|
jobname + '_' << hash_str
|
1044
1045
|
when :inputs
|
1045
1046
|
all_inputs = {}
|
@@ -27,26 +27,48 @@ module Workflow
|
|
27
27
|
|
28
28
|
def self.load_inputs(dir, input_names, input_types)
|
29
29
|
inputs = {}
|
30
|
-
dir
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Log.debug "Pointing #{ input } to #{file}"
|
40
|
-
inputs[input.to_sym] = file
|
41
|
-
when :boolean
|
42
|
-
inputs[input.to_sym] = (file.read.strip == 'true')
|
43
|
-
else
|
44
|
-
Log.debug "Loading #{ input } from #{file}"
|
45
|
-
inputs[input.to_sym] = file.read.strip
|
30
|
+
if File.exists?(dir) && ! File.directory?(dir)
|
31
|
+
Log.debug "Loading inputs from #{dir}, not a directory trying as tar.gz"
|
32
|
+
tarfile = dir
|
33
|
+
digest = CMD.cmd("md5sum '#{tarfile}'").read.split(" ").first
|
34
|
+
tmpdir = Rbbt.tmp.input_bundle[digest].find
|
35
|
+
Misc.untar(tarfile, tmpdir) unless File.exists? tmpdir
|
36
|
+
files = tmpdir.glob("*")
|
37
|
+
if files.length == 1 && File.directory?(files.first)
|
38
|
+
tmpdir = files.first
|
46
39
|
end
|
40
|
+
load_inputs(tmpdir, input_names, input_types)
|
41
|
+
else
|
42
|
+
dir = Path.setup(dir.dup)
|
43
|
+
input_names.each do |input|
|
44
|
+
file = dir[input].find
|
45
|
+
file = dir.glob(input.to_s + ".*").first if file.nil? or not file.exists?
|
46
|
+
Log.debug "Trying #{ input }: #{file}"
|
47
|
+
next unless file and file.exists?
|
48
|
+
|
49
|
+
case input_types[input]
|
50
|
+
when :file
|
51
|
+
Log.debug "Pointing #{ input } to #{file}"
|
52
|
+
inputs[input.to_sym] = file
|
53
|
+
when :text
|
54
|
+
Log.debug "Reading #{ input } from #{file}"
|
55
|
+
inputs[input.to_sym] = Open.read(file)
|
56
|
+
when :array
|
57
|
+
Log.debug "Reading array #{ input } from #{file}"
|
58
|
+
inputs[input.to_sym] = Open.read(file).split("\n")
|
59
|
+
when :tsv
|
60
|
+
Log.debug "Opening tsv #{ input } from #{file}"
|
61
|
+
inputs[input.to_sym] = TSV.open(file)
|
62
|
+
when :boolean
|
63
|
+
inputs[input.to_sym] = (file.read.strip == 'true')
|
64
|
+
else
|
65
|
+
Log.debug "Loading #{ input } from #{file}"
|
66
|
+
inputs[input.to_sym] = file.read.strip
|
67
|
+
end
|
47
68
|
|
69
|
+
end
|
70
|
+
IndiferentHash.setup(inputs)
|
48
71
|
end
|
49
|
-
IndiferentHash.setup(inputs)
|
50
72
|
end
|
51
73
|
|
52
74
|
def example_inputs(task_name, example)
|
data/test/rbbt/util/test_misc.rb
CHANGED
@@ -606,7 +606,7 @@ EOF
|
|
606
606
|
def test_time_stamp
|
607
607
|
assert_equal 10, Misc.timespan('10')
|
608
608
|
assert_equal 10, Misc.timespan('10s')
|
609
|
-
assert_equal 60, Misc.timespan('
|
609
|
+
assert_equal 60, Misc.timespan('1min')
|
610
610
|
assert_equal 60*60*24, Misc.timespan('1d')
|
611
611
|
assert_equal 60*60*24, Misc.timespan('1d')
|
612
612
|
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.23.
|
4
|
+
version: 5.23.23
|
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-09-
|
11
|
+
date: 2018-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|