rbbt-util 5.11.4 → 5.11.5
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/tsv/parallel/traverse.rb +2 -1
- data/lib/rbbt/util/cmd.rb +1 -1
- data/lib/rbbt/util/misc.rb +11 -1173
- data/lib/rbbt/util/misc/concurrent_stream.rb +69 -0
- data/lib/rbbt/util/misc/development.rb +95 -0
- data/lib/rbbt/util/misc/exceptions.rb +11 -0
- data/lib/rbbt/util/misc/format.rb +170 -0
- data/lib/rbbt/util/misc/indiferent_hash.rb +56 -0
- data/lib/rbbt/util/misc/inspect.rb +181 -0
- data/lib/rbbt/util/misc/lock.rb +87 -0
- data/lib/rbbt/util/misc/math.rb +32 -0
- data/lib/rbbt/util/misc/objects.rb +0 -0
- data/lib/rbbt/util/misc/omics.rb +183 -0
- data/lib/rbbt/util/misc/pipes.rb +224 -0
- data/lib/rbbt/workflow/accessor.rb +1 -0
- data/lib/rbbt/workflow/step.rb +15 -9
- data/share/rbbt_commands/workflow/task +2 -0
- metadata +13 -2
@@ -72,6 +72,7 @@ class Step
|
|
72
72
|
def set_info(key, value)
|
73
73
|
return nil if @exec or info_file.nil?
|
74
74
|
value = Annotated.purge value if defined? Annotated
|
75
|
+
lock_filename = Persist.persistence_path(info_file, {:dir => Step.lock_dir})
|
75
76
|
Open.lock(info_file) do
|
76
77
|
i = info
|
77
78
|
i[key] = value
|
data/lib/rbbt/workflow/step.rb
CHANGED
@@ -11,6 +11,14 @@ class Step
|
|
11
11
|
attr_accessor :exec
|
12
12
|
attr_accessor :result, :mutex
|
13
13
|
|
14
|
+
class << self
|
15
|
+
attr_accessor :lock_dir
|
16
|
+
|
17
|
+
def lock_dir
|
18
|
+
@lock_dir ||= Rbbt.tmp.step_info_locks.find
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
14
22
|
def initialize(path, task = nil, inputs = nil, dependencies = nil, bindings = nil)
|
15
23
|
path = Path.setup(Misc.sanitize_filename(path)) if String === path
|
16
24
|
pat = path.call if Proc === path
|
@@ -61,7 +69,6 @@ def relay_log(step)
|
|
61
69
|
end
|
62
70
|
|
63
71
|
def prepare_result(value, description = nil, info = {})
|
64
|
-
#info = self.info
|
65
72
|
case
|
66
73
|
when IO === value
|
67
74
|
begin
|
@@ -69,7 +76,7 @@ def prepare_result(value, description = nil, info = {})
|
|
69
76
|
when :array
|
70
77
|
array = []
|
71
78
|
while line = value.gets
|
72
|
-
array << line
|
79
|
+
array << line.strip
|
73
80
|
end
|
74
81
|
array
|
75
82
|
when :tsv
|
@@ -160,6 +167,7 @@ def join
|
|
160
167
|
dependencies.each{|dep| dep.join }
|
161
168
|
self
|
162
169
|
end
|
170
|
+
self
|
163
171
|
end
|
164
172
|
|
165
173
|
def checks
|
@@ -184,14 +192,14 @@ end
|
|
184
192
|
def run_dependencies(seen = [])
|
185
193
|
seen << self.path
|
186
194
|
dependencies.uniq.each{|dependency|
|
187
|
-
|
195
|
+
next if seen.include? dependency.path
|
196
|
+
Log.info "#{Log.color :magenta, "Checking dependency"} #{Log.color :yellow, task.name.to_s || ""} => #{Log.color :yellow, dependency.task_name.to_s || ""} -- #{Log.color :blue, dependency.path}"
|
188
197
|
begin
|
189
|
-
next if seen.include? dependency.path
|
190
198
|
dependency.relay_log self
|
191
|
-
dependency.clean if not dependency.done? and dependency.error? or dependency.aborted?
|
199
|
+
dependency.clean if not dependency.done? and (dependency.error? or dependency.aborted?)
|
192
200
|
dependency.clean if dependency.streaming? and not dependency.running?
|
193
|
-
dependency.run_dependencies(seen)
|
194
|
-
dependency.run true unless dependency.result or dependency.done?
|
201
|
+
#dependency.run_dependencies(seen)
|
202
|
+
dependency.run(ENV["RBBT_NO_STREAM"] != 'true') unless dependency.result or dependency.done?
|
195
203
|
seen << dependency.path
|
196
204
|
seen.concat dependency.rec_dependencies.collect{|d| d.path}
|
197
205
|
rescue Exception
|
@@ -321,10 +329,8 @@ def run(no_load = false)
|
|
321
329
|
|
322
330
|
def fork(semaphore = nil)
|
323
331
|
raise "Can not fork: Step is waiting for proces #{@pid} to finish" if not @pid.nil? and not Process.pid == @pid
|
324
|
-
iii :forking
|
325
332
|
@pid = Process.fork do
|
326
333
|
begin
|
327
|
-
iii :forked
|
328
334
|
RbbtSemaphore.wait_semaphore(semaphore) if semaphore
|
329
335
|
FileUtils.mkdir_p File.dirname(path) unless Open.exists? File.dirname(path)
|
330
336
|
begin
|
@@ -108,8 +108,10 @@ def fix_options(workflow, task, job_options)
|
|
108
108
|
else
|
109
109
|
str = case
|
110
110
|
when value == '-'
|
111
|
+
$array_separator ||= "\n"
|
111
112
|
STDIN.read
|
112
113
|
when (String === value and File.exists?(value))
|
114
|
+
$array_separator ||= "\n"
|
113
115
|
Open.read(value)
|
114
116
|
else
|
115
117
|
value
|
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.11.
|
4
|
+
version: 5.11.5
|
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-04-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -174,6 +174,17 @@ files:
|
|
174
174
|
- lib/rbbt/util/filecache.rb
|
175
175
|
- lib/rbbt/util/log.rb
|
176
176
|
- lib/rbbt/util/misc.rb
|
177
|
+
- lib/rbbt/util/misc/concurrent_stream.rb
|
178
|
+
- lib/rbbt/util/misc/development.rb
|
179
|
+
- lib/rbbt/util/misc/exceptions.rb
|
180
|
+
- lib/rbbt/util/misc/format.rb
|
181
|
+
- lib/rbbt/util/misc/indiferent_hash.rb
|
182
|
+
- lib/rbbt/util/misc/inspect.rb
|
183
|
+
- lib/rbbt/util/misc/lock.rb
|
184
|
+
- lib/rbbt/util/misc/math.rb
|
185
|
+
- lib/rbbt/util/misc/objects.rb
|
186
|
+
- lib/rbbt/util/misc/omics.rb
|
187
|
+
- lib/rbbt/util/misc/pipes.rb
|
177
188
|
- lib/rbbt/util/named_array.rb
|
178
189
|
- lib/rbbt/util/open.rb
|
179
190
|
- lib/rbbt/util/semaphore.rb
|