rbbt-util 5.23.4 → 5.23.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/workflow.rb +21 -1
- data/lib/rbbt/workflow/accessor.rb +1 -2
- data/share/rbbt_commands/workflow/prov +3 -3
- data/test/rbbt/test_workflow.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb980bbf88e61f1087f0fd28c27cb3057bd891c
|
4
|
+
data.tar.gz: ac0c6c3e802ebdf902301b8289b866252eaa1f35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6742777bd0aefb41ede80c70d76b1dab223fb443e12a7e492e99a02472e8dcafd9e37c012bda15c260ccd77b6b7c19990b28d2afd9edb4acf23d68bcf9b9197c
|
7
|
+
data.tar.gz: 7463782b74d10ec37222a8f9771a8cdf8a094987c96b803a8e8e122365da7bcd17f5cd3d0cca5bccc545b448eb83fa234f4172a5bf3e6fe63d560ec11bdfc0be
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -423,11 +423,31 @@ module Workflow
|
|
423
423
|
end
|
424
424
|
end
|
425
425
|
|
426
|
+
def self.relocate(listed, real, other)
|
427
|
+
sl = listed.split("/", -1)
|
428
|
+
so = other.split("/", -1)
|
429
|
+
sr = real.split("/", -1)
|
430
|
+
prefix = []
|
431
|
+
while true
|
432
|
+
break if sl[0] != so[0]
|
433
|
+
cl = sl.shift
|
434
|
+
co = so.shift
|
435
|
+
prefix << cl
|
436
|
+
end
|
437
|
+
File.join(sr - sl + so)
|
438
|
+
end
|
439
|
+
|
426
440
|
def self.load_step(path)
|
427
441
|
step = Step.new path
|
428
442
|
step.dependencies = (step.info[:dependencies] || []).collect do |task,name,dep_path|
|
429
|
-
|
443
|
+
if File.exists?(dep_path)
|
444
|
+
Workflow.load_step dep_path
|
445
|
+
else
|
446
|
+
new_path = relocate(step.info[:path], path, dep_path)
|
447
|
+
Workflow.load_step new_path
|
448
|
+
end
|
430
449
|
end
|
450
|
+
|
431
451
|
step
|
432
452
|
end
|
433
453
|
|
@@ -153,7 +153,7 @@ class Step
|
|
153
153
|
def init_info
|
154
154
|
return nil if @exec or info_file.nil? or Open.exists?(info_file)
|
155
155
|
Open.lock(info_file, :lock => info_lock) do
|
156
|
-
i = {:status => :waiting, :pid => Process.pid}
|
156
|
+
i = {:status => :waiting, :pid => Process.pid, :path => path}
|
157
157
|
i[:dependencies] = dependencies.collect{|dep| [dep.task_name, dep.name, dep.path]} if dependencies
|
158
158
|
@info_cache = i
|
159
159
|
Misc.sensiblewrite(info_file, INFO_SERIALIAZER.dump(i), :force => true, :lock => false)
|
@@ -169,7 +169,6 @@ class Step
|
|
169
169
|
i[key] = value
|
170
170
|
@info_cache = i
|
171
171
|
Misc.sensiblewrite(info_file, INFO_SERIALIAZER.dump(i), :force => true, :lock => false)
|
172
|
-
#Misc.insist(([0.01,0.1,1] * 3).sort) do
|
173
172
|
Misc.insist do
|
174
173
|
Open.open(info_file) do |file|
|
175
174
|
INFO_SERIALIAZER.load(file)
|
@@ -111,15 +111,15 @@ def report(step, offset = 0, task = nil)
|
|
111
111
|
status = :unsync if status == :done and not File.exist? path
|
112
112
|
str = " " * offset
|
113
113
|
str << report_msg(status, name, path, info)
|
114
|
-
|
114
|
+
step.dependencies.each do |dep|
|
115
|
+
path = dep.path
|
115
116
|
new = ! $seen.include?(path)
|
116
|
-
dep = get_step path
|
117
117
|
if new
|
118
118
|
str << report(dep, offset + 1, task)
|
119
119
|
else
|
120
120
|
str << Log.color(:blue, Log.uncolor(report(dep, offset+1, task)))
|
121
121
|
end
|
122
|
-
end if
|
122
|
+
end if step.dependencies
|
123
123
|
str
|
124
124
|
end
|
125
125
|
|
data/test/rbbt/test_workflow.rb
CHANGED
@@ -271,4 +271,13 @@ class TestWorkflow < Test::Unit::TestCase
|
|
271
271
|
assert_equal "CB", TestWF.job(:t3).run
|
272
272
|
end
|
273
273
|
|
274
|
+
def test_relocate
|
275
|
+
listed = '/home/user/.rbbt/var/jobs/TestWF/task1/Default'
|
276
|
+
real = '/usr/local/var/rbbt/jobs/TestWF/task1/Default'
|
277
|
+
other = '/home/user/.rbbt/var/jobs/TestWF/task2/Default'
|
278
|
+
real_other = '/usr/local/var/rbbt/jobs/TestWF/task2/Default'
|
279
|
+
|
280
|
+
assert_equal real_other, Workflow.relocate(listed, real, other)
|
281
|
+
end
|
282
|
+
|
274
283
|
end
|