rbbt-util 5.28.5 → 5.28.10
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/entity.rb +1 -1
- data/lib/rbbt/fix_width_table.rb +5 -4
- data/lib/rbbt/persist.rb +1 -0
- data/lib/rbbt/persist/tsv/adapter.rb +0 -1
- data/lib/rbbt/persist/tsv/fix_width_table.rb +5 -3
- data/lib/rbbt/tsv/accessor.rb +10 -2
- data/lib/rbbt/tsv/dumper.rb +14 -2
- data/lib/rbbt/tsv/parallel/traverse.rb +3 -0
- data/lib/rbbt/tsv/util.rb +5 -1
- data/lib/rbbt/util/cmd.rb +1 -0
- data/lib/rbbt/util/config.rb +2 -1
- data/lib/rbbt/util/misc/bgzf.rb +1 -1
- data/lib/rbbt/util/misc/inspect.rb +1 -1
- data/lib/rbbt/util/misc/system.rb +1 -1
- data/lib/rbbt/util/named_array.rb +1 -1
- data/lib/rbbt/util/open.rb +18 -17
- data/lib/rbbt/workflow.rb +1 -0
- data/lib/rbbt/workflow/accessor.rb +94 -93
- data/lib/rbbt/workflow/definition.rb +8 -4
- data/lib/rbbt/workflow/integration/ansible.rb +53 -0
- data/lib/rbbt/workflow/integration/ansible/workflow.rb +60 -0
- data/lib/rbbt/workflow/remote_workflow/driver/rest.rb +5 -1
- data/lib/rbbt/workflow/step.rb +22 -5
- data/lib/rbbt/workflow/step/accessor.rb +7 -5
- data/lib/rbbt/workflow/usage.rb +1 -1
- data/lib/rbbt/workflow/util/archive.rb +3 -0
- data/lib/rbbt/workflow/util/orchestrator.rb +228 -0
- data/lib/rbbt/workflow/util/trace.rb +182 -0
- data/share/rbbt_commands/ansible +55 -0
- data/share/rbbt_commands/purge_job +2 -5
- data/share/rbbt_commands/system/status +1 -1
- data/share/rbbt_commands/workflow/forget_deps +10 -3
- data/share/rbbt_commands/workflow/server +2 -0
- data/test/rbbt/association/test_index.rb +6 -6
- data/test/rbbt/knowledge_base/test_query.rb +3 -3
- data/test/rbbt/knowledge_base/test_registry.rb +1 -1
- data/test/rbbt/persist/tsv/test_cdb.rb +0 -7
- data/test/rbbt/persist/tsv/test_kyotocabinet.rb +2 -8
- data/test/rbbt/persist/tsv/test_leveldb.rb +0 -6
- data/test/rbbt/persist/tsv/test_lmdb.rb +0 -6
- data/test/rbbt/persist/tsv/test_tokyocabinet.rb +15 -14
- data/test/rbbt/test_entity.rb +0 -1
- data/test/rbbt/test_knowledge_base.rb +3 -4
- data/test/rbbt/test_persist.rb +10 -6
- data/test/rbbt/test_workflow.rb +17 -16
- data/test/rbbt/tsv/parallel/test_traverse.rb +14 -0
- data/test/rbbt/tsv/test_accessor.rb +11 -0
- data/test/rbbt/tsv/test_attach.rb +0 -2
- data/test/rbbt/tsv/test_index.rb +6 -7
- data/test/rbbt/tsv/test_manipulate.rb +22 -3
- data/test/rbbt/util/R/test_model.rb +2 -1
- data/test/rbbt/util/R/test_plot.rb +0 -2
- data/test/rbbt/util/concurrency/test_processes.rb +1 -1
- data/test/rbbt/util/misc/test_bgzf.rb +11 -7
- data/test/rbbt/util/misc/test_lock.rb +0 -1
- data/test/rbbt/util/misc/test_multipart_payload.rb +1 -1
- data/test/rbbt/util/misc/test_pipes.rb +0 -5
- data/test/rbbt/util/test_R.rb +1 -0
- data/test/rbbt/util/test_log.rb +4 -6
- data/test/rbbt/util/test_misc.rb +0 -2
- data/test/rbbt/util/test_open.rb +0 -1
- data/test/rbbt/util/test_python.rb +17 -1
- data/test/rbbt/workflow/test_remote_workflow.rb +1 -1
- data/test/rbbt/workflow/test_schedule.rb +0 -0
- data/test/rbbt/workflow/test_step.rb +8 -3
- data/test/rbbt/workflow/util/test_orchestrator.rb +273 -0
- metadata +11 -5
- data/lib/rbbt/workflow/schedule.rb +0 -238
- data/test/rbbt/workflow/remote/test_client.rb +0 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 443812f3080048a2e39b95ceda4fda2b3f403788c4d32ae4822b0b6920ac1d1f
|
|
4
|
+
data.tar.gz: e586076cca9dbd72b9dae8ba8be0061269e9bef5d04163f382f2d3b3f353d1b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca6ea9a139a48dfcc76fb04b889d45881d023e9f6fda362da0bb7bd4c63b31217ca0a9bb9f4702186c78b741a1eb1b5c7ca2607512e6dced51026081bdcb8aa7
|
|
7
|
+
data.tar.gz: 76f021c8d565e2833506f17fb54436d0fe80d29d8bface099cece0445cb70718f8f2126e6fa6eb139f6555e33fe9382d1401339aacb100073bb4964c62f1a260
|
data/lib/rbbt/entity.rb
CHANGED
data/lib/rbbt/fix_width_table.rb
CHANGED
|
@@ -67,7 +67,7 @@ class FixWidthTable
|
|
|
67
67
|
|
|
68
68
|
def format(pos, value)
|
|
69
69
|
padding = value_size - value.length
|
|
70
|
-
if range
|
|
70
|
+
if @range
|
|
71
71
|
(pos + [padding, value + ("\0" * padding)]).pack("llll#{mask}")
|
|
72
72
|
else
|
|
73
73
|
[pos, padding, value + ("\0" * padding)].pack("ll#{mask}")
|
|
@@ -105,7 +105,7 @@ class FixWidthTable
|
|
|
105
105
|
|
|
106
106
|
def idx_value(index)
|
|
107
107
|
return nil if index < 0 or index >= size
|
|
108
|
-
@file.seek((range ? 17 : 9 ) + (record_size) * index, IO::SEEK_SET)
|
|
108
|
+
@file.seek((@range ? 17 : 9 ) + (record_size) * index, IO::SEEK_SET)
|
|
109
109
|
padding = @file.read(4).unpack("l").first+1
|
|
110
110
|
txt = @file.read(value_size)
|
|
111
111
|
str = txt.unpack(mask).first
|
|
@@ -277,7 +277,8 @@ class FixWidthTable
|
|
|
277
277
|
|
|
278
278
|
def [](pos)
|
|
279
279
|
return [] if size == 0
|
|
280
|
-
|
|
280
|
+
self.read
|
|
281
|
+
if @range
|
|
281
282
|
get_range(pos)
|
|
282
283
|
else
|
|
283
284
|
get_point(pos)
|
|
@@ -286,7 +287,7 @@ class FixWidthTable
|
|
|
286
287
|
|
|
287
288
|
def overlaps(pos, value = false)
|
|
288
289
|
return [] if size == 0
|
|
289
|
-
idxs = if range
|
|
290
|
+
idxs = if @range
|
|
290
291
|
get_range(pos, true)
|
|
291
292
|
else
|
|
292
293
|
get_point(pos, true)
|
data/lib/rbbt/persist.rb
CHANGED
|
@@ -25,6 +25,7 @@ module Persist
|
|
|
25
25
|
MEMORY = {} unless defined? MEMORY
|
|
26
26
|
MAX_FILE_LENGTH = 150
|
|
27
27
|
|
|
28
|
+
# Is 'file' newer than 'path'? return non-true if path is newer than file
|
|
28
29
|
def self.newer?(path, file)
|
|
29
30
|
return true if not Open.exists?(file)
|
|
30
31
|
path = path.find if Path === path
|
|
@@ -52,7 +52,7 @@ module Persist
|
|
|
52
52
|
if TSV::ENTRY_KEYS.include? key
|
|
53
53
|
set_metadata(key, value)
|
|
54
54
|
else
|
|
55
|
-
if range
|
|
55
|
+
if @range
|
|
56
56
|
add_range_point key, value
|
|
57
57
|
else
|
|
58
58
|
add key, value
|
|
@@ -61,7 +61,7 @@ module Persist
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def add(key, value)
|
|
64
|
-
key = pos_function.call(key) if pos_function and not (range and Array === key)
|
|
64
|
+
key = pos_function.call(key) if pos_function and not (@range and Array === key)
|
|
65
65
|
super(key, value)
|
|
66
66
|
end
|
|
67
67
|
|
|
@@ -85,8 +85,10 @@ module Persist
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def each
|
|
88
|
+
read
|
|
88
89
|
@size.times do |i|
|
|
89
|
-
|
|
90
|
+
v = idx_value(i)
|
|
91
|
+
yield i, v
|
|
90
92
|
end
|
|
91
93
|
end
|
|
92
94
|
|
data/lib/rbbt/tsv/accessor.rb
CHANGED
|
@@ -550,9 +550,17 @@ module TSV
|
|
|
550
550
|
"\t" << ([""] * fields.length) * "\t" << "\n"
|
|
551
551
|
end
|
|
552
552
|
when Array
|
|
553
|
-
|
|
553
|
+
if fields.nil? or fields.empty?
|
|
554
|
+
"\n"
|
|
555
|
+
else
|
|
556
|
+
"\t" << values.collect{|v| Array === v ? v * "|" : v} * "\t" << "\n"
|
|
557
|
+
end
|
|
554
558
|
else
|
|
555
|
-
|
|
559
|
+
if fields.nil? or fields.empty?
|
|
560
|
+
"\n"
|
|
561
|
+
else
|
|
562
|
+
"\t" << values.to_s << "\n"
|
|
563
|
+
end
|
|
556
564
|
end
|
|
557
565
|
end
|
|
558
566
|
|
data/lib/rbbt/tsv/dumper.rb
CHANGED
|
@@ -32,9 +32,21 @@ module TSV
|
|
|
32
32
|
sep + ([""] * fields.length) * sep << "\n"
|
|
33
33
|
end
|
|
34
34
|
when Array
|
|
35
|
-
|
|
35
|
+
if fields.nil?
|
|
36
|
+
sep + (values.collect{|v| Array === v ? v * "|" : v} * sep) << "\n"
|
|
37
|
+
elsif fields.empty?
|
|
38
|
+
"\n"
|
|
39
|
+
else
|
|
40
|
+
sep + (values.collect{|v| Array === v ? v * "|" : v} * sep) << "\n"
|
|
41
|
+
end
|
|
36
42
|
else
|
|
37
|
-
|
|
43
|
+
if fields.nil?
|
|
44
|
+
sep + values.to_s + "\n"
|
|
45
|
+
elsif fields.empty?
|
|
46
|
+
"\n"
|
|
47
|
+
else
|
|
48
|
+
sep + values.to_s << "\n"
|
|
49
|
+
end
|
|
38
50
|
end
|
|
39
51
|
end
|
|
40
52
|
|
|
@@ -377,6 +377,7 @@ module TSV
|
|
|
377
377
|
obj.run(true) unless obj.done? || obj.started? || obj.result
|
|
378
378
|
|
|
379
379
|
stream = obj.get_stream
|
|
380
|
+
options = {:type => :array}.merge(options) if obj.result_type == :array
|
|
380
381
|
|
|
381
382
|
if stream
|
|
382
383
|
traverse_obj(stream, options, &block)
|
|
@@ -623,6 +624,8 @@ module TSV
|
|
|
623
624
|
def self.traverse(obj, options = {}, &block)
|
|
624
625
|
into = options[:into]
|
|
625
626
|
|
|
627
|
+
into = options[:into] = Open.open(into, :mode => "w") if Misc.is_filename?(into)
|
|
628
|
+
|
|
626
629
|
case into
|
|
627
630
|
when :stream
|
|
628
631
|
sout = Misc.open_pipe false, false do |sin|
|
data/lib/rbbt/tsv/util.rb
CHANGED
|
@@ -184,7 +184,11 @@ module TSV
|
|
|
184
184
|
str = ""
|
|
185
185
|
str << preamble.strip << "\n" if preamble and not preamble.empty?
|
|
186
186
|
if fields
|
|
187
|
-
|
|
187
|
+
if fields.empty?
|
|
188
|
+
str << header_hash << (key_field || "ID").to_s << "\n"
|
|
189
|
+
else
|
|
190
|
+
str << header_hash << (key_field || "ID").to_s << sep << (fields * sep) << "\n"
|
|
191
|
+
end
|
|
188
192
|
end
|
|
189
193
|
|
|
190
194
|
str
|
data/lib/rbbt/util/cmd.rb
CHANGED
|
@@ -98,6 +98,7 @@ module CMD
|
|
|
98
98
|
post = options.delete(:post)
|
|
99
99
|
log = options.delete(:log)
|
|
100
100
|
no_fail = options.delete(:no_fail)
|
|
101
|
+
no_fail = options.delete(:nofail) if no_fail.nil?
|
|
101
102
|
no_wait = options.delete(:no_wait)
|
|
102
103
|
|
|
103
104
|
dont_close_in = options.delete(:dont_close_in)
|
data/lib/rbbt/util/config.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Rbbt::Config
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def self.load_file(file)
|
|
18
|
-
Log.debug "Loading file: #{ file }"
|
|
18
|
+
Log.debug "Loading config file: #{ file }"
|
|
19
19
|
TSV.traverse file, :type => :array do |line|
|
|
20
20
|
next if line =~ /^#/
|
|
21
21
|
key, value, *tokens = line.strip.split(/\s/)
|
|
@@ -85,6 +85,7 @@ module Rbbt::Config
|
|
|
85
85
|
priorities
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# For equal priorities the matching prioritizes tokens ealier in the list
|
|
88
89
|
def self.get(key, *tokens)
|
|
89
90
|
options = tokens.pop if Hash === tokens.last
|
|
90
91
|
default = options.nil? ? nil : options[:default]
|
data/lib/rbbt/util/misc/bgzf.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Bgzf
|
|
|
7
7
|
|
|
8
8
|
def self.bgzip_cmd
|
|
9
9
|
@@bgzip_cmd ||= begin
|
|
10
|
-
path = `bash -c "type -p
|
|
10
|
+
path = `bash -c "type -p bgzip"`.strip
|
|
11
11
|
if path.empty?
|
|
12
12
|
Rbbt.claim Rbbt.software.opt.htslib, :install, Rbbt.share.install.software.HTSLIB.find(:lib)
|
|
13
13
|
Rbbt.software.opt.htslib.produce
|
|
@@ -113,7 +113,7 @@ end
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
def self.is_filename?(string)
|
|
116
|
-
return true if defined?
|
|
116
|
+
return true if defined? Path and Path === string
|
|
117
117
|
return true if string.respond_to? :exists
|
|
118
118
|
return true if String === string and string.length < 265 and File.exist?(string)
|
|
119
119
|
return false
|
data/lib/rbbt/util/open.rb
CHANGED
|
@@ -16,9 +16,9 @@ module Open
|
|
|
16
16
|
GREP_CMD = begin
|
|
17
17
|
if ENV["GREP_CMD"]
|
|
18
18
|
ENV["GREP_CMD"]
|
|
19
|
-
elsif File.
|
|
19
|
+
elsif File.exist?('/bin/grep')
|
|
20
20
|
"/bin/grep"
|
|
21
|
-
elsif File.
|
|
21
|
+
elsif File.exist?('/usr/bin/grep')
|
|
22
22
|
"/usr/bin/grep"
|
|
23
23
|
else
|
|
24
24
|
"grep"
|
|
@@ -262,7 +262,7 @@ module Open
|
|
|
262
262
|
if (dir_sub_path = find_repo_dir(file))
|
|
263
263
|
remove_from_repo(*dir_sub_path)
|
|
264
264
|
else
|
|
265
|
-
FileUtils.rm(file) if File.
|
|
265
|
+
FileUtils.rm(file) if File.exist?(file) or Open.broken_link?(file)
|
|
266
266
|
end
|
|
267
267
|
end
|
|
268
268
|
|
|
@@ -333,7 +333,7 @@ module Open
|
|
|
333
333
|
nil
|
|
334
334
|
else
|
|
335
335
|
target = target.find if Path === target
|
|
336
|
-
if ! File.
|
|
336
|
+
if ! File.exist?(target)
|
|
337
337
|
FileUtils.mkdir_p target
|
|
338
338
|
end
|
|
339
339
|
end
|
|
@@ -344,8 +344,8 @@ module Open
|
|
|
344
344
|
target = target.find if Path === target
|
|
345
345
|
|
|
346
346
|
target = File.join(target, File.basename(source)) if File.directory? target
|
|
347
|
-
FileUtils.mkdir_p File.dirname(target) unless File.
|
|
348
|
-
FileUtils.rm target if File.
|
|
347
|
+
FileUtils.mkdir_p File.dirname(target) unless File.exist?(File.dirname(target))
|
|
348
|
+
FileUtils.rm target if File.exist?(target)
|
|
349
349
|
FileUtils.ln_s source, target
|
|
350
350
|
end
|
|
351
351
|
|
|
@@ -353,8 +353,8 @@ module Open
|
|
|
353
353
|
source = source.find if Path === source
|
|
354
354
|
target = target.find if Path === target
|
|
355
355
|
|
|
356
|
-
FileUtils.mkdir_p File.dirname(target) unless File.
|
|
357
|
-
FileUtils.rm target if File.
|
|
356
|
+
FileUtils.mkdir_p File.dirname(target) unless File.exist?(File.dirname(target))
|
|
357
|
+
FileUtils.rm target if File.exist?(target)
|
|
358
358
|
FileUtils.ln source, target
|
|
359
359
|
end
|
|
360
360
|
|
|
@@ -362,8 +362,8 @@ module Open
|
|
|
362
362
|
source = source.find if Path === source
|
|
363
363
|
target = target.find if Path === target
|
|
364
364
|
|
|
365
|
-
FileUtils.mkdir_p File.dirname(target) unless File.
|
|
366
|
-
FileUtils.rm target if File.
|
|
365
|
+
FileUtils.mkdir_p File.dirname(target) unless File.exist?(File.dirname(target))
|
|
366
|
+
FileUtils.rm target if File.exist?(target)
|
|
367
367
|
begin
|
|
368
368
|
CMD.cmd("ln -L '#{ source }' '#{ target }'")
|
|
369
369
|
rescue ProcessFailed
|
|
@@ -397,7 +397,7 @@ module Open
|
|
|
397
397
|
if dir_sub_path_source.nil? and dir_sub_path_target.nil?
|
|
398
398
|
FileUtils.mkdir_p File.dirname(target) unless File.exist? File.dirname(target)
|
|
399
399
|
tmp_target = File.join(File.dirname(target), '.tmp_mv.' + File.basename(target))
|
|
400
|
-
FileUtils.
|
|
400
|
+
FileUtils.cp_r source, tmp_target
|
|
401
401
|
FileUtils.mv tmp_target, target
|
|
402
402
|
return
|
|
403
403
|
end
|
|
@@ -475,6 +475,7 @@ module Open
|
|
|
475
475
|
File.exist?(file) #|| File.symlink?(file)
|
|
476
476
|
end
|
|
477
477
|
end
|
|
478
|
+
|
|
478
479
|
class << self
|
|
479
480
|
alias exist? exists?
|
|
480
481
|
end
|
|
@@ -747,7 +748,7 @@ module Open
|
|
|
747
748
|
if (dir_sub_path = find_repo_dir(path))
|
|
748
749
|
writable_repo?(*dir_sub_path)
|
|
749
750
|
else
|
|
750
|
-
if File.
|
|
751
|
+
if File.exist?(path)
|
|
751
752
|
File.writable?(path)
|
|
752
753
|
else
|
|
753
754
|
File.writable?(File.dirname(File.expand_path(path)))
|
|
@@ -776,14 +777,14 @@ module Open
|
|
|
776
777
|
file = file.find if Path === file
|
|
777
778
|
begin
|
|
778
779
|
if File.symlink?(file) || File.stat(file).nlink > 1
|
|
779
|
-
if File.
|
|
780
|
+
if File.exist?(file + '.info') && defined?(Step)
|
|
780
781
|
done = Step::INFO_SERIALIZER.load(Open.open(file + '.info'))[:done]
|
|
781
782
|
return done if done
|
|
782
783
|
end
|
|
783
784
|
|
|
784
785
|
file = Pathname.new(file).realpath.to_s
|
|
785
786
|
end
|
|
786
|
-
return nil unless File.
|
|
787
|
+
return nil unless File.exist?(file)
|
|
787
788
|
File.mtime(file)
|
|
788
789
|
rescue
|
|
789
790
|
nil
|
|
@@ -793,7 +794,7 @@ module Open
|
|
|
793
794
|
|
|
794
795
|
def self.update_mtime(path, target)
|
|
795
796
|
if File.symlink?(target) || File.stat(target).nlink > 1
|
|
796
|
-
if File.
|
|
797
|
+
if File.exist?(target + '.info')
|
|
797
798
|
target = target + '.info'
|
|
798
799
|
else
|
|
799
800
|
target = Pathname.new(target).realpath.to_s
|
|
@@ -801,7 +802,7 @@ module Open
|
|
|
801
802
|
end
|
|
802
803
|
|
|
803
804
|
CMD.cmd("touch -r '#{path}' '#{target}'")
|
|
804
|
-
CMD.cmd("touch -r '#{path}.info' '#{target}'") if File.
|
|
805
|
+
CMD.cmd("touch -r '#{path}.info' '#{target}'") if File.exist?(path + '.info')
|
|
805
806
|
end
|
|
806
807
|
|
|
807
808
|
def self.atime(file)
|
|
@@ -823,7 +824,7 @@ module Open
|
|
|
823
824
|
end
|
|
824
825
|
|
|
825
826
|
def self.broken_link?(path)
|
|
826
|
-
File.symlink?(path) && ! File.
|
|
827
|
+
File.symlink?(path) && ! File.exist?(File.readlink(path))
|
|
827
828
|
end
|
|
828
829
|
|
|
829
830
|
def self.download(url, path)
|
data/lib/rbbt/workflow.rb
CHANGED
|
@@ -364,6 +364,7 @@ module Workflow
|
|
|
364
364
|
raise ParameterException, "Inputs #{Misc.humanize_list(missing_inputs)} are required but were not provided or are nil"
|
|
365
365
|
end
|
|
366
366
|
|
|
367
|
+
# jobname => true sets the value of the input to the name of the job
|
|
367
368
|
if task.input_options
|
|
368
369
|
jobname_input = task.input_options.select{|i,o| o[:jobname]}.collect{|i,o| i }.first
|
|
369
370
|
else
|
|
@@ -26,105 +26,106 @@ module Workflow
|
|
|
26
26
|
raise "No '#{name}' task in '#{self.to_s}' Workflow" if task.nil?
|
|
27
27
|
id = File.join(self.to_s, name.to_s)
|
|
28
28
|
@task_info ||= {}
|
|
29
|
-
@task_info[id] ||= begin
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
@task_info[id] ||= begin
|
|
30
|
+
description = task.description
|
|
31
|
+
result_description = task.result_description
|
|
32
|
+
result_type = task.result_type
|
|
33
|
+
inputs = rec_inputs(name).uniq
|
|
34
|
+
input_types = rec_input_types(name)
|
|
35
|
+
input_descriptions = rec_input_descriptions(name)
|
|
36
|
+
input_use = rec_input_use(name)
|
|
37
|
+
input_defaults = rec_input_defaults(name)
|
|
38
|
+
input_options = rec_input_options(name)
|
|
39
|
+
extension = task.extension
|
|
40
|
+
export = case
|
|
41
|
+
when (synchronous_exports.include?(name.to_sym) or synchronous_exports.include?(name.to_s))
|
|
42
|
+
:synchronous
|
|
43
|
+
when (asynchronous_exports.include?(name.to_sym) or asynchronous_exports.include?(name.to_s))
|
|
44
|
+
:asynchronous
|
|
45
|
+
when (exec_exports.include?(name.to_sym) or exec_exports.include?(name.to_s))
|
|
46
|
+
:exec
|
|
47
|
+
when (stream_exports.include?(name.to_sym) or stream_exports.include?(name.to_s))
|
|
48
|
+
:stream
|
|
49
|
+
else
|
|
50
|
+
:none
|
|
51
|
+
end
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
dependencies = task_dependencies[name].select{|dep| String === dep or Symbol === dep}
|
|
54
|
+
{ :id => id,
|
|
55
|
+
:description => description,
|
|
56
|
+
:export => export,
|
|
57
|
+
:inputs => inputs,
|
|
58
|
+
:input_types => input_types,
|
|
59
|
+
:input_descriptions => input_descriptions,
|
|
60
|
+
:input_defaults => input_defaults,
|
|
61
|
+
:input_options => input_options,
|
|
62
|
+
:input_use => input_use,
|
|
63
|
+
:result_type => result_type,
|
|
64
|
+
:result_description => result_description,
|
|
65
|
+
:dependencies => dependencies,
|
|
66
|
+
:extension => extension
|
|
67
|
+
}
|
|
68
|
+
end
|
|
68
69
|
end
|
|
69
70
|
|
|
70
71
|
def rec_dependencies(taskname)
|
|
71
72
|
@rec_dependencies ||= {}
|
|
72
73
|
@rec_dependencies[taskname] ||= begin
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
74
|
+
if task_dependencies.include? taskname
|
|
75
|
+
|
|
76
|
+
deps = task_dependencies[taskname]
|
|
77
|
+
|
|
78
|
+
#all_deps = deps.select{|dep| String === dep or Symbol === dep or Array === dep}
|
|
79
|
+
|
|
80
|
+
all_deps = []
|
|
81
|
+
deps.each do |dep|
|
|
82
|
+
if DependencyBlock === dep
|
|
83
|
+
all_deps << dep.dependency if dep.dependency
|
|
84
|
+
else
|
|
85
|
+
all_deps << dep unless Proc === dep
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
begin
|
|
89
|
+
case dep
|
|
90
|
+
when Array
|
|
91
|
+
wf, t, o = dep
|
|
92
|
+
|
|
93
|
+
wf.rec_dependencies(t.to_sym).each do |d|
|
|
94
|
+
if Array === d
|
|
95
|
+
new = d.dup
|
|
96
|
+
else
|
|
97
|
+
new = [dep.first, d]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if Hash === o and not o.empty?
|
|
101
|
+
if Hash === new.last
|
|
102
|
+
hash = new.last.dup
|
|
103
|
+
o.each{|k,v| hash[k] ||= v}
|
|
104
|
+
new[new.length-1] = hash
|
|
105
|
+
else
|
|
106
|
+
new.push o.dup
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
all_deps << new
|
|
111
|
+
end if wf && t
|
|
112
|
+
|
|
113
|
+
when String, Symbol
|
|
114
|
+
rec_deps = rec_dependencies(dep.to_sym)
|
|
115
|
+
all_deps.concat rec_deps
|
|
116
|
+
when DependencyBlock
|
|
117
|
+
dep = dep.dependency
|
|
118
|
+
raise TryAgain
|
|
119
|
+
end
|
|
120
|
+
rescue TryAgain
|
|
121
|
+
retry
|
|
122
|
+
end
|
|
106
123
|
end
|
|
124
|
+
all_deps.uniq
|
|
125
|
+
else
|
|
126
|
+
[]
|
|
107
127
|
end
|
|
108
|
-
|
|
109
|
-
all_deps << new
|
|
110
|
-
end if wf && t
|
|
111
|
-
|
|
112
|
-
when String, Symbol
|
|
113
|
-
rec_deps = rec_dependencies(dep.to_sym)
|
|
114
|
-
all_deps.concat rec_deps
|
|
115
|
-
when DependencyBlock
|
|
116
|
-
dep = dep.dependency
|
|
117
|
-
raise TryAgain
|
|
118
|
-
end
|
|
119
|
-
rescue TryAgain
|
|
120
|
-
retry
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
all_deps.uniq
|
|
124
|
-
else
|
|
125
|
-
[]
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
+
end
|
|
128
129
|
end
|
|
129
130
|
|
|
130
131
|
def task_from_dep(dep)
|
|
@@ -182,7 +183,7 @@ module Workflow
|
|
|
182
183
|
acc
|
|
183
184
|
}.tap{|h| IndiferentHash.setup(h)}
|
|
184
185
|
end
|
|
185
|
-
|
|
186
|
+
|
|
186
187
|
def rec_input_use(taskname)
|
|
187
188
|
task = task_from_dep(taskname)
|
|
188
189
|
deps = rec_dependencies(taskname)
|
|
@@ -474,7 +475,7 @@ module Workflow
|
|
|
474
475
|
else
|
|
475
476
|
workdir_find = workdir
|
|
476
477
|
end
|
|
477
|
-
|
|
478
|
+
|
|
478
479
|
workdir_find = File.expand_path(workdir_find)
|
|
479
480
|
path = File.expand_path(path)
|
|
480
481
|
dir = File.dirname(path)
|