rbbt-util 5.17.27 → 5.17.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/association/database.rb +5 -0
- data/lib/rbbt/tsv/stream.rb +9 -3
- data/lib/rbbt/util/misc/lock.rb +6 -10
- data/lib/rbbt/util/misc/pipes.rb +19 -0
- data/lib/rbbt/workflow/definition.rb +2 -1
- data/lib/rbbt/workflow/step.rb +49 -8
- data/test/rbbt/workflow/test_step.rb +9 -5
- 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: b62b4d3d3b46cfcf8e631a471daf1cc574843cc8
|
4
|
+
data.tar.gz: 5b284a5ef7ade80f035ece5978a3cd31c5ea1d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a85420b0c5ad7ac41d5f6cd46add0d49bd1841658849acba2e06c5f4f57a3f854a93916789afbaa4794137ee4855a63e88cdf4a430cb8e5df5fcda868d8f2e39
|
7
|
+
data.tar.gz: f36d892b81611a5e2fffc95c50ca5fb0cb6121aca61552a74d60e9c20ede3daf1d1bb1422b8f00b8c84414773e41b534ef71747e5ddcd2391ea0a2f6d729d23f
|
@@ -140,6 +140,11 @@ module Association
|
|
140
140
|
|
141
141
|
def self.database(file, options = {})
|
142
142
|
database = case file
|
143
|
+
when Step
|
144
|
+
file.clean if file.error? or file.aborted? or file.dirty?
|
145
|
+
file.run(true) unless file.done? or file.started?
|
146
|
+
file.join unless file.done?
|
147
|
+
open_stream(TSV.get_stream(file), options.dup)
|
143
148
|
when TSV
|
144
149
|
file = file.to_double unless file.type == :double
|
145
150
|
reorder_tsv(file, options.dup)
|
data/lib/rbbt/tsv/stream.rb
CHANGED
@@ -18,7 +18,7 @@ module TSV
|
|
18
18
|
|
19
19
|
def self.paste_streams(streams, options = {})
|
20
20
|
options = Misc.add_defaults options, :sep => "\t", :sort => true
|
21
|
-
sort, sep, preamble, same_fields = Misc.process_options options, :sort, :sep, :preamble, :same_fields
|
21
|
+
sort, sep, preamble, header, same_fields, fix_flat = Misc.process_options options, :sort, :sep, :preamble, :header, :same_fields, :fix_flat
|
22
22
|
|
23
23
|
out = Misc.open_pipe do |sin|
|
24
24
|
|
@@ -63,7 +63,11 @@ module TSV
|
|
63
63
|
input_options << parser.options
|
64
64
|
preambles << parser.preamble if preamble and not parser.preamble.empty?
|
65
65
|
|
66
|
-
parser.
|
66
|
+
if fix_flat and parser.type == :flat
|
67
|
+
TSV.stream_flat2double(parser.stream).stream
|
68
|
+
else
|
69
|
+
parser.stream
|
70
|
+
end
|
67
71
|
end
|
68
72
|
|
69
73
|
key_field = key_fields.compact.first
|
@@ -74,6 +78,7 @@ module TSV
|
|
74
78
|
end
|
75
79
|
options = options.merge(input_options.first)
|
76
80
|
options[:type] = :list if options[:type] == :single
|
81
|
+
options[:type] = :double if fix_flat
|
77
82
|
|
78
83
|
preamble_txt = case preamble
|
79
84
|
when TrueClass
|
@@ -88,7 +93,7 @@ module TSV
|
|
88
93
|
nil
|
89
94
|
end
|
90
95
|
|
91
|
-
header
|
96
|
+
header ||= TSV.header_lines(key_field, fields, options.merge(:preamble => preamble_txt))
|
92
97
|
sin.puts header
|
93
98
|
|
94
99
|
empty_pos = empty.collect{|stream| streams.index stream }
|
@@ -210,6 +215,7 @@ module TSV
|
|
210
215
|
dumper = TSV::Dumper.new dumper_options
|
211
216
|
dumper.init
|
212
217
|
TSV.traverse parser, :into => dumper do |key,values|
|
218
|
+
key = key.first if Array === key
|
213
219
|
[key, [values]]
|
214
220
|
end
|
215
221
|
dumper
|
data/lib/rbbt/util/misc/lock.rb
CHANGED
@@ -3,20 +3,16 @@ module Misc
|
|
3
3
|
if use
|
4
4
|
Log.medium "Activating lockfile ids"
|
5
5
|
Lockfile.dont_use_lock_id = false
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
Lockfile.refresh = 2
|
7
|
+
Lockfile.max_age = 30
|
8
|
+
Lockfile.suspend = 4
|
9
9
|
else
|
10
10
|
Log.medium "De-activating lockfile ids"
|
11
11
|
Lockfile.dont_use_lock_id = true
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
Lockfile.refresh = 4
|
13
|
+
Lockfile.max_age = 60
|
14
|
+
Lockfile.suspend = 8
|
15
15
|
end
|
16
|
-
|
17
|
-
Lockfile.refresh = 10
|
18
|
-
Lockfile.max_age = 60
|
19
|
-
Lockfile.suspend = 2
|
20
16
|
end
|
21
17
|
|
22
18
|
self.use_lock_id = ENV["RBBT_NO_LOCKFILE_ID"] != "true"
|
data/lib/rbbt/util/misc/pipes.rb
CHANGED
@@ -462,4 +462,23 @@ module Misc
|
|
462
462
|
out
|
463
463
|
end
|
464
464
|
|
465
|
+
def self.intercalate_streams(streams)
|
466
|
+
Misc.open_pipe do |sin|
|
467
|
+
continue = true
|
468
|
+
while continue
|
469
|
+
line1 = streams.first.gets unless streams.first.eof?
|
470
|
+
line2 = streams.last.gets unless streams.first.eof?
|
471
|
+
continue = false if line1.nil? and line2.nil?
|
472
|
+
sin.puts line1.strip if line1
|
473
|
+
sin.puts line2.strip if line2
|
474
|
+
line1 = nil
|
475
|
+
line2 = nil
|
476
|
+
end
|
477
|
+
streams.each do |stream|
|
478
|
+
stream.join if stream.respond_to? :join
|
479
|
+
stream.close if stream.respond_to? :close and not stream.closed?
|
480
|
+
end
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
465
484
|
end
|
@@ -80,7 +80,8 @@ module Workflow
|
|
80
80
|
:inputs => consume_inputs,
|
81
81
|
:description => consume_description,
|
82
82
|
:input_types => consume_input_types,
|
83
|
-
:result_type => (
|
83
|
+
:result_type => (String === type ? type.to_sym : type),
|
84
|
+
:result_description => consume_result_description,
|
84
85
|
:input_defaults => consume_input_defaults,
|
85
86
|
:input_descriptions => consume_input_descriptions,
|
86
87
|
:extension => consume_extension,
|
data/lib/rbbt/workflow/step.rb
CHANGED
@@ -94,8 +94,8 @@ class Step
|
|
94
94
|
self
|
95
95
|
end
|
96
96
|
|
97
|
-
def prepare_result(value, description = nil,
|
98
|
-
case
|
97
|
+
def prepare_result(value, description = nil, entity_info = nil)
|
98
|
+
res = case
|
99
99
|
when IO === value
|
100
100
|
begin
|
101
101
|
res = case @task.result_type
|
@@ -127,13 +127,44 @@ class Step
|
|
127
127
|
value
|
128
128
|
when Annotated === value
|
129
129
|
annotations = value.annotations
|
130
|
-
|
130
|
+
entity_info ||= begin
|
131
|
+
entity_info = info.dup
|
132
|
+
entity_info.merge! info[:inputs] if info[:inputs]
|
133
|
+
entity_info
|
134
|
+
end
|
135
|
+
entity_info.each do |k,v|
|
131
136
|
value.send("#{h}=", v) if annotations.include? k
|
132
137
|
end
|
138
|
+
|
133
139
|
value
|
134
140
|
else
|
135
|
-
|
141
|
+
entity_info ||= begin
|
142
|
+
entity_info = info.dup
|
143
|
+
entity_info.merge! info[:inputs] if info[:inputs]
|
144
|
+
entity_info
|
145
|
+
end
|
146
|
+
Entity.formats[description].setup(value, entity_info.merge(:format => description))
|
136
147
|
end
|
148
|
+
|
149
|
+
if Annotated === res
|
150
|
+
dep_hash = nil
|
151
|
+
res.annotations.each do |a|
|
152
|
+
a = a.to_s
|
153
|
+
varname = "@" + a
|
154
|
+
next unless res.instance_variable_get(varname).nil?
|
155
|
+
|
156
|
+
dep_hash ||= begin
|
157
|
+
h = {}
|
158
|
+
rec_dependencies.each{|dep| h[dep.task.name.to_s] ||= dep }
|
159
|
+
h
|
160
|
+
end
|
161
|
+
dep = dep_hash[a]
|
162
|
+
next if dep.nil?
|
163
|
+
res.send(a.to_s+"=", dep.load)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
res
|
137
168
|
end
|
138
169
|
|
139
170
|
|
@@ -152,10 +183,20 @@ class Step
|
|
152
183
|
|
153
184
|
|
154
185
|
def load
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
186
|
+
res = if @result and not @path == @result
|
187
|
+
res = @result
|
188
|
+
else
|
189
|
+
join if not done?
|
190
|
+
@path.exists? ? Persist.load_file(@path, @task.result_type) : exec
|
191
|
+
end
|
192
|
+
|
193
|
+
if @task.result_description
|
194
|
+
entity_info = info.dup
|
195
|
+
entity_info.merge! info[:inputs] if info[:inputs]
|
196
|
+
res = prepare_result res, @task.result_description, entity_info
|
197
|
+
end
|
198
|
+
|
199
|
+
res
|
159
200
|
end
|
160
201
|
|
161
202
|
def self.clean(path)
|
@@ -204,14 +204,18 @@ class TestStep < Test::Unit::TestCase
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
Step.wait_for_jobs(jobs)
|
207
|
-
#jobs.each do |job|
|
208
|
-
# while not job.done?
|
209
|
-
# sleep 1
|
210
|
-
# end
|
211
|
-
#end
|
212
207
|
ensure
|
213
208
|
RbbtSemaphore.delete_semaphore(semaphore)
|
214
209
|
end
|
215
210
|
end
|
216
211
|
end
|
212
|
+
|
213
|
+
def __test_load_return_description
|
214
|
+
require 'rbbt/workflow'
|
215
|
+
Workflow.require_workflow "Study"
|
216
|
+
study = Study.setup("LICA-FR")
|
217
|
+
job = study.recurrent_mutations(:job)
|
218
|
+
iii job.load.organism
|
219
|
+
iii study.recurrent_mutations.organism
|
220
|
+
end
|
217
221
|
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.17.
|
4
|
+
version: 5.17.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|