rbbt-util 5.23.31 → 5.23.32
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/resource/path.rb +1 -1
- data/lib/rbbt/util/log.rb +25 -0
- data/lib/rbbt/workflow.rb +61 -18
- data/lib/rbbt/workflow/accessor.rb +4 -4
- data/lib/rbbt/workflow/step.rb +12 -5
- data/lib/rbbt/workflow/step/dependencies.rb +24 -19
- 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: b174e2fa2cbfa2a1548380710082c35a98e5d58e
|
|
4
|
+
data.tar.gz: 74066e9c626e51bd9c625ed741cff14a177a9ea2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0f5757b41d2605ff9da15ec39716ab47170675380a9f83e7ed729d50e93f29d74af3f49d6b6dd25a8376922b993216aed0d3db1802339ee793560e21dcde7ee5
|
|
7
|
+
data.tar.gz: 80e8eab073f7704254b0358381bca50f0d2694b23e9af7e550ed3b75f511702e3a1a36a23f71bb27d2e84b6373379993bdbd8dd00ef40ab34ed95ce5a1fd46d8
|
data/lib/rbbt/resource/path.rb
CHANGED
|
@@ -129,7 +129,7 @@ module Path
|
|
|
129
129
|
@path ||= {}
|
|
130
130
|
rsearch_paths = (resource and resource.respond_to?(:search_paths)) ? resource.search_paths : nil
|
|
131
131
|
key_elems = [where, caller_lib, rsearch_paths, paths]
|
|
132
|
-
key = Misc.obj2digest(key_elems)
|
|
132
|
+
key = Misc.obj2digest(key_elems.inspect)
|
|
133
133
|
self.sub!('~/', Etc.getpwuid.dir + '/') if self.include? "~"
|
|
134
134
|
|
|
135
135
|
return @path[key] if @path[key]
|
data/lib/rbbt/util/log.rb
CHANGED
|
@@ -272,6 +272,31 @@ module Log
|
|
|
272
272
|
end
|
|
273
273
|
end
|
|
274
274
|
|
|
275
|
+
def self.count_stack
|
|
276
|
+
if ! $count_stacks
|
|
277
|
+
Log.debug "Counting stacks at: " << caller.first
|
|
278
|
+
return
|
|
279
|
+
end
|
|
280
|
+
$stack_counts ||= {}
|
|
281
|
+
head = $count_stacks_head
|
|
282
|
+
stack = caller[1..head+1]
|
|
283
|
+
stack.reverse.each do |line,i|
|
|
284
|
+
$stack_counts[line] ||= 0
|
|
285
|
+
$stack_counts[line] += 1
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def self.with_stack_counts(head = 10, total = 100)
|
|
290
|
+
$count_stacks_head = head
|
|
291
|
+
$count_stacks = true
|
|
292
|
+
$stack_counts = {}
|
|
293
|
+
res = yield
|
|
294
|
+
$count_stacks = false
|
|
295
|
+
Log.debug "STACK_COUNTS:\n" + $stack_counts.sort_by{|line,c| c}.reverse.collect{|line,c| [c, line] * " - "}[0..total] * "\n"
|
|
296
|
+
$stack_counts = {}
|
|
297
|
+
res
|
|
298
|
+
end
|
|
299
|
+
|
|
275
300
|
case ENV['RBBT_LOG']
|
|
276
301
|
when 'DEBUG'
|
|
277
302
|
self.severity = DEBUG
|
data/lib/rbbt/workflow.rb
CHANGED
|
@@ -9,6 +9,7 @@ require 'rbbt/workflow/archive'
|
|
|
9
9
|
module Workflow
|
|
10
10
|
|
|
11
11
|
STEP_CACHE = {}
|
|
12
|
+
LOAD_STEP_CACHE = {}
|
|
12
13
|
|
|
13
14
|
class TaskNotFoundException < Exception
|
|
14
15
|
def initialize(workflow, task = nil)
|
|
@@ -192,6 +193,7 @@ module Workflow
|
|
|
192
193
|
attr_accessor :task_dependencies, :task_description, :last_task
|
|
193
194
|
attr_accessor :stream_exports, :asynchronous_exports, :synchronous_exports, :exec_exports
|
|
194
195
|
attr_accessor :step_cache
|
|
196
|
+
attr_accessor :load_step_cache
|
|
195
197
|
attr_accessor :remote_tasks
|
|
196
198
|
|
|
197
199
|
#{{{ ATTR DEFAULTS
|
|
@@ -230,6 +232,11 @@ module Workflow
|
|
|
230
232
|
@step_cache ||= Workflow::STEP_CACHE
|
|
231
233
|
end
|
|
232
234
|
|
|
235
|
+
def self.load_step_cache
|
|
236
|
+
@load_step_cache ||= Workflow::LOAD_STEP_CACHE
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
|
|
233
240
|
def helpers
|
|
234
241
|
@helpers ||= {}
|
|
235
242
|
end
|
|
@@ -396,7 +403,11 @@ module Workflow
|
|
|
396
403
|
Misc.insist do
|
|
397
404
|
step.dependencies = step.info[:dependencies].collect do |task, job, path|
|
|
398
405
|
next if job.nil?
|
|
399
|
-
|
|
406
|
+
if Open.exists?(path)
|
|
407
|
+
load_step(path)
|
|
408
|
+
else
|
|
409
|
+
Workflow.load_step(path)
|
|
410
|
+
end
|
|
400
411
|
end
|
|
401
412
|
end
|
|
402
413
|
end
|
|
@@ -420,21 +431,6 @@ module Workflow
|
|
|
420
431
|
step.inputs ||= input_values
|
|
421
432
|
step.dependencies = dependencies if dependencies and (step.dependencies.nil? or step.dependencies.length < dependencies.length)
|
|
422
433
|
|
|
423
|
-
|
|
424
|
-
step
|
|
425
|
-
end
|
|
426
|
-
|
|
427
|
-
def load_id(id)
|
|
428
|
-
path = if Path === workdir
|
|
429
|
-
workdir[id].find
|
|
430
|
-
else
|
|
431
|
-
File.join(workdir, id)
|
|
432
|
-
end
|
|
433
|
-
task = task_for path
|
|
434
|
-
return remote_tasks[task].load_id(id) if remote_tasks and remote_tasks.include? task
|
|
435
|
-
step = Step.new path, tasks[task.to_sym]
|
|
436
|
-
step.load_inputs_from_info
|
|
437
|
-
set_step_dependencies(step)
|
|
438
434
|
step
|
|
439
435
|
end
|
|
440
436
|
|
|
@@ -467,6 +463,21 @@ module Workflow
|
|
|
467
463
|
File.join(sr - sl + so)
|
|
468
464
|
end
|
|
469
465
|
|
|
466
|
+
def self.relocate_array(real, list)
|
|
467
|
+
preal = real.split(/\/+/)
|
|
468
|
+
prefix = preal[0..-4] * "/"
|
|
469
|
+
list.collect do |other|
|
|
470
|
+
pother = other.split(/\/+/)
|
|
471
|
+
end_part = pother[-3..-1] * "/"
|
|
472
|
+
new_path = prefix + "/" << end_part
|
|
473
|
+
if File.exists? new_path
|
|
474
|
+
new_path
|
|
475
|
+
else
|
|
476
|
+
Rbbt.var.jobs[end_part].find
|
|
477
|
+
end
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
|
|
470
481
|
def self.relocate(real, other)
|
|
471
482
|
preal = real.split(/\/+/)
|
|
472
483
|
pother = other.split(/\/+/)
|
|
@@ -476,7 +487,8 @@ module Workflow
|
|
|
476
487
|
Rbbt.var.jobs[end_part].find
|
|
477
488
|
end
|
|
478
489
|
|
|
479
|
-
|
|
490
|
+
|
|
491
|
+
def self.__load_step(path)
|
|
480
492
|
step = Step.new path
|
|
481
493
|
relocated = false
|
|
482
494
|
step.dependencies = (step.info[:dependencies] || []).collect do |task,name,dep_path|
|
|
@@ -485,14 +497,45 @@ module Workflow
|
|
|
485
497
|
else
|
|
486
498
|
new_path = relocate(path, dep_path)
|
|
487
499
|
relocated = true if Open.exists?(new_path)
|
|
488
|
-
Workflow.
|
|
500
|
+
Workflow._load_step new_path
|
|
489
501
|
end
|
|
490
502
|
end
|
|
491
503
|
step.relocated = relocated
|
|
504
|
+
step.load_inputs_from_info
|
|
492
505
|
|
|
493
506
|
step
|
|
494
507
|
end
|
|
495
508
|
|
|
509
|
+
def self._load_step(path)
|
|
510
|
+
Persist.memory("STEP", :path => path, :repo => load_step_cache) do
|
|
511
|
+
__load_step(path)
|
|
512
|
+
end
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
def self.load_step(path)
|
|
516
|
+
begin
|
|
517
|
+
_load_step(path)
|
|
518
|
+
ensure
|
|
519
|
+
load_step_cache.clear
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
def load_id(id)
|
|
524
|
+
path = if Path === workdir
|
|
525
|
+
workdir[id].find
|
|
526
|
+
else
|
|
527
|
+
File.join(workdir, id)
|
|
528
|
+
end
|
|
529
|
+
task = task_for path
|
|
530
|
+
return remote_tasks[task].load_id(id) if remote_tasks and remote_tasks.include? task
|
|
531
|
+
return Workflow.load_step path
|
|
532
|
+
#step = Step.new path, tasks[task.to_sym]
|
|
533
|
+
#step.load_inputs_from_info
|
|
534
|
+
#set_step_dependencies(step)
|
|
535
|
+
#step
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
|
|
496
539
|
def load_name(task, name)
|
|
497
540
|
return remote_tasks[task].load_step(path) if remote_tasks and remote_tasks.include? task
|
|
498
541
|
task = tasks[task.to_sym] if String === task or Symbol === task
|
|
@@ -652,8 +652,9 @@ module Workflow
|
|
|
652
652
|
name = name.to_sym
|
|
653
653
|
task = tasks[name]
|
|
654
654
|
raise "No '#{name}' task in '#{self.to_s}' Workflow" if task.nil?
|
|
655
|
-
|
|
656
|
-
|
|
655
|
+
id = File.join(self.to_s, name.to_s)
|
|
656
|
+
@task_info ||= {}
|
|
657
|
+
@task_info[id] ||= begin description = task.description
|
|
657
658
|
result_description = task.result_description
|
|
658
659
|
result_type = task.result_type
|
|
659
660
|
inputs = rec_inputs(name).uniq
|
|
@@ -675,9 +676,8 @@ module Workflow
|
|
|
675
676
|
:none
|
|
676
677
|
end
|
|
677
678
|
|
|
678
|
-
|
|
679
679
|
dependencies = task_dependencies[name].select{|dep| String === dep or Symbol === dep}
|
|
680
|
-
{ :id =>
|
|
680
|
+
info = { :id => id,
|
|
681
681
|
:description => description,
|
|
682
682
|
:export => export,
|
|
683
683
|
:inputs => inputs,
|
data/lib/rbbt/workflow/step.rb
CHANGED
|
@@ -98,13 +98,20 @@ class Step
|
|
|
98
98
|
else
|
|
99
99
|
i = {}
|
|
100
100
|
end
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
i[
|
|
101
|
+
rec_dependencies.each do |dep|
|
|
102
|
+
next unless NamedArray === dep.inputs
|
|
103
|
+
dep.inputs.zip(dep.inputs.fields).each do |v,f|
|
|
104
|
+
next if i.include?(f)
|
|
105
|
+
i[f] = v
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
|
+
#dependencies.each do |dep|
|
|
109
|
+
# di = dep.recursive_inputs
|
|
110
|
+
# next unless NamedArray === di
|
|
111
|
+
# di.fields.zip(di).each do |k,v|
|
|
112
|
+
# i[k] = v unless i.include? k
|
|
113
|
+
# end
|
|
114
|
+
#end
|
|
108
115
|
v = i.values
|
|
109
116
|
NamedArray.setup v, i.keys
|
|
110
117
|
v
|
|
@@ -302,25 +302,30 @@ class Step
|
|
|
302
302
|
def canfail_paths
|
|
303
303
|
return Set.new if done? && ! Open.exists?(info_file)
|
|
304
304
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
305
|
+
@canfail_paths ||= begin
|
|
306
|
+
if info[:canfail]
|
|
307
|
+
paths = info[:canfail].uniq
|
|
308
|
+
paths = Workflow.relocate_array self.path, paths if relocated
|
|
309
|
+
Set.new(paths)
|
|
310
|
+
else
|
|
311
|
+
canfail_paths = Set.new
|
|
312
|
+
all_deps = dependencies
|
|
313
|
+
all_deps.each do |dep|
|
|
314
|
+
next if canfail_paths.include? dep.path
|
|
315
|
+
canfail_paths += dep.canfail_paths
|
|
316
|
+
next unless ComputeDependency === dep && dep.canfail?
|
|
317
|
+
canfail_paths << dep.path
|
|
318
|
+
iii dep.path
|
|
319
|
+
canfail_paths += dep.rec_dependencies.collect{|d| d.path }
|
|
320
|
+
end
|
|
321
|
+
canfail_paths
|
|
322
|
+
begin
|
|
323
|
+
set_info :canfail, canfail_paths.to_a
|
|
324
|
+
rescue Errno::EROFS
|
|
325
|
+
end
|
|
326
|
+
canfail_paths
|
|
327
|
+
end
|
|
328
|
+
end
|
|
324
329
|
end
|
|
325
330
|
|
|
326
331
|
def run_dependencies
|
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.23.
|
|
4
|
+
version: 5.23.32
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miguel Vazquez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-11-
|
|
11
|
+
date: 2018-11-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|