rbbt-util 5.21.126 → 5.21.127
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/monitor.rb +1 -1
- data/lib/rbbt/workflow.rb +1 -0
- data/lib/rbbt/workflow/accessor.rb +4 -2
- data/lib/rbbt/workflow/archive.rb +49 -0
- data/lib/rbbt/workflow/examples.rb +1 -2
- data/share/rbbt_commands/system/status +5 -3
- data/share/rbbt_commands/workflow/archive +31 -0
- data/share/rbbt_commands/workflow/info +12 -6
- data/share/rbbt_commands/workflow/prov +13 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b39b4950994d49ab0541d19a8e7d3ac45245c1e
|
4
|
+
data.tar.gz: 28ac4746e480b19a5c9005671f15a29a97586f46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1722d689b494dedf1095a53f288b063dd12c2aa1ce01a05c3e92b17172266facd7445879d10e75d7aac65ebe22c502d37398e9345e19ffaf7297d680400b84df
|
7
|
+
data.tar.gz: 57e25447236ba7c6e5f28be95c687513c1259f742ddbdbe0d7957b695b9c17177e3c0105c821638871afec07e2249a3a9b2ff6c5015c9288ff0c018664fc4765
|
data/lib/rbbt/monitor.rb
CHANGED
@@ -146,7 +146,7 @@ module Rbbt
|
|
146
146
|
task = File.basename(taskdir)
|
147
147
|
next if tasks and not tasks.include? task
|
148
148
|
|
149
|
-
cmd = "find -L '#{ taskdir }/' -not -
|
149
|
+
cmd = "find -L '#{ taskdir }/' -not \\( -path \"#{taskdir}/*.files\" -prune \\) -not -path '*/*.pid' -not -type d 2>/dev/null"
|
150
150
|
files = CMD.cmd(cmd, :pipe => true)
|
151
151
|
TSV.traverse files, :type => :array, :into => jobs, :_bar => "Finding jobs in #{ taskdir }" do |file|
|
152
152
|
_files << file
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -813,8 +813,10 @@ module Workflow
|
|
813
813
|
next if d.nil?
|
814
814
|
if Hash === d
|
815
815
|
d[:workflow] ||= wf
|
816
|
-
d[:task]
|
817
|
-
|
816
|
+
d[:task] ||= task_name
|
817
|
+
task_info = d[:workflow].task_info(d[:task])
|
818
|
+
|
819
|
+
inputs = assign_dep_inputs({}, options.merge(d[:inputs] || {}), real_dependencies, task_info)
|
818
820
|
d = d[:workflow].job(d[:task], d[:jobname], inputs)
|
819
821
|
end
|
820
822
|
ComputeDependency.setup(d, compute) if compute
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class Step
|
2
|
+
def self.link_job(path, target_dir, task = nil, workflow = nil)
|
3
|
+
Path.setup(target_dir)
|
4
|
+
|
5
|
+
name = File.basename(path)
|
6
|
+
task = File.basename(File.dirname(path)) if task.nil?
|
7
|
+
workflow = File.basename(File.dirname(File.dirname(path))) if workflow.nil?
|
8
|
+
|
9
|
+
FileUtils.mkdir_p target_dir[workflow][task]
|
10
|
+
FileUtils.ln_s path, target_dir[workflow][task][name].find
|
11
|
+
FileUtils.ln_s path + '.files', target_dir[workflow][task][name].find + '.files' if File.exists?(path + '.files')
|
12
|
+
FileUtils.ln_s path + '.info', target_dir[workflow][task][name].find + '.info' if File.exists?(path + '.info')
|
13
|
+
end
|
14
|
+
|
15
|
+
def archive(target = nil)
|
16
|
+
target = self.path + '.tar.gz' if target.nil?
|
17
|
+
target = File.expand_path(target)
|
18
|
+
TmpFile.with_file do |tmpdir|
|
19
|
+
Step.link_job self.path, tmpdir
|
20
|
+
rec_dependencies = Set.new
|
21
|
+
deps = [self.path]
|
22
|
+
seen = Set.new
|
23
|
+
while deps.any?
|
24
|
+
path = deps.shift
|
25
|
+
dep = Step.new path
|
26
|
+
seen << dep.path
|
27
|
+
dep.info[:dependencies].each do |task, name, path|
|
28
|
+
dep = Step.new path
|
29
|
+
next if seen.include? dep.path
|
30
|
+
deps << dep.path
|
31
|
+
rec_dependencies << dep.path
|
32
|
+
end if dep.info[:dependencies]
|
33
|
+
end
|
34
|
+
|
35
|
+
rec_dependencies.each do |path|
|
36
|
+
Step.link_job path, tmpdir
|
37
|
+
end
|
38
|
+
|
39
|
+
Misc.in_dir(tmpdir) do
|
40
|
+
io = CMD.cmd("tar cvhzf '#{target}' ./*", :pipe => true)
|
41
|
+
while line = io.gets
|
42
|
+
Log.debug line
|
43
|
+
end
|
44
|
+
io.join if io.respond_to? :join
|
45
|
+
end
|
46
|
+
Log.debug "Archive finished at: #{target}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -51,9 +51,8 @@ module Workflow
|
|
51
51
|
|
52
52
|
def example_inputs(task_name, example)
|
53
53
|
inputs = {}
|
54
|
-
IndiferentHash.setup(
|
54
|
+
IndiferentHash.setup(inputs)
|
55
55
|
example(task_name, example).each do |input,type,file|
|
56
|
-
next if new_inputs.include? input
|
57
56
|
|
58
57
|
case type
|
59
58
|
when :tsv, :array, :text
|
@@ -50,14 +50,16 @@ def status_msg(status)
|
|
50
50
|
when :error, :aborted, :missing, :dead
|
51
51
|
:red
|
52
52
|
when :streaming, :started
|
53
|
-
:
|
53
|
+
:cyan
|
54
54
|
when :done
|
55
55
|
:green
|
56
|
+
when :dependencies, :waiting, :setyp
|
57
|
+
:yellow
|
56
58
|
else
|
57
59
|
if status.to_s.index ">"
|
58
|
-
:
|
60
|
+
:cyan
|
59
61
|
else
|
60
|
-
|
62
|
+
:cyan
|
61
63
|
end
|
62
64
|
end
|
63
65
|
Log.color(color, status.to_s)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbbt/workflow'
|
4
|
+
|
5
|
+
require 'rbbt-util'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'rbbt/util/simpleopt'
|
8
|
+
require 'rbbt/workflow/step'
|
9
|
+
require 'rbbt/util/misc'
|
10
|
+
|
11
|
+
require 'rbbt-util'
|
12
|
+
require 'rbbt/util/simpleopt'
|
13
|
+
|
14
|
+
$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
|
15
|
+
|
16
|
+
options = SOPT.setup <<EOF
|
17
|
+
Examine the provenance of a job result
|
18
|
+
|
19
|
+
$ rbbt workflow archive <job> [target]
|
20
|
+
|
21
|
+
Archive job and all dependencies into the target tar gz file. If no target is specified
|
22
|
+
it defaults to a <job>.tar.gz
|
23
|
+
|
24
|
+
-h--help Help
|
25
|
+
EOF
|
26
|
+
|
27
|
+
SOPT.usage if options[:help]
|
28
|
+
|
29
|
+
file, target = ARGV
|
30
|
+
|
31
|
+
Step.new(File.expand_path(file)).archive(target)
|
@@ -31,17 +31,23 @@ def get_step(file)
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def status_msg(status)
|
34
|
-
color = case status
|
35
|
-
when :error, :aborted, :missing
|
34
|
+
color = case status.to_sym
|
35
|
+
when :error, :aborted, :missing, :dead
|
36
36
|
:red
|
37
|
-
when :streaming
|
38
|
-
:
|
37
|
+
when :streaming, :started
|
38
|
+
:cyan
|
39
39
|
when :done
|
40
40
|
:green
|
41
|
+
when :dependencies, :waiting, :setyp
|
42
|
+
:yellow
|
41
43
|
else
|
42
|
-
|
44
|
+
if status.to_s.index ">"
|
45
|
+
:cyan
|
46
|
+
else
|
47
|
+
:cyan
|
48
|
+
end
|
43
49
|
end
|
44
|
-
Log.color(color, status)
|
50
|
+
Log.color(color, status.to_s)
|
45
51
|
end
|
46
52
|
|
47
53
|
def pid_msg(pid, done = false)
|
@@ -34,15 +34,23 @@ def get_step(file)
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def status_msg(status)
|
37
|
-
color = case status
|
38
|
-
when :error, :aborted, :missing
|
37
|
+
color = case status.to_sym
|
38
|
+
when :error, :aborted, :missing, :dead
|
39
39
|
:red
|
40
|
-
when :streaming
|
41
|
-
:
|
40
|
+
when :streaming, :started
|
41
|
+
:cyan
|
42
42
|
when :done
|
43
43
|
:green
|
44
|
+
when :dependencies, :waiting, :setyp
|
45
|
+
:yellow
|
46
|
+
else
|
47
|
+
if status.to_s.index ">"
|
48
|
+
:cyan
|
49
|
+
else
|
50
|
+
:cyan
|
51
|
+
end
|
44
52
|
end
|
45
|
-
Log.color(color, status)
|
53
|
+
Log.color(color, status.to_s)
|
46
54
|
end
|
47
55
|
|
48
56
|
def report_msg(status, name, path)
|
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.21.
|
4
|
+
version: 5.21.127
|
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-03-
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -316,6 +316,7 @@ files:
|
|
316
316
|
- lib/rbbt/workflow.rb
|
317
317
|
- lib/rbbt/workflow/accessor.rb
|
318
318
|
- lib/rbbt/workflow/annotate.rb
|
319
|
+
- lib/rbbt/workflow/archive.rb
|
319
320
|
- lib/rbbt/workflow/definition.rb
|
320
321
|
- lib/rbbt/workflow/doc.rb
|
321
322
|
- lib/rbbt/workflow/examples.rb
|
@@ -387,6 +388,7 @@ files:
|
|
387
388
|
- share/rbbt_commands/tsv/write_excel
|
388
389
|
- share/rbbt_commands/tsv/zip
|
389
390
|
- share/rbbt_commands/watch
|
391
|
+
- share/rbbt_commands/workflow/archive
|
390
392
|
- share/rbbt_commands/workflow/cmd
|
391
393
|
- share/rbbt_commands/workflow/example
|
392
394
|
- share/rbbt_commands/workflow/info
|