rbbt-util 5.6.6 → 5.6.7
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/bin/rbbt +15 -6
- data/lib/rbbt/persist/tsv/tokyocabinet.rb +7 -0
- data/lib/rbbt/tsv.rb +1 -0
- data/lib/rbbt/tsv/accessor.rb +1 -1
- data/lib/rbbt/tsv/field_index.rb +56 -0
- data/lib/rbbt/tsv/filter.rb +2 -0
- data/lib/rbbt/tsv/manipulate.rb +2 -4
- data/lib/rbbt/util/log.rb +24 -5
- data/lib/rbbt/util/simpleopt/doc.rb +7 -4
- data/lib/rbbt/workflow.rb +7 -18
- data/lib/rbbt/workflow/accessor.rb +4 -2
- data/lib/rbbt/workflow/usage.rb +11 -9
- data/share/rbbt_commands/workflow/list +6 -5
- data/share/rbbt_commands/workflow/provenance +80 -0
- data/share/rbbt_commands/workflow/task +25 -4
- data/test/rbbt/tsv/test_field_index.rb +19 -0
- data/test/rbbt/tsv/test_filter.rb +1 -0
- data/test/rbbt/util/test_log.rb +9 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d05f8baf821976ddb0420b00980293a3cec0f400
|
4
|
+
data.tar.gz: 13794d29480143f51eb5438dbd92426ef298a22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f4a308e54ad217ab01b4b1930b1c07de7ccfddefbbe13c96b6d19c0d14227a07f1cfbbe0e3db6db745123a3b7c332b8f7071cbbc28210401d805eec2ab63cdf
|
7
|
+
data.tar.gz: ed3a3dadb218c3a979f05cc7a248657f561d17e48e165e2d187620f468a99ac3a04f924d6f11c55a98a50f5e77a144a9844263ff66e3debfa7c5035081155283
|
data/bin/rbbt
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
require 'rbbt'
|
4
4
|
require 'rbbt/util/simpleopt'
|
5
5
|
|
6
|
-
options = SOPT.get("--log* Log level from 0 (debug) 6 (errors):-cd--command_dir* Directory from where to load commands:--profile Profile execution")
|
6
|
+
options = SOPT.get("--log* Log level from 0 (debug) 6 (errors):-cd--command_dir* Directory from where to load commands:--profile Profile execution:--no_color Disable colored output:--locate_file Locate file been executed")
|
7
|
+
|
8
|
+
ENV["RBBT_NOCOLOR"] = "true" if options[:no_color]
|
9
|
+
locate = options.delete :locate_file
|
7
10
|
|
8
11
|
if options[:log]
|
9
12
|
Log.severity = options[:log].to_i
|
@@ -47,13 +50,14 @@ def rbbt_usage(prev = nil)
|
|
47
50
|
puts SOPT.doc
|
48
51
|
|
49
52
|
if prev
|
50
|
-
puts "## COMMANDS"
|
51
53
|
puts
|
52
|
-
puts
|
54
|
+
puts Log.color :magenta, "## COMMANDS"
|
55
|
+
puts
|
56
|
+
puts Log.color :magenta, "Command:"
|
53
57
|
puts
|
54
58
|
puts " #{File.basename($0)} #{prev * " "}"
|
55
59
|
puts
|
56
|
-
puts "Subcommands:"
|
60
|
+
puts Log.color :magenta, "Subcommands:"
|
57
61
|
puts
|
58
62
|
commands(prev).each do |command|
|
59
63
|
puts " " << command
|
@@ -86,8 +90,13 @@ begin
|
|
86
90
|
prev << command
|
87
91
|
dir = dir[command]
|
88
92
|
when dir[command].exists?
|
89
|
-
|
90
|
-
|
93
|
+
if locate
|
94
|
+
puts dir[command].find
|
95
|
+
exit 0
|
96
|
+
else
|
97
|
+
load dir[command].find
|
98
|
+
exit 0
|
99
|
+
end
|
91
100
|
else
|
92
101
|
error = "Command '#{command }' not understood"
|
93
102
|
rbbt_usage(prev)
|
data/lib/rbbt/tsv.rb
CHANGED
data/lib/rbbt/tsv/accessor.rb
CHANGED
@@ -8,7 +8,7 @@ module TSV
|
|
8
8
|
attr_accessor :unnamed, :serializer_module, :entity_options, :entity_templates
|
9
9
|
|
10
10
|
def annotate(tsv)
|
11
|
-
TSV.setup(tsv, :key_field => key_field, :fields => fields, :namespace => namespace, :entity_options => entity_options, :type => type, :filename => filename, :identifiers => identifiers)
|
11
|
+
TSV.setup(tsv, :key_field => key_field, :fields => fields, :namespace => namespace, :entity_options => entity_options, :type => type, :filename => filename, :identifiers => identifiers, :unnamed => unnamed)
|
12
12
|
end
|
13
13
|
|
14
14
|
def entity_options
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
module TSV
|
3
|
+
class << self
|
4
|
+
attr_accessor :field_index_dir
|
5
|
+
def field_index_dir
|
6
|
+
@field_index_dir ||= Rbbt.var.cache.field_indices
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :field_indices
|
11
|
+
|
12
|
+
|
13
|
+
def field_index(field)
|
14
|
+
@field_indices ||= {}
|
15
|
+
@field_indices[field] ||= Persist.persist_tsv(self, filename, {:field => field}, :prefix => "FieldIndex", :dir => TSV.field_index_dir, :persist => true, :serializer => :list, :engine => "BDB" ) do |data|
|
16
|
+
tsv = {}
|
17
|
+
case type
|
18
|
+
when :single, :list
|
19
|
+
through :key, [field] do |key, values|
|
20
|
+
value = values.first
|
21
|
+
tsv[value] ||= []
|
22
|
+
tsv[value] << key
|
23
|
+
end
|
24
|
+
else
|
25
|
+
through :key, [field] do |key, values|
|
26
|
+
values.first.each do |value|
|
27
|
+
tsv[value] ||= []
|
28
|
+
tsv[value] << key
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
tsv.each do |v,keys|
|
34
|
+
data[v] = keys.sort
|
35
|
+
end
|
36
|
+
|
37
|
+
data
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def field_index_select(matches)
|
42
|
+
final = nil
|
43
|
+
matches.each do |field,values|
|
44
|
+
i = field_index(field)
|
45
|
+
|
46
|
+
if Array === values
|
47
|
+
keys = values.inject([]){|acc,value| m = i[value]; acc = m.nil? ? acc : Misc.merge_sorted_arrays( acc, m) }
|
48
|
+
else
|
49
|
+
keys = i[values] || []
|
50
|
+
end
|
51
|
+
|
52
|
+
final = final.nil? ? keys : Misc.intersect_sorted_arrays(final, keys)
|
53
|
+
end
|
54
|
+
final
|
55
|
+
end
|
56
|
+
end
|
data/lib/rbbt/tsv/filter.rb
CHANGED
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -276,12 +276,10 @@ module TSV
|
|
276
276
|
end
|
277
277
|
|
278
278
|
data.extend TSV unless TSV === data
|
279
|
+
self.annotate(data)
|
280
|
+
|
279
281
|
data.key_field = new_key_field_name
|
280
282
|
data.fields = new_field_names
|
281
|
-
data.filename = filename
|
282
|
-
data.namespace = namespace
|
283
|
-
data.entity_options = entity_options
|
284
|
-
data.entity_templates = {}
|
285
283
|
data.fields.each do |field|
|
286
284
|
data.entity_templates[field] = entity_templates[field] if entity_templates.include? field
|
287
285
|
end
|
data/lib/rbbt/util/log.rb
CHANGED
@@ -23,12 +23,31 @@ module Log
|
|
23
23
|
|
24
24
|
WHITE, DARK, GREEN, YELLOW, RED = Color::SOLARIZED.values_at :base0, :base00, :green, :yellow, :magenta
|
25
25
|
|
26
|
-
|
26
|
+
if ENV["RBBT_NOCOLOR"] == "true"
|
27
|
+
SEVERITY_COLOR = [reset, "", "", "", "", "", ""] #.collect{|e| "\033[#{e}"}
|
28
|
+
else
|
29
|
+
SEVERITY_COLOR = [reset, cyan, green, magenta, blue, yellow, red] #.collect{|e| "\033[#{e}"}
|
30
|
+
end
|
27
31
|
|
28
32
|
HIGHLIGHT = "\033[1m"
|
29
33
|
|
30
|
-
def self.color(severity)
|
31
|
-
|
34
|
+
def self.color(severity, str = nil)
|
35
|
+
return str || "" if ENV["RBBT_NOCOLOR"] == "true"
|
36
|
+
color = SEVERITY_COLOR[severity] if Fixnum === severity
|
37
|
+
color = Term::ANSIColor.send(severity) if Symbol === severity and Term::ANSIColor.respond_to? severity
|
38
|
+
if str.nil?
|
39
|
+
color
|
40
|
+
else
|
41
|
+
color + str + color(0)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.highlight(str = nil)
|
46
|
+
if str.nil?
|
47
|
+
HIGHLIGHT
|
48
|
+
else
|
49
|
+
HIGHLIGHT + str + color(0)
|
50
|
+
end
|
32
51
|
end
|
33
52
|
|
34
53
|
def self.log(message = nil, severity = MEDIUM, &block)
|
@@ -40,8 +59,8 @@ module Log
|
|
40
59
|
|
41
60
|
sev_str = severity.to_s
|
42
61
|
|
43
|
-
prefix = time << "[" <<
|
44
|
-
message = "" <<
|
62
|
+
prefix = time << "[" << color(severity) << sev_str << color(0) << "]"
|
63
|
+
message = "" << highlight << message << color(0) if severity >= INFO
|
45
64
|
str = prefix << " " << message
|
46
65
|
|
47
66
|
STDERR.puts str
|
@@ -26,7 +26,8 @@ module SOPT
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.input_format(name, type = nil, default = nil, short = nil)
|
29
|
-
input_str = (short.nil? or short.empty?) ? "--#{name}" : "-#{short}, --#{name}"
|
29
|
+
input_str = (short.nil? or short.empty?) ? Log.color(:blue,"--#{name}") : Log.color(:blue, "-#{short}") << ", " << Log.color(:blue, "--#{name}")
|
30
|
+
input_str = Log.color(:blue, input_str)
|
30
31
|
input_str << case type
|
31
32
|
when nil
|
32
33
|
"#{default != nil ? " (default '#{default}')" : ""}:"
|
@@ -71,18 +72,20 @@ module SOPT
|
|
71
72
|
|
72
73
|
def self.doc
|
73
74
|
doc = <<-EOF
|
75
|
+
#{Log.color :magenta}
|
74
76
|
#{command}(1) -- #{summary}
|
75
77
|
#{"=" * (command.length + summary.length + 7)}
|
78
|
+
#{Log.color :reset}
|
76
79
|
|
77
|
-
## SYNOPSYS
|
80
|
+
#{ Log.color :magenta, "## SYNOPSYS"}
|
78
81
|
|
79
82
|
#{synopsys}
|
80
83
|
|
81
|
-
## DESCRIPTION
|
84
|
+
#{ Log.color :magenta, "## DESCRIPTION"}
|
82
85
|
|
83
86
|
#{description}
|
84
87
|
|
85
|
-
## OPTIONS
|
88
|
+
#{ Log.color :magenta, "## OPTIONS"}
|
86
89
|
|
87
90
|
#{input_doc(inputs, input_types, input_descriptions, input_defaults, input_shortcuts)}
|
88
91
|
EOF
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -70,22 +70,6 @@ module Workflow
|
|
70
70
|
else
|
71
71
|
filename = workflow_dir[wf_name]['workflow.rb'].find
|
72
72
|
end
|
73
|
-
|
74
|
-
#case
|
75
|
-
# # Points to workflow file
|
76
|
-
#when ((File.exists?(wf_name) and not File.directory?(wf_name)) or File.exists?(wf_name + '.rb'))
|
77
|
-
# filename = (wf_name =~ /\.?\//) ? wf_name : "./" << wf_name
|
78
|
-
#when (defined?(Rbbt) and Rbbt.etc.workflow_dir.exists?)
|
79
|
-
# dir = Rbbt.etc.workflow_dir.read.strip
|
80
|
-
# dir = File.join(dir, wf_name)
|
81
|
-
# filename = File.join(dir, 'workflow.rb')
|
82
|
-
#when defined?(Rbbt)
|
83
|
-
# path = Rbbt.workflows[wf_name].find
|
84
|
-
# filename = File.join(path, 'workflow.rb')
|
85
|
-
#else
|
86
|
-
# path = File.join(ENV['HOME'], '.workflows', wf_name)
|
87
|
-
# filename = File.join(dir, 'workflow.rb')
|
88
|
-
#end
|
89
73
|
end
|
90
74
|
|
91
75
|
if filename and File.exists? filename
|
@@ -99,9 +83,9 @@ module Workflow
|
|
99
83
|
|
100
84
|
# Already loaded
|
101
85
|
begin
|
102
|
-
Misc.string2const wf_name
|
86
|
+
workflow = Misc.string2const wf_name
|
103
87
|
Log.debug{"Workflow #{ wf_name } already loaded"}
|
104
|
-
return
|
88
|
+
return workflow
|
105
89
|
rescue Exception
|
106
90
|
end
|
107
91
|
|
@@ -129,6 +113,11 @@ module Workflow
|
|
129
113
|
require_local_workflow(Misc.snake_case(wf_name)) or
|
130
114
|
(Workflow.autoinstall and `rbbt workflow install #{Misc.snake_case(wf_name)}` and require_local_workflow(Misc.snake_case(wf_name))) or
|
131
115
|
raise("Workflow not found or could not be loaded: #{ wf_name }")
|
116
|
+
begin
|
117
|
+
Misc.string2const Misc.camel_case(wf_name)
|
118
|
+
rescue
|
119
|
+
Workflow.workflows.last || true
|
120
|
+
end
|
132
121
|
end
|
133
122
|
|
134
123
|
attr_accessor :description
|
@@ -347,7 +347,9 @@ module Workflow
|
|
347
347
|
workdir_find = workdir
|
348
348
|
end
|
349
349
|
|
350
|
-
|
350
|
+
workdir_find = File.expand_path(workdir_find)
|
351
|
+
path = File.expand_path(path)
|
352
|
+
dir = File.dirname(path)
|
353
|
+
Misc.path_relative_to(workdir_find, dir).sub(/([^\/]+)\/.*/,'\1')
|
351
354
|
end
|
352
|
-
|
353
355
|
end
|
data/lib/rbbt/workflow/usage.rb
CHANGED
@@ -2,18 +2,20 @@ require 'rbbt/util/simpleopt'
|
|
2
2
|
|
3
3
|
module Task
|
4
4
|
def doc(deps = nil)
|
5
|
-
puts "## #{ name }:"
|
6
|
-
puts "\n" << description if description and not description.empty?
|
5
|
+
puts Log.color :magenta, "## #{ name }:"
|
6
|
+
puts "\n" << description << "\n" if description and not description.empty?
|
7
|
+
puts "Returns: " << Log.color(:blue, result_type.to_s) << "\n"
|
7
8
|
puts SOPT.input_doc(inputs, input_types, input_descriptions, input_defaults, true)
|
9
|
+
puts
|
10
|
+
|
8
11
|
|
9
12
|
if deps and deps.any?
|
10
|
-
puts
|
11
13
|
puts "From dependencies:"
|
12
14
|
puts
|
13
15
|
deps.each do |dep|
|
14
16
|
puts " #{dep.name}:"
|
15
17
|
puts
|
16
|
-
puts SOPT.input_doc(dep.inputs, dep.input_types, dep.input_descriptions, dep.input_defaults, true)
|
18
|
+
puts SOPT.input_doc((dep.inputs - self.inputs), dep.input_types, dep.input_descriptions, dep.input_defaults, true)
|
17
19
|
puts
|
18
20
|
end
|
19
21
|
end
|
@@ -24,17 +26,17 @@ module Workflow
|
|
24
26
|
def doc(task = nil)
|
25
27
|
|
26
28
|
if task.nil?
|
27
|
-
puts self.to_s
|
28
|
-
puts "=" * self.to_s.length
|
29
|
+
puts Log.color :magenta, self.to_s
|
30
|
+
puts Log.color :magenta, "=" * self.to_s.length
|
29
31
|
puts
|
30
32
|
puts "\n" << workflow_description if workflow_description and not workflow_description.empty?
|
31
33
|
puts
|
32
34
|
|
33
|
-
puts "## TASKS"
|
35
|
+
puts Log.color :magenta, "## TASKS"
|
34
36
|
puts
|
35
37
|
tasks.each do |name,task|
|
36
|
-
puts " * #{ name }:"
|
37
|
-
puts " " << task.description if task.description and not task.description.empty?
|
38
|
+
puts " * #{ Log.color :green, name.to_s }:"
|
39
|
+
puts " " << task.description.split(/\n\s*\n/).first if task.description and not task.description.empty?
|
38
40
|
puts
|
39
41
|
end
|
40
42
|
else
|
@@ -12,16 +12,17 @@ Path.setup(workflow_dir) unless Path === workflow_dir
|
|
12
12
|
|
13
13
|
files = workflow_dir.find_all.collect{|p| p.glob("*") }.flatten.select{|f| File.directory? f }
|
14
14
|
|
15
|
-
puts defined? COSMIC
|
16
15
|
if options[:describe]
|
17
16
|
files.each do |file|
|
18
17
|
workflow = File.basename(file)
|
19
18
|
Workflow.require_workflow workflow
|
20
|
-
ddd Workflow.workflows
|
21
19
|
workflow = Workflow.workflows.select{|w| Misc.camel_case(w.to_s) == Misc.camel_case(workflow)}.first
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
puts "# "<<[Misc.camel_case(workflow.to_s), workflow.description] * ": "
|
21
|
+
workflow.tasks.each do |name,task|
|
22
|
+
puts " * " << [name, task.inputs * " "] * ": "
|
23
|
+
end
|
24
|
+
puts
|
25
|
+
|
25
26
|
end
|
26
27
|
else
|
27
28
|
files.each do |file|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbbt/workflow'
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
require 'rbbt-util'
|
8
|
+
require 'fileutils'
|
9
|
+
require 'rbbt/util/simpleopt'
|
10
|
+
require 'rbbt/workflow/step'
|
11
|
+
require 'rbbt/util/misc'
|
12
|
+
|
13
|
+
$workdir = Path.setup(File.expand_path(ARGV[0] || '.'))
|
14
|
+
|
15
|
+
|
16
|
+
YAML::ENGINE.yamler = 'syck' if defined? YAML::ENGINE and YAML::ENGINE.respond_to? :yamler
|
17
|
+
|
18
|
+
def info_files
|
19
|
+
$workdir.glob(Step.info_file('**/*'))
|
20
|
+
end
|
21
|
+
|
22
|
+
def running?(info)
|
23
|
+
Misc.pid_exists? info[:pid]
|
24
|
+
end
|
25
|
+
|
26
|
+
def job_str(file, info, severity_color = nil)
|
27
|
+
clean_file = file.sub('./','').sub('.info','').gsub('/', Term::ANSIColor.blue(' => '))
|
28
|
+
if $name
|
29
|
+
clean_file
|
30
|
+
else
|
31
|
+
info ||= {:status => :missing_info_file}
|
32
|
+
str = [clean_file, info[:status].to_s] * "\t\t\t[ STATUS = " + " ]"
|
33
|
+
if info[:status] != :error and info[:status] != :aborted and not info[:status] == :done
|
34
|
+
str += " (#{running?(info)? :running : :dead} #{info[:pid]})" if info[:pid]
|
35
|
+
str += " (children: #{info[:children_pids].collect{|pid| [pid, Misc.pid_exists?(pid) ? "R" : "D"] * ":"} * ", "})" if info.include? :children_pids
|
36
|
+
end
|
37
|
+
|
38
|
+
if severity_color
|
39
|
+
"#{severity_color}" << str << "\033[0m"
|
40
|
+
else
|
41
|
+
str
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
file = ARGV[0]
|
47
|
+
|
48
|
+
deps = {}
|
49
|
+
|
50
|
+
$done = []
|
51
|
+
def print(file, offset = 1)
|
52
|
+
if not $done.include? file
|
53
|
+
putc "*"
|
54
|
+
end
|
55
|
+
|
56
|
+
step = Step.new file.sub('.info','')
|
57
|
+
|
58
|
+
info = step.info
|
59
|
+
dependencies = info[:dependencies] || []
|
60
|
+
color = case
|
61
|
+
when (not info)
|
62
|
+
Log::SEVERITY_COLOR[3]
|
63
|
+
when info[:status] == :error
|
64
|
+
Log::SEVERITY_COLOR[3]
|
65
|
+
when info[:status] == :aborted
|
66
|
+
Log::SEVERITY_COLOR[2]
|
67
|
+
when (info[:status] != :done and info[:pid] and not running? info)
|
68
|
+
Log::SEVERITY_COLOR[2]
|
69
|
+
end
|
70
|
+
|
71
|
+
puts (" " * offset * 2) << job_str(step.path, step.info, color)
|
72
|
+
$done << file
|
73
|
+
root = File.dirname(File.dirname(file))
|
74
|
+
dependencies.each do |task,new_file|
|
75
|
+
new_file = File.join(root, task.to_s, new_file)
|
76
|
+
print(new_file, offset+1)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
print(file)
|
@@ -6,9 +6,25 @@ require 'rbbt/workflow/usage'
|
|
6
6
|
|
7
7
|
YAML::ENGINE.yamler = 'syck' if defined? YAML::ENGINE and YAML::ENGINE.respond_to? :yamler
|
8
8
|
|
9
|
+
def load_inputs(dir, task)
|
10
|
+
inputs = {}
|
11
|
+
dir = Path.setup(dir.dup)
|
12
|
+
task.inputs.each do |input|
|
13
|
+
file = dir[input].find
|
14
|
+
next unless file.exists?
|
15
|
+
case task.input_types[input]
|
16
|
+
when :tsv, :array, :text
|
17
|
+
inputs[input.to_sym] = file
|
18
|
+
else
|
19
|
+
inputs[input.to_sym] = file.read
|
20
|
+
end
|
21
|
+
end
|
22
|
+
inputs
|
23
|
+
end
|
24
|
+
|
9
25
|
def usage(workflow = nil, task = nil, exception=nil)
|
10
26
|
puts SOPT.doc
|
11
|
-
puts "## WORKFLOW"
|
27
|
+
puts Log.color :magenta, "## WORKFLOW"
|
12
28
|
puts
|
13
29
|
if workflow.nil?
|
14
30
|
puts "No workflow specified"
|
@@ -19,8 +35,8 @@ def usage(workflow = nil, task = nil, exception=nil)
|
|
19
35
|
workflow.load_tasks if workflow.respond_to? :load_tasks
|
20
36
|
workflow.doc
|
21
37
|
else
|
22
|
-
puts workflow.to_s
|
23
|
-
puts "=" * workflow.to_s.length
|
38
|
+
puts Log.color :magenta, workflow.to_s
|
39
|
+
puts Log.color :magenta, "=" * workflow.to_s.length
|
24
40
|
puts
|
25
41
|
puts workflow.workflow_description
|
26
42
|
puts
|
@@ -115,6 +131,7 @@ options = SOPT.get <<EOF
|
|
115
131
|
-O--output* Save job result into file:
|
116
132
|
-jf--job_file* Output one of the job produced files:
|
117
133
|
-ljf--list_job_files List all the files produced in that step:
|
134
|
+
--load_inputs* Load inputs from a directory
|
118
135
|
--info Show the job info:
|
119
136
|
--provenance Report the jobs provenance:
|
120
137
|
EOF
|
@@ -173,7 +190,11 @@ name = options.delete(:jobname) || "Default"
|
|
173
190
|
|
174
191
|
# get job args
|
175
192
|
sopt_option_string = SOPT_options(workflow, task)
|
176
|
-
|
193
|
+
if options[:load_inputs]
|
194
|
+
job_options = load_inputs(options[:load_inputs], task)
|
195
|
+
else
|
196
|
+
job_options = SOPT.get sopt_option_string
|
197
|
+
end
|
177
198
|
job_options = fix_options(workflow, task, job_options)
|
178
199
|
|
179
200
|
workflow.workdir = Path.setup(File.expand_path(options.delete(:workdir))) if options[:workdir]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), '../../', 'test_helper.rb')
|
2
|
+
require 'rbbt/tsv'
|
3
|
+
require 'rbbt/tsv/field_index'
|
4
|
+
|
5
|
+
class TestTSVFieldIndex < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_zipped
|
8
|
+
content =<<-EOF
|
9
|
+
#Id ValueA ValueB ValueC
|
10
|
+
rowA A|AA B|BB C|CC
|
11
|
+
rowa a|aa b|BB C|CC
|
12
|
+
EOF
|
13
|
+
|
14
|
+
TmpFile.with_file(content) do |filename|
|
15
|
+
tsv = TSV.open(File.open(filename), :sep => /\s+/, :type => :double)
|
16
|
+
puts tsv.field_index("ValueA")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
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.6.
|
4
|
+
version: 5.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/rbbt/tsv/attach/util.rb
|
177
177
|
- lib/rbbt/tsv/change_id.rb
|
178
178
|
- lib/rbbt/tsv/excel.rb
|
179
|
+
- lib/rbbt/tsv/field_index.rb
|
179
180
|
- lib/rbbt/tsv/filter.rb
|
180
181
|
- lib/rbbt/tsv/index.rb
|
181
182
|
- lib/rbbt/tsv/manipulate.rb
|
@@ -241,6 +242,7 @@ files:
|
|
241
242
|
- share/rbbt_commands/workflow/install
|
242
243
|
- share/rbbt_commands/workflow/list
|
243
244
|
- share/rbbt_commands/workflow/monitor
|
245
|
+
- share/rbbt_commands/workflow/provenance
|
244
246
|
- share/rbbt_commands/workflow/remote/add
|
245
247
|
- share/rbbt_commands/workflow/remote/list
|
246
248
|
- share/rbbt_commands/workflow/remote/remove
|
@@ -268,6 +270,7 @@ files:
|
|
268
270
|
- test/rbbt/tsv/test_accessor.rb
|
269
271
|
- test/rbbt/tsv/test_attach.rb
|
270
272
|
- test/rbbt/tsv/test_change_id.rb
|
273
|
+
- test/rbbt/tsv/test_field_index.rb
|
271
274
|
- test/rbbt/tsv/test_filter.rb
|
272
275
|
- test/rbbt/tsv/test_index.rb
|
273
276
|
- test/rbbt/tsv/test_manipulate.rb
|
@@ -280,6 +283,7 @@ files:
|
|
280
283
|
- test/rbbt/util/test_colorize.rb
|
281
284
|
- test/rbbt/util/test_excel2tsv.rb
|
282
285
|
- test/rbbt/util/test_filecache.rb
|
286
|
+
- test/rbbt/util/test_log.rb
|
283
287
|
- test/rbbt/util/test_misc.rb
|
284
288
|
- test/rbbt/util/test_open.rb
|
285
289
|
- test/rbbt/util/test_semaphore.rb
|
@@ -321,6 +325,7 @@ test_files:
|
|
321
325
|
- test/rbbt/util/simpleopt/test_parse.rb
|
322
326
|
- test/rbbt/util/test_chain_methods.rb
|
323
327
|
- test/rbbt/util/test_simpleDSL.rb
|
328
|
+
- test/rbbt/util/test_log.rb
|
324
329
|
- test/rbbt/util/test_open.rb
|
325
330
|
- test/rbbt/util/test_R.rb
|
326
331
|
- test/rbbt/util/test_colorize.rb
|
@@ -347,6 +352,7 @@ test_files:
|
|
347
352
|
- test/rbbt/persist/tsv/test_cdb.rb
|
348
353
|
- test/rbbt/persist/tsv/test_tokyocabinet.rb
|
349
354
|
- test/rbbt/persist/tsv/test_leveldb.rb
|
355
|
+
- test/rbbt/tsv/test_field_index.rb
|
350
356
|
- test/rbbt/tsv/test_index.rb
|
351
357
|
- test/rbbt/tsv/test_change_id.rb
|
352
358
|
- test/rbbt/tsv/test_util.rb
|