rbbt-util 5.13.5 → 5.13.6
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.rb +1 -1
- data/lib/rbbt/util/log/progress.rb +26 -220
- data/lib/rbbt/util/log/progress/report.rb +108 -0
- data/lib/rbbt/util/log/progress/util.rb +53 -0
- data/lib/rbbt/workflow/accessor.rb +14 -0
- data/lib/rbbt/workflow/step/run.rb +8 -8
- data/share/rbbt_commands/alias +6 -2
- data/share/rbbt_commands/workflow/prov +65 -0
- data/share/rbbt_commands/workflow/provenance +16 -6
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cb8cbb3f115088d3b7a4fbe8fb9aa75cf4f4805
|
4
|
+
data.tar.gz: f61c90e38a18f4227f434260c83b6cf2ea48542a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25ac9c560885c7fb66acee8f693a6276f85f74fcaef12bfcc57c3ec59c3562bd3a1a8e25706dce34374c84f7186acaf9c2e901471e0c6002352182a5ecd7534b
|
7
|
+
data.tar.gz: b83ebb5dcdd346679f8a3299fa72ef9dd414590bf5775bcf574639b30be77844dea1bda0a7d6e4b74865992567fae452ed6943fdaaa8be76b503d96d80b37ef9
|
data/lib/rbbt/persist.rb
CHANGED
@@ -396,7 +396,7 @@ module Persist
|
|
396
396
|
|
397
397
|
return (persist_options[:repo] || Persist::MEMORY)[persist_options[:file]] ||= yield if type ==:memory and persist_options[:file] and persist_options[:persist] and persist_options[:persist] != :update
|
398
398
|
|
399
|
-
if FalseClass
|
399
|
+
if FalseClass === persist_options[:persist]
|
400
400
|
yield
|
401
401
|
else
|
402
402
|
other_options = Misc.process_options persist_options, :other
|
@@ -1,243 +1,49 @@
|
|
1
1
|
require 'rbbt/util/log'
|
2
|
+
require 'rbbt/util/log/progress/util'
|
3
|
+
require 'rbbt/util/log/progress/report'
|
2
4
|
module Log
|
3
5
|
class ProgressBar
|
4
6
|
|
5
|
-
attr_accessor :
|
6
|
-
|
7
|
-
# Creates a new instance. Max is the total number of iterations of the
|
8
|
-
# loop. The depth represents how many other loops are above this one,
|
9
|
-
# this information is used to find the place to print the progress
|
10
|
-
# report.
|
11
|
-
def initialize(max, options = {})
|
7
|
+
attr_accessor :max, :ticks, :frequency, :depth, :desc
|
8
|
+
def initialize(max = nil, options = {})
|
12
9
|
options = Misc.add_defaults options, :depth => 0, :num_reports => 100, :desc => "Progress", :io => STDERR, :severity => Log.severity
|
13
10
|
depth, num_reports, desc, io, severity = Misc.process_options options, :depth, :num_reports, :desc, :io, :severity
|
14
11
|
|
15
12
|
@max = max
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@severity = severity
|
13
|
+
@ticks = 0
|
14
|
+
@frequency = 2
|
15
|
+
@last_time = nil
|
16
|
+
@last_count = nil
|
17
|
+
@last_percent = nil
|
22
18
|
@depth = depth
|
23
19
|
@desc = desc
|
24
20
|
end
|
25
21
|
|
26
|
-
# Used to register a new completed loop iteration.
|
27
|
-
def tick(step = nil)
|
28
|
-
return if ENV["RBBT_NO_PROGRESS"] == 'true'
|
29
|
-
|
30
|
-
if step.nil?
|
31
|
-
@current += 1
|
32
|
-
else
|
33
|
-
@current = step
|
34
|
-
end
|
35
|
-
|
36
|
-
if @max
|
37
|
-
if percent - @last_report > 1.to_f/@num_reports.to_f
|
38
|
-
report
|
39
|
-
@last_report=percent
|
40
|
-
end
|
41
|
-
else
|
42
|
-
if @last_report == -1 or Time.now - @last_report >= 1.0
|
43
|
-
throughput
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
nil
|
48
|
-
end
|
49
|
-
|
50
|
-
def progress
|
51
|
-
@current.to_f/ @max
|
52
|
-
end
|
53
|
-
|
54
22
|
def percent
|
55
|
-
(
|
56
|
-
end
|
57
|
-
|
58
|
-
def eta
|
59
|
-
(Time.now - @time)/progress * (1-progress)
|
60
|
-
end
|
61
|
-
|
62
|
-
def used
|
63
|
-
(Time.now - @time).to_i
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
def up_lines(depth)
|
68
|
-
"\033[#{depth + 1}F\033[2K"
|
69
|
-
end
|
70
|
-
|
71
|
-
def down_lines(depth)
|
72
|
-
"\n\033[#{depth + 2}E"
|
73
|
-
end
|
74
|
-
|
75
|
-
def report_msg
|
76
|
-
progress = self.progress
|
77
|
-
percent = self.percent
|
78
|
-
|
79
|
-
indicator = Log.color(:magenta, @desc) << " "
|
80
|
-
10.times{|i|
|
81
|
-
if i < progress * 10 then
|
82
|
-
indicator << Log.color(:yellow, ".")
|
83
|
-
else
|
84
|
-
indicator << " "
|
85
|
-
end
|
86
|
-
}
|
87
|
-
done = progress == 1
|
88
|
-
|
89
|
-
used = self.used
|
90
|
-
used = [used/3600, used/60 % 60, used % 60].map{|t| "%02i" % t }.join(':')
|
91
|
-
|
92
|
-
if progress == 1
|
93
|
-
indicator << Log.color(:green, " done")
|
94
|
-
indicator << Log.color(:blue, " #{used}")
|
95
|
-
else
|
96
|
-
indicator << " #{Log.color(:blue, percent.to_s << "%")}"
|
97
|
-
|
98
|
-
eta = self.eta
|
99
|
-
eta = [eta/3600, eta/60 % 60, eta % 60].map{|t| "%02i" % t }.join(':')
|
100
|
-
|
101
|
-
indicator << " #{Log.color :yellow, used} used #{Log.color :yellow, eta} left"
|
102
|
-
end
|
103
|
-
|
23
|
+
(@ticks * 100) / @max
|
104
24
|
end
|
105
25
|
|
106
|
-
def
|
107
|
-
|
108
|
-
@last_report = Time.now
|
109
|
-
return thr
|
110
|
-
end
|
111
|
-
time = Time.now - @last_report
|
112
|
-
time = 0.000001 if time == 0
|
113
|
-
thr = (@current / time).to_i
|
26
|
+
def tick
|
27
|
+
@ticks += 1
|
114
28
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
@
|
119
|
-
@
|
29
|
+
time = Time.now
|
30
|
+
if @last_time.nil?
|
31
|
+
@last_time = time
|
32
|
+
@last_count = @ticks
|
33
|
+
@start = time
|
34
|
+
return
|
120
35
|
end
|
121
36
|
|
122
|
-
|
123
|
-
|
37
|
+
diff = time - @last_time
|
38
|
+
report and return if diff > @frequency
|
39
|
+
return unless max
|
124
40
|
|
125
|
-
|
126
|
-
@
|
127
|
-
|
128
|
-
|
129
|
-
@mean_max = mean if mean > @mean_max
|
130
|
-
end
|
131
|
-
mean
|
132
|
-
end
|
133
|
-
|
134
|
-
def throughput_msg
|
135
|
-
thr = self.thr
|
136
|
-
|
137
|
-
mean = self.mean
|
138
|
-
|
139
|
-
indicator = Log.color(:magenta, @desc)
|
140
|
-
indicator << " #{ Log.color :blue, thr } per second"
|
141
|
-
|
142
|
-
indicator << " #{ Log.color :yellow, mean.to_i } avg. #{ Log.color :yellow, @mean_max.to_i} max." if mean
|
143
|
-
|
144
|
-
indicator
|
145
|
-
end
|
146
|
-
|
147
|
-
def msg
|
148
|
-
@max ? report_msg : throughput_msg
|
149
|
-
end
|
150
|
-
|
151
|
-
def print(io, str)
|
152
|
-
LOG_MUTEX.synchronize do
|
153
|
-
STDERR.print str
|
154
|
-
Log.logfile.puts str unless Log.logfile.nil?
|
155
|
-
Log::LAST.replace "progress"
|
156
|
-
end
|
157
|
-
end
|
158
|
-
# Prints de progress report. It backs up as many lines as the meters
|
159
|
-
# depth. Prints the progress as a line of dots, a percentage, time
|
160
|
-
# spent, and time left. And then goes moves the cursor back to its
|
161
|
-
# original line. Everything is printed to stderr.
|
162
|
-
def report(io = STDERR)
|
163
|
-
if Log::LAST != "progress"
|
164
|
-
Log::LAST.replace "progress"
|
165
|
-
length = Log::ProgressBar.cleanup_bars
|
166
|
-
length.times{print(io, "\n")}
|
167
|
-
else
|
168
|
-
print(io, "\n") if @last_report == -1
|
169
|
-
end
|
170
|
-
print(io, up_lines(@depth) << report_msg << down_lines(@depth)) if severity >= Log.severity
|
171
|
-
@last_report = Time.now if @last_report == -1
|
172
|
-
end
|
173
|
-
|
174
|
-
def throughput(io = STDERR)
|
175
|
-
if Log::LAST != "progress"
|
176
|
-
Log::LAST.replace "progress"
|
177
|
-
length = Log::ProgressBar.cleanup_bars
|
178
|
-
length.times{print(io, "\n")}
|
179
|
-
else
|
180
|
-
print(io, "\n") if @last_report == -1
|
181
|
-
end
|
182
|
-
print(io, up_lines(@depth) << throughput_msg << down_lines(@depth)) if severity >= Log.severity
|
183
|
-
@last_report = Time.now
|
184
|
-
@current = 0
|
185
|
-
end
|
186
|
-
|
187
|
-
def done
|
188
|
-
if Log::LAST != "progress"
|
189
|
-
Log::LAST.replace "progress"
|
190
|
-
length = Log::ProgressBar.cleanup_bars
|
191
|
-
length.times{print(io, "\n")}
|
192
|
-
end
|
193
|
-
print(io, up_lines(@depth) << Log.color(:magenta, @desc) << Log.color(:green, " DONE") << down_lines(@depth)) if severity >= Log.severity
|
194
|
-
end
|
195
|
-
|
196
|
-
BAR_MUTEX = Mutex.new
|
197
|
-
BARS = []
|
198
|
-
REMOVE = []
|
199
|
-
def self.new_bar(max, options = {})
|
200
|
-
cleanup_bars
|
201
|
-
BAR_MUTEX.synchronize do
|
202
|
-
options = Misc.add_defaults options, :depth => BARS.length
|
203
|
-
BARS << (bar = ProgressBar.new(max, options))
|
204
|
-
bar
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
def self.cleanup_bars
|
209
|
-
BAR_MUTEX.synchronize do
|
210
|
-
REMOVE.each do |bar|
|
211
|
-
index = BARS.index bar
|
212
|
-
if index
|
213
|
-
BARS.delete_at index
|
214
|
-
BARS.each_with_index do |bar,i|
|
215
|
-
bar.depth = i
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
219
|
-
REMOVE.clear
|
220
|
-
BARS.length
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
def self.remove_bar(bar)
|
225
|
-
bar.done unless bar.max or ENV["RBBT_NO_PROGRESS"] == 'true'
|
226
|
-
BAR_MUTEX.synchronize do
|
227
|
-
REMOVE << bar
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
def self.with_bar(max, options = {})
|
232
|
-
bar = new_bar(max, options)
|
233
|
-
begin
|
234
|
-
yield bar
|
235
|
-
keep = false
|
236
|
-
rescue KeepBar
|
237
|
-
keep = true
|
238
|
-
ensure
|
239
|
-
remove_bar(bar) if bar
|
41
|
+
percent = self.percent
|
42
|
+
if @last_percent.nil?
|
43
|
+
@last_percent = percent
|
44
|
+
return
|
240
45
|
end
|
46
|
+
report and return if percent > @last_percent and diff > 0.3
|
241
47
|
end
|
242
48
|
end
|
243
49
|
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Log
|
2
|
+
class ProgressBar
|
3
|
+
def up_lines(depth)
|
4
|
+
"\033[#{depth + 1}F\033[2K"
|
5
|
+
end
|
6
|
+
|
7
|
+
def down_lines(depth)
|
8
|
+
"\n\033[#{depth + 2}E"
|
9
|
+
end
|
10
|
+
|
11
|
+
def print(io, str)
|
12
|
+
LOG_MUTEX.synchronize do
|
13
|
+
STDERR.print str
|
14
|
+
Log.logfile.puts str unless Log.logfile.nil?
|
15
|
+
Log::LAST.replace "progress"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_accessor :history, :mean_max
|
20
|
+
def thr
|
21
|
+
count = @ticks - @last_count
|
22
|
+
seconds = Time.now - @last_time
|
23
|
+
thr = count / seconds
|
24
|
+
end
|
25
|
+
|
26
|
+
def thr_msg
|
27
|
+
thr = self.thr
|
28
|
+
if @history.nil?
|
29
|
+
@history ||= []
|
30
|
+
else
|
31
|
+
@history << thr
|
32
|
+
@history.shift if @history.length > 10
|
33
|
+
end
|
34
|
+
|
35
|
+
@mean_max ||= 0
|
36
|
+
if @history.length > 3
|
37
|
+
mean = Misc.mean(@history)
|
38
|
+
@mean_max = mean if mean > @mean_max
|
39
|
+
end
|
40
|
+
|
41
|
+
str = "#{ Log.color :blue, thr.to_i.to_s } per sec."
|
42
|
+
str << " #{ Log.color :yellow, mean.to_i.to_s } avg. #{Log.color :yellow, @mean_max.to_i.to_s} max." if @mean_max > 0
|
43
|
+
str
|
44
|
+
end
|
45
|
+
|
46
|
+
def eta_msg
|
47
|
+
percent = self.percent
|
48
|
+
time = Time.now
|
49
|
+
|
50
|
+
indicator = ""
|
51
|
+
10.times{|i|
|
52
|
+
if i < percent / 10 then
|
53
|
+
indicator << Log.color(:yellow, ".")
|
54
|
+
else
|
55
|
+
indicator << " "
|
56
|
+
end
|
57
|
+
}
|
58
|
+
|
59
|
+
indicator << " #{Log.color(:blue, percent.to_s << "%")}"
|
60
|
+
|
61
|
+
used = time - @start
|
62
|
+
if @mean_max and @mean_max > 0
|
63
|
+
eta = (@max - @ticks) / @mean_max
|
64
|
+
else
|
65
|
+
eta = (@max - @ticks) / (@ticks/used)
|
66
|
+
end
|
67
|
+
|
68
|
+
used = [used/3600, used/60 % 60, used % 60].map{|t| "%02i" % t }.join(':')
|
69
|
+
eta = [eta/3600, eta/60 % 60, eta % 60].map{|t| "%02i" % t }.join(':')
|
70
|
+
|
71
|
+
indicator << " #{Log.color :yellow, used} used #{Log.color :yellow, eta} left"
|
72
|
+
|
73
|
+
indicator
|
74
|
+
end
|
75
|
+
|
76
|
+
def report_msg
|
77
|
+
str = Log.color :magenta, desc
|
78
|
+
return str << " " << Log.color(:yellow, "waiting") if @ticks == 0
|
79
|
+
str << " " << thr_msg
|
80
|
+
str << Log.color(:blue, " -- ") << eta_msg if max
|
81
|
+
str
|
82
|
+
end
|
83
|
+
|
84
|
+
def report(io = STDERR)
|
85
|
+
if Log::LAST != "progress"
|
86
|
+
length = Log::ProgressBar.cleanup_bars
|
87
|
+
print(io, Log.color(:yellow, "--Progress\n"))
|
88
|
+
bars = BARS
|
89
|
+
bars.sort_by{|b| b.depth }.reverse.each do |bar|
|
90
|
+
print(io, Log.color(:yellow ,bar.report_msg) << "\n")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
print(io, up_lines(@depth) << report_msg << down_lines(@depth))
|
94
|
+
@last_time = Time.now
|
95
|
+
@last_count = ticks
|
96
|
+
@last_percent = percent if max
|
97
|
+
end
|
98
|
+
|
99
|
+
def done(io = STDERR)
|
100
|
+
done_msg = Log.color(:magenta, desc) << " " << Log.color(:green, "done")
|
101
|
+
done_msg << " " << Log.color(:yellow, (@ticks).to_s) << " in " << Log.color(:blue, (Time.now - @start).to_i.to_s) << " sec."
|
102
|
+
@last_count = 0
|
103
|
+
@last_time = @start
|
104
|
+
done_msg << " (" << thr_msg << ")"
|
105
|
+
print(io, up_lines(@depth) << done_msg << down_lines(@depth))
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Log
|
2
|
+
class ProgressBar
|
3
|
+
BAR_MUTEX = Mutex.new
|
4
|
+
BARS = []
|
5
|
+
REMOVE = []
|
6
|
+
|
7
|
+
def self.new_bar(max, options = {})
|
8
|
+
cleanup_bars
|
9
|
+
BAR_MUTEX.synchronize do
|
10
|
+
Log::LAST.replace "new_bar" if Log::LAST == "progress"
|
11
|
+
options = Misc.add_defaults options, :depth => BARS.length
|
12
|
+
BARS << (bar = ProgressBar.new(max, options))
|
13
|
+
bar
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.cleanup_bars
|
18
|
+
BAR_MUTEX.synchronize do
|
19
|
+
REMOVE.each do |bar|
|
20
|
+
index = BARS.index bar
|
21
|
+
if index
|
22
|
+
BARS.delete_at index
|
23
|
+
BARS.each_with_index do |bar,i|
|
24
|
+
bar.depth = i
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
REMOVE.clear
|
29
|
+
BARS.length
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.remove_bar(bar)
|
34
|
+
bar.done
|
35
|
+
BAR_MUTEX.synchronize do
|
36
|
+
REMOVE << bar
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.with_bar(max, options = {})
|
41
|
+
bar = new_bar(max, options)
|
42
|
+
begin
|
43
|
+
yield bar
|
44
|
+
keep = false
|
45
|
+
rescue KeepBar
|
46
|
+
keep = true
|
47
|
+
ensure
|
48
|
+
remove_bar(bar) if bar
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
@@ -85,6 +85,20 @@ class Step
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def merge_info(hash)
|
89
|
+
return nil if @exec or info_file.nil?
|
90
|
+
value = Annotated.purge value if defined? Annotated
|
91
|
+
lock_filename = Persist.persistence_path(info_file, {:dir => Step.lock_dir})
|
92
|
+
Open.lock(info_file, :refresh => false) do
|
93
|
+
i = info
|
94
|
+
i.merge! hash
|
95
|
+
@info_cache = i
|
96
|
+
Open.write(info_file, INFO_SERIALIAZER.dump(i))
|
97
|
+
@info_cache_time = Time.now
|
98
|
+
value
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
88
102
|
def status
|
89
103
|
info[:status]
|
90
104
|
end
|
@@ -185,11 +185,14 @@ class Step
|
|
185
185
|
|
186
186
|
Open.rm info_file if Open.exists? info_file
|
187
187
|
|
188
|
-
|
189
|
-
set_info :issued, Time.now
|
188
|
+
log :setup, "#{Log.color :green, "Task"} #{Log.color :yellow, task.name.to_s || ""}"
|
190
189
|
|
191
|
-
|
192
|
-
|
190
|
+
merge_info({
|
191
|
+
:pid => Process.pid,
|
192
|
+
:issued => Time.now,
|
193
|
+
:name => name,
|
194
|
+
:dependencies => dependencies.collect{|dep| [dep.task_name, dep.name, dep.path]},
|
195
|
+
})
|
193
196
|
|
194
197
|
dup_inputs
|
195
198
|
begin
|
@@ -391,13 +394,12 @@ class Step
|
|
391
394
|
def abort
|
392
395
|
return if @aborted
|
393
396
|
@aborted = true
|
394
|
-
return if error?
|
395
397
|
return if done?
|
396
398
|
Log.medium{"#{Log.color :red, "Aborting"} #{Log.color :blue, path}"}
|
397
399
|
begin
|
400
|
+
stop_dependencies
|
398
401
|
abort_stream
|
399
402
|
abort_pid
|
400
|
-
stop_dependencies
|
401
403
|
rescue Aborted
|
402
404
|
Log.medium{"#{Log.color :red, "Aborting ABORTED RETRY"} #{Log.color :blue, path}"}
|
403
405
|
retry
|
@@ -427,11 +429,9 @@ class Step
|
|
427
429
|
if stream
|
428
430
|
begin
|
429
431
|
Misc.consume_stream stream
|
430
|
-
stream.join if stream.respond_to? :join
|
431
432
|
rescue Exception
|
432
433
|
self.abort
|
433
434
|
raise $!
|
434
|
-
#stream.abort if stream.respond_to? :abort
|
435
435
|
end
|
436
436
|
end
|
437
437
|
end
|
data/share/rbbt_commands/alias
CHANGED
@@ -8,8 +8,12 @@ cmd, *rest = ARGV
|
|
8
8
|
aliases ||= Rbbt.etc.cmd_alias.exists? ? Rbbt.etc.cmd_alias.yaml : {}
|
9
9
|
|
10
10
|
if cmd.nil?
|
11
|
-
|
12
|
-
|
11
|
+
aliases.each do |name, parts|
|
12
|
+
parts = parts.collect{|p|
|
13
|
+
p =~ /^[\w:_\/-]*$/ ? p : "'" << p << "'"
|
14
|
+
}
|
15
|
+
puts [Log.color(:magenta, name), parts * " "] * ": "
|
16
|
+
end
|
13
17
|
exit 0
|
14
18
|
end
|
15
19
|
|
@@ -0,0 +1,65 @@
|
|
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
|
+
file = ARGV.shift
|
12
|
+
|
13
|
+
$seen = []
|
14
|
+
def get_step(file)
|
15
|
+
file = file.sub(/\.(info|files)/,'')
|
16
|
+
$seen << file
|
17
|
+
Step.new file
|
18
|
+
end
|
19
|
+
|
20
|
+
def status_msg(status)
|
21
|
+
color = case status
|
22
|
+
when :error, :aborted, :missing
|
23
|
+
:red
|
24
|
+
when :streaming
|
25
|
+
:yellow
|
26
|
+
when :done
|
27
|
+
:green
|
28
|
+
else
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
Log.color(color, status)
|
32
|
+
end
|
33
|
+
|
34
|
+
def report_msg(status, name, path)
|
35
|
+
|
36
|
+
parts = path.sub(/#{Regexp.quote(name)}$/,'').split "/"
|
37
|
+
|
38
|
+
task = Log.color(:yellow, parts.pop)
|
39
|
+
workflow = Log.color(:magenta, parts.pop)
|
40
|
+
|
41
|
+
status_msg(status) << " " << [workflow, task, path] * " " << "\n"
|
42
|
+
end
|
43
|
+
|
44
|
+
def report(step, offset = 0)
|
45
|
+
info = step.info || {}
|
46
|
+
path = step.path
|
47
|
+
status = info[:status] || :missing
|
48
|
+
name = info[:name] || File.basename(path)
|
49
|
+
str = " " * offset
|
50
|
+
str << report_msg(status, name, path)
|
51
|
+
info[:dependencies].each do |task,name,path|
|
52
|
+
new = ! $seen.include?(path)
|
53
|
+
dep = get_step path
|
54
|
+
if new
|
55
|
+
str << report(dep, offset + 1)
|
56
|
+
else
|
57
|
+
str << Log.color(:blue, Log.uncolor(report(dep, offset+1)))
|
58
|
+
end
|
59
|
+
end if info[:dependencies]
|
60
|
+
str
|
61
|
+
end
|
62
|
+
|
63
|
+
step = get_step file
|
64
|
+
|
65
|
+
puts report(step).strip
|
@@ -56,21 +56,31 @@ def print(file, offset = 1)
|
|
56
56
|
dependencies = info[:dependencies] || []
|
57
57
|
color = case
|
58
58
|
when (not info)
|
59
|
-
|
59
|
+
nil
|
60
60
|
when info[:status] == :error
|
61
|
-
|
61
|
+
:red
|
62
62
|
when info[:status] == :aborted
|
63
|
-
|
63
|
+
:red
|
64
64
|
when (info[:status] != :done and info[:pid] and not running? info)
|
65
|
-
|
65
|
+
:green
|
66
66
|
end
|
67
67
|
|
68
|
-
puts (" " * offset * 2) <<
|
68
|
+
puts (" " * offset * 2) << Log.color(color, step.path)
|
69
69
|
$done << file
|
70
70
|
root = File.dirname(File.dirname(file))
|
71
|
+
main_parts = step.path.split "/"
|
71
72
|
dependencies.each do |task,new_file|
|
72
73
|
new_file = File.join(root, task.to_s, new_file)
|
73
|
-
|
74
|
+
parts = new_file.split "/"
|
75
|
+
common ||= begin
|
76
|
+
i = 0
|
77
|
+
parts.each do |p|
|
78
|
+
break unless main_parts[i] == p
|
79
|
+
i += 1
|
80
|
+
end
|
81
|
+
i
|
82
|
+
end
|
83
|
+
print(new_file[common-1..-1], offset+1)
|
74
84
|
end
|
75
85
|
end
|
76
86
|
|
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.13.
|
4
|
+
version: 5.13.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -175,6 +175,8 @@ files:
|
|
175
175
|
- lib/rbbt/util/filecache.rb
|
176
176
|
- lib/rbbt/util/log.rb
|
177
177
|
- lib/rbbt/util/log/progress.rb
|
178
|
+
- lib/rbbt/util/log/progress/report.rb
|
179
|
+
- lib/rbbt/util/log/progress/util.rb
|
178
180
|
- lib/rbbt/util/misc.rb
|
179
181
|
- lib/rbbt/util/misc/concurrent_stream.rb
|
180
182
|
- lib/rbbt/util/misc/development.rb
|
@@ -257,6 +259,7 @@ files:
|
|
257
259
|
- share/rbbt_commands/workflow/jobs
|
258
260
|
- share/rbbt_commands/workflow/list
|
259
261
|
- share/rbbt_commands/workflow/monitor
|
262
|
+
- share/rbbt_commands/workflow/prov
|
260
263
|
- share/rbbt_commands/workflow/provenance
|
261
264
|
- share/rbbt_commands/workflow/remote/add
|
262
265
|
- share/rbbt_commands/workflow/remote/list
|