rbbt-util 5.9.4 → 5.9.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/step.rb +6 -3
- data/share/rbbt_commands/workflow/task +41 -14
- 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: 485bac99517b86329c91a69142f4b38c8405cc8f
|
4
|
+
data.tar.gz: f8f7fee0f9f2ceccc294431d31d1f9e14983b903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b3897bc88326b032537c45579f6d6236da05b47683fd4d802cd61032c4d12c7cf35ee35898d05e19bb8a63d505c495a282206ab55a0740461b630c4cc303f92
|
7
|
+
data.tar.gz: 15680565e5cf2e61dc0770ae9b8949d890a5c13dd27a93e60eabad2c4ad3a18754056f145edc72763630d573119f9b64b6773a8bb9de9397c565bc5f4e7acc6b
|
data/lib/rbbt/workflow/step.rb
CHANGED
@@ -180,8 +180,8 @@ class Step
|
|
180
180
|
def fork(semaphore = nil)
|
181
181
|
raise "Can not fork: Step is waiting for proces #{@pid} to finish" if not @pid.nil?
|
182
182
|
@pid = Process.fork do
|
183
|
-
trap(:INT) { raise Aborted.new "INT signal recieved" }
|
184
183
|
begin
|
184
|
+
#trap(:INT) { raise Aborted.new "INT signal recieved" }
|
185
185
|
RbbtSemaphore.wait_semaphore(semaphore) if semaphore
|
186
186
|
FileUtils.mkdir_p File.dirname(path) unless Open.exists? File.dirname(path)
|
187
187
|
begin
|
@@ -219,19 +219,22 @@ class Step
|
|
219
219
|
RbbtSemaphore.post_semaphore(semaphore) if semaphore
|
220
220
|
end
|
221
221
|
end
|
222
|
+
set_info :forked, true
|
222
223
|
Process.detach(@pid)
|
223
224
|
self
|
224
225
|
end
|
225
226
|
|
226
227
|
def abort
|
227
228
|
@pid ||= info[:pid]
|
228
|
-
if @pid.nil?
|
229
|
+
if @pid.nil? and info[:forked]
|
229
230
|
Log.medium "Could not abort #{path}: no pid"
|
230
231
|
false
|
231
232
|
else
|
232
233
|
Log.medium "Aborting #{path}: #{ @pid }"
|
233
234
|
begin
|
234
|
-
Process.kill("
|
235
|
+
Process.kill("TERM", @pid)
|
236
|
+
sleep 1
|
237
|
+
Process.kill("KILL", @pid)
|
235
238
|
Process.waitpid @pid
|
236
239
|
rescue Exception
|
237
240
|
Log.debug("Aborted job #{@pid} was not killed: #{$!.message}")
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'rbbt/util/simpleopt'
|
4
4
|
require 'rbbt/workflow'
|
5
5
|
require 'rbbt/workflow/usage'
|
6
|
+
require 'time'
|
6
7
|
|
7
8
|
def report_options(options)
|
8
9
|
if options.nil? or options.empty?
|
@@ -265,34 +266,58 @@ begin
|
|
265
266
|
end
|
266
267
|
|
267
268
|
if do_fork
|
268
|
-
job.fork
|
269
269
|
if detach
|
270
|
-
|
271
|
-
|
270
|
+
job.fork
|
271
|
+
Process.detach job.pid if job.pid
|
272
|
+
puts Log.color(:magenta, "Issued: ") + Log.color(:magenta, job.pid ? job.pid.to_s : 'no pid') + ' -- ' + job.path
|
273
|
+
exit 0
|
274
|
+
end
|
275
|
+
|
276
|
+
Signal.trap(:INT) do
|
277
|
+
begin
|
278
|
+
job.abort if job.info[:pid] == job.pid
|
279
|
+
rescue
|
280
|
+
end
|
272
281
|
exit 0
|
273
282
|
end
|
283
|
+
|
284
|
+
job.fork
|
285
|
+
|
274
286
|
puts
|
275
287
|
puts
|
288
|
+
size = Log.tty_size
|
289
|
+
size = 100 if size.nil?
|
290
|
+
|
276
291
|
while not job.done?
|
277
292
|
message = (job.messages and job.messages.any?) ? job.messages.last.strip : "no message"
|
278
293
|
status = job.status || "no status"
|
279
|
-
|
280
|
-
|
281
|
-
|
294
|
+
if job.info and job.info.include? :issued
|
295
|
+
issued = job.info[:issued]
|
296
|
+
issued = Time.parse(issued) unless Time === issued
|
297
|
+
time = Time.now - issued
|
298
|
+
end
|
282
299
|
puts Log.return_line << " " * size << Log.return_line
|
283
300
|
puts Log.return_line << " " * size << Log.return_line
|
284
301
|
puts "#{Log.color :blue, job.path}"
|
285
|
-
puts "Waiting on #{Log.color :blue, job.info[:pid] || job.pid} (
|
302
|
+
puts "Waiting on #{Log.color :blue, job.info[:pid] || job.pid} (#{time ? time.to_i : '?'} sec. ago) " << [Log.color(:cyan, status.to_s),message.strip].compact*" "
|
286
303
|
sleep 2
|
287
304
|
end
|
288
|
-
#Signal.trap(:INT){ job.abort }
|
289
305
|
raise job.messages.last if job.error?
|
290
|
-
|
306
|
+
|
307
|
+
if job.info and job.info.include? :issued
|
308
|
+
issued = job.info[:issued]
|
309
|
+
issued = Time.parse(issued) unless Time === issued
|
310
|
+
time = Time.now - issued
|
311
|
+
end
|
312
|
+
puts Log.return_line << " " * size << Log.return_line
|
313
|
+
puts Log.return_line << " " * size << Log.return_line
|
314
|
+
puts job.path
|
315
|
+
exit 0
|
291
316
|
else
|
292
|
-
|
317
|
+
job.run(true)
|
318
|
+
res = job
|
293
319
|
end
|
294
320
|
|
295
|
-
puts res
|
296
321
|
|
297
322
|
if options.delete(:provenance)
|
298
323
|
pp job.provenance
|
@@ -332,12 +357,14 @@ if job_file = options.delete(:job_file)
|
|
332
357
|
out.puts Path === file ? file.read : file
|
333
358
|
exit 0
|
334
359
|
end
|
335
|
-
ddd 1
|
336
360
|
|
337
|
-
|
361
|
+
case res
|
362
|
+
when (defined?(WorkflowRESTClient) and WorkflowRESTClient::RemoteStep)
|
363
|
+
out.puts res.load
|
364
|
+
when Step
|
338
365
|
out.puts Open.read(res.path) if File.exists? res.path
|
339
366
|
else
|
340
|
-
out.puts res
|
367
|
+
out.puts res.to_s
|
341
368
|
end
|
342
369
|
|
343
370
|
exit 0
|