rbbt-util 5.32.30 → 5.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/persist/tsv/adapter.rb +25 -0
- data/lib/rbbt/persist.rb +6 -4
- data/lib/rbbt/resource/path.rb +4 -0
- data/lib/rbbt/tsv/util.rb +12 -1
- data/lib/rbbt/util/concurrency/processes.rb +2 -1
- data/lib/rbbt/workflow/step/accessor.rb +5 -1
- data/lib/rbbt/workflow/step/info.rb +1 -1
- data/lib/rbbt/workflow/step/save_load_inputs.rb +4 -0
- data/lib/rbbt/workflow/util/orchestrator.rb +11 -2
- data/share/rbbt_commands/workflow/task +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a6b198e57fe73c0e36e7aea6164bafd1a8a97d10b3a992f17d0ba6dc531a3c7
|
4
|
+
data.tar.gz: 5aa8b8753fc88d5de6fa8f6db31b9b71a57ee5dcc86380041582a4985984f749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a61b6e6671803d73b7993b2de9c6cf16d4f463ddd04f9378b54c77a00eb7292b4e817eea14cce81704fe3f2640d38ede202a3928d293ab1fe7e0e67fa87a35b0
|
7
|
+
data.tar.gz: d41b1477aab34bfc08610602a3e333a5701edb58d9fa10ecf24436659c4e996bb000ceccb20bbcba1f153ec4e888264ae47ab28689b9e2879601da0b7822e831
|
@@ -111,6 +111,31 @@ module Persist
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
def with_read(&block)
|
115
|
+
if read? || write?
|
116
|
+
return yield
|
117
|
+
else
|
118
|
+
read_and_close &block
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def with_write(&block)
|
123
|
+
if write?
|
124
|
+
return yield
|
125
|
+
else
|
126
|
+
if self.read?
|
127
|
+
self.write_and_read do
|
128
|
+
return yield
|
129
|
+
end
|
130
|
+
else
|
131
|
+
self.write_and_close do
|
132
|
+
return yield
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
|
114
139
|
def read_and_close
|
115
140
|
if read? || write?
|
116
141
|
begin
|
data/lib/rbbt/persist.rb
CHANGED
@@ -423,6 +423,8 @@ module Persist
|
|
423
423
|
end
|
424
424
|
end
|
425
425
|
|
426
|
+
repo.read
|
427
|
+
|
426
428
|
case
|
427
429
|
when (keys.length == 1 and keys.first == subkey + 'NIL')
|
428
430
|
nil
|
@@ -430,19 +432,19 @@ module Persist
|
|
430
432
|
[]
|
431
433
|
when (keys.length == 1 and keys.first =~ /:SINGLE$/)
|
432
434
|
key = keys.first
|
433
|
-
values = repo.
|
435
|
+
values = repo.with_read do
|
434
436
|
repo[key]
|
435
437
|
end
|
436
438
|
Annotated.load_tsv_values(key, values, "literal", "annotation_types", "JSON")
|
437
439
|
when (keys.any? and not keys.first =~ /ANNOTATED_DOUBLE_ARRAY/)
|
438
|
-
repo.
|
440
|
+
repo.with_read do
|
439
441
|
keys.sort_by{|k| k.split(":").last.to_i}.collect{|key|
|
440
442
|
v = repo[key]
|
441
443
|
Annotated.load_tsv_values(key, v, "literal", "annotation_types", "JSON")
|
442
444
|
}
|
443
445
|
end
|
444
446
|
when (keys.any? and keys.first =~ /ANNOTATED_DOUBLE_ARRAY/)
|
445
|
-
repo.
|
447
|
+
repo.with_read do
|
446
448
|
|
447
449
|
res = keys.sort_by{|k| k.split(":").last.to_i}.collect{|key|
|
448
450
|
v = repo[key]
|
@@ -457,7 +459,7 @@ module Persist
|
|
457
459
|
else
|
458
460
|
entities = yield
|
459
461
|
|
460
|
-
repo.
|
462
|
+
repo.write_and_read do
|
461
463
|
case
|
462
464
|
when entities.nil?
|
463
465
|
repo[subkey + "NIL"] = nil
|
data/lib/rbbt/resource/path.rb
CHANGED
data/lib/rbbt/tsv/util.rb
CHANGED
@@ -297,6 +297,8 @@ module TSV
|
|
297
297
|
when :double
|
298
298
|
if field.nil?
|
299
299
|
through do |k,v| new[k] = v.first end
|
300
|
+
elsif field == :all
|
301
|
+
through do |k,v| new[k] = v.flatten.compact end
|
300
302
|
else
|
301
303
|
pos = identify_field field
|
302
304
|
through do |k,v| new[k] = v[pos] end
|
@@ -313,7 +315,16 @@ module TSV
|
|
313
315
|
end
|
314
316
|
end
|
315
317
|
self.annotate(new)
|
316
|
-
|
318
|
+
if new.fields
|
319
|
+
case field
|
320
|
+
when nil
|
321
|
+
new.fields = new.fields[0..0]
|
322
|
+
when :all
|
323
|
+
new.fields = [new.fields * "+"]
|
324
|
+
else
|
325
|
+
new.fields = [field]
|
326
|
+
end
|
327
|
+
end
|
317
328
|
new.type = :flat
|
318
329
|
new
|
319
330
|
end
|
@@ -205,7 +205,8 @@ class RbbtProcessQueue
|
|
205
205
|
end
|
206
206
|
|
207
207
|
@queue.close_read
|
208
|
-
Log.info "Cpu process
|
208
|
+
Log.info "Cpu process #{@master_pid} with #{num_processes} workers."
|
209
|
+
Log.low "Signal #{@master_pid} USR1/USR2 (#10/#12) to increase/decrease workers."
|
209
210
|
end
|
210
211
|
|
211
212
|
def init(&block)
|
@@ -44,7 +44,7 @@ class Step
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def self.files_dir(path)
|
47
|
-
path.nil? ? nil : path + '.files'
|
47
|
+
path.nil? ? nil : Path.setup(path + '.files')
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.info_file(path)
|
@@ -154,8 +154,12 @@ class Step
|
|
154
154
|
value = Annotated.purge value if defined? Annotated
|
155
155
|
Open.lock(info_file, :lock => info_lock) do
|
156
156
|
i = info(false).dup
|
157
|
+
value = Annotated.purge(value)
|
158
|
+
|
157
159
|
i[key] = value
|
160
|
+
|
158
161
|
dump = Step.serialize_info(i)
|
162
|
+
|
159
163
|
@info_cache = IndiferentHash.setup(i)
|
160
164
|
Misc.sensiblewrite(info_file, dump, :force => true, :lock => false) if Open.exists?(info_file)
|
161
165
|
@info_cache_time = Time.now
|
@@ -26,7 +26,11 @@ module Workflow
|
|
26
26
|
|
27
27
|
type = :path if file.split(".").last == 'as_path'
|
28
28
|
|
29
|
+
type = :nofile if file.split(".").last == 'nofile'
|
30
|
+
|
29
31
|
case type
|
32
|
+
when :nofile
|
33
|
+
inputs[input.to_sym] = Open.realpath(file)
|
30
34
|
when :path
|
31
35
|
inputs[input.to_sym] = Open.realpath(Open.read(file).strip)
|
32
36
|
when :io
|
@@ -65,7 +65,10 @@ module Workflow
|
|
65
65
|
|
66
66
|
IndiferentHash.setup(resources)
|
67
67
|
|
68
|
-
default_resources = rules["default_resources"]
|
68
|
+
default_resources = rules["default_resources"]
|
69
|
+
default_resources ||= rules["defaults"]["resources"] if rules["defaults"]
|
70
|
+
default_resources ||= {}
|
71
|
+
|
69
72
|
default_resources.each{|k,v| resources[k] ||= v } if default_resources
|
70
73
|
|
71
74
|
resources
|
@@ -98,6 +101,10 @@ module Workflow
|
|
98
101
|
candidates
|
99
102
|
end
|
100
103
|
|
104
|
+
def self.process(*args)
|
105
|
+
self.new.process(*args)
|
106
|
+
end
|
107
|
+
|
101
108
|
attr_accessor :available_resources, :resources_requested, :resources_used, :timer
|
102
109
|
|
103
110
|
def initialize(timer = 5, available_resources = {})
|
@@ -176,7 +183,9 @@ module Workflow
|
|
176
183
|
end
|
177
184
|
end
|
178
185
|
|
179
|
-
def process(rules, jobs)
|
186
|
+
def process(rules, jobs = nil)
|
187
|
+
jobs, rules = rules, {} if jobs.nil?
|
188
|
+
jobs = [jobs] if Step === jobs
|
180
189
|
begin
|
181
190
|
|
182
191
|
workload = Orchestrator.workload(jobs)
|
@@ -191,6 +191,7 @@ The `recursive_clean` cleans all the job dependency steps recursively.
|
|
191
191
|
-rcl--recursive_clean Clean the last step and its dependencies to recompute the job completely
|
192
192
|
-uaj--update_all_jobs Consider all dependencies when checking for updates, even when they have no info files
|
193
193
|
--fork Run job asyncronously and monitor progress. It monitors detached processes as well
|
194
|
+
--orchestrate Run the job through the orchestrator
|
194
195
|
--detach Run job asyncronously and detach process
|
195
196
|
--exec Run job with no persistence
|
196
197
|
-O--output* Save job result into file
|
@@ -438,6 +439,9 @@ begin
|
|
438
439
|
end
|
439
440
|
|
440
441
|
job.fork
|
442
|
+
elsif options[:orchestrate]
|
443
|
+
require 'rbbt/workflow/util/orchestrator'
|
444
|
+
Workflow::Orchestrator.process job
|
441
445
|
else
|
442
446
|
job.run(:stream)
|
443
447
|
res = job
|
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.
|
4
|
+
version: 5.33.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|