rbbt-util 5.26.15 → 5.26.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/workflow.rb +11 -1
- data/lib/rbbt/workflow/definition.rb +5 -3
- data/lib/rbbt/workflow/step.rb +43 -0
- data/share/rbbt_commands/workflow/info +1 -1
- 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: 0a5b6df0bdc2e42626606a7acb81daea7045d4b9084e55397e26bd43cf649bed
|
4
|
+
data.tar.gz: 0a02c5606b3ad0db3f49bb08253b3319086275f8c628c2058cfb947dad8589cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbffbfb520c2ae55920a7bacbcb06fd9b329ccd4be1707b524661b39e0bf402d739687f010f85adc31dd2efdbbeb92108e05fc8fe69abcc1026719d7046359af
|
7
|
+
data.tar.gz: 5e9581b07924542606bc900acf1f808990f7527bb4082a054ac0fb3e2a42042f15ee14a2004a97734c9f9e379990b0c552972dc7b75393a60a3a7f56ec21fef2
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -214,7 +214,17 @@ module Workflow
|
|
214
214
|
end
|
215
215
|
|
216
216
|
def import_task(workflow, orig, new)
|
217
|
-
|
217
|
+
orig_task = workflow.tasks[orig]
|
218
|
+
new_task = orig_task.dup
|
219
|
+
options = {}
|
220
|
+
orig_task.singleton_methods.
|
221
|
+
select{|method| method.to_s[-1] != "="[0]}.each{|method|
|
222
|
+
if orig_task.respond_to?(method.to_s + "=")
|
223
|
+
options[method.to_s] = orig_task.send(method.to_s)
|
224
|
+
end
|
225
|
+
}
|
226
|
+
|
227
|
+
Task.setup(options, &new_task)
|
218
228
|
new_task.workflow = self
|
219
229
|
new_task.name = new
|
220
230
|
tasks[new] = new_task
|
@@ -64,16 +64,18 @@ module Workflow
|
|
64
64
|
end
|
65
65
|
|
66
66
|
FORGET_DEP_TASKS = ENV["RBBT_FORGET_DEP_TASKS"] == "true"
|
67
|
-
def dep_task(name, *
|
68
|
-
dep(*
|
67
|
+
def dep_task(name, workflow, oname, *rest, &block)
|
68
|
+
dep(workflow, oname, *rest, &block)
|
69
|
+
extension workflow.tasks[oname].extension if workflow.tasks.include?(oname) unless @extension
|
69
70
|
task name do
|
70
71
|
raise RbbtException, "dependency not found in dep_task" if dependencies.empty?
|
71
72
|
dep = dependencies.last.join
|
72
73
|
set_info :result_type, dep.info[:result_type]
|
73
74
|
forget = config :forget_dep_tasks, :forget_dep_tasks, :default => FORGET_DEP_TASKS
|
74
75
|
if forget
|
76
|
+
self.set_info :archived_info, archived_info
|
77
|
+
self.set_info :archived_dependencies, info[:dependencies]
|
75
78
|
self.dependencies = self.dependencies - [dep]
|
76
|
-
self.set_info :dependency, dependencies.collect{|dep| [dep.task_name, dep.name, dep.path]}
|
77
79
|
Open.rm_rf self.files_dir if Open.exist? self.files_dir
|
78
80
|
FileUtils.cp_r dep.files_dir, self.files_dir if Open.exist? dep.files_dir
|
79
81
|
Open.ln_h dep.path, self.tmp_path
|
data/lib/rbbt/workflow/step.rb
CHANGED
@@ -67,6 +67,7 @@ class Step
|
|
67
67
|
@workflow || info[:workflow]
|
68
68
|
end
|
69
69
|
|
70
|
+
|
70
71
|
def load_inputs_from_info
|
71
72
|
if info[:inputs]
|
72
73
|
info_inputs = info[:inputs]
|
@@ -92,6 +93,37 @@ class Step
|
|
92
93
|
@inputs || []
|
93
94
|
end
|
94
95
|
|
96
|
+
def archived_info
|
97
|
+
return info[:archived_info] if info[:archived_info]
|
98
|
+
|
99
|
+
archived_info = {}
|
100
|
+
dependencies.each do |dep|
|
101
|
+
archived_info[dep.path] = dep.info
|
102
|
+
archived_info.merge!(dep.archived_info)
|
103
|
+
end if dependencies
|
104
|
+
|
105
|
+
archived_info
|
106
|
+
end
|
107
|
+
|
108
|
+
def archived_inputs
|
109
|
+
return {} unless info[:archived_dependencies]
|
110
|
+
archived_info = self.archived_info
|
111
|
+
|
112
|
+
all_inputs = IndiferentHash.setup({})
|
113
|
+
deps = info[:archived_dependencies].collect{|p| p.last}
|
114
|
+
seen = []
|
115
|
+
while path = deps.pop
|
116
|
+
dep_info = archived_info[path]
|
117
|
+
dep_info[:inputs].each do |k,v|
|
118
|
+
all_inputs[k] = v unless all_inputs.include?(k)
|
119
|
+
end
|
120
|
+
deps.concat(dep_info[:dependencies].collect{|p| p.last } - seen)
|
121
|
+
seen << path
|
122
|
+
end
|
123
|
+
|
124
|
+
all_inputs
|
125
|
+
end
|
126
|
+
|
95
127
|
def recursive_inputs
|
96
128
|
if NamedArray === inputs
|
97
129
|
i = {}
|
@@ -103,6 +135,7 @@ class Step
|
|
103
135
|
end
|
104
136
|
rec_dependencies.each do |dep|
|
105
137
|
next unless NamedArray === dep.inputs
|
138
|
+
|
106
139
|
dep.inputs.zip(dep.inputs.fields).each do |v,f|
|
107
140
|
if i.include?(f) && i[f] != v
|
108
141
|
Log.debug "Conflict in #{ f }: #{[i[f].inspect, v.inspect] * " <-> "}"
|
@@ -111,7 +144,16 @@ class Step
|
|
111
144
|
i[f] = v
|
112
145
|
end
|
113
146
|
end
|
147
|
+
|
148
|
+
dep.archived_inputs.each do |k,v|
|
149
|
+
i[k] = v unless i.include? k
|
150
|
+
end
|
114
151
|
end
|
152
|
+
|
153
|
+
self.archived_inputs.each do |k,v|
|
154
|
+
i[k] = v unless i.include? k
|
155
|
+
end
|
156
|
+
|
115
157
|
#dependencies.each do |dep|
|
116
158
|
# di = dep.recursive_inputs
|
117
159
|
# next unless NamedArray === di
|
@@ -119,6 +161,7 @@ class Step
|
|
119
161
|
# i[k] = v unless i.include? k
|
120
162
|
# end
|
121
163
|
#end
|
164
|
+
|
122
165
|
v = i.values
|
123
166
|
NamedArray.setup v, i.keys
|
124
167
|
v
|
@@ -84,7 +84,7 @@ messages = info[:messages]
|
|
84
84
|
backtrace = info[:backtrace]
|
85
85
|
pid = info[:pid]
|
86
86
|
exception = info[:exception]
|
87
|
-
rest = info.keys - [:inputs, :dependencies, :status, :time_elapsed, :messages, :backtrace, :exception, :pid]
|
87
|
+
rest = info.keys - [:inputs, :dependencies, :status, :time_elapsed, :messages, :backtrace, :exception, :pid, :archived_info]
|
88
88
|
|
89
89
|
puts Log.color(:magenta, "File") << ": " << step.path
|
90
90
|
puts Log.color(:magenta, "Status") << ": " << status_msg(status) << ((step.aborted? || step.error?) && step.recoverable_error? ? " (recoverable)" : "" ) << (step.dirty? ? " (dirty)" : "")
|
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.26.
|
4
|
+
version: 5.26.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05
|
11
|
+
date: 2019-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|