share/rbbt_commands/workflow/example in rbbt-util-5.13.2 vs share/rbbt_commands/workflow/example in rbbt-util-5.13.3
- old
+ new
@@ -11,31 +11,37 @@
Log.debug "Using #{example_dir}"
ARGV.replace([workflow.to_s, task, '--load_inputs', example_dir, '--jobname', name,'-pf'] + $saved_args)
path = nil
+ success = nil
TmpFile.with_file do |res|
Open.open(res, :mode => 'w') do |file|
@pid = Process.fork{
STDOUT.reopen res
load Rbbt.share.rbbt_commands.workflow.task.find
}
- file.close
Signal.trap(:INT) do
begin
Process.kill "INT", @pid
ensure
- exit -1
+ Kernel.exit! -1
end
end
- Process.wait @pid
+ file.close
+ begin
+ p,s = Process.waitpid2 @pid
+ success = s.success?
+ rescue Errno::ECHILD
+ success = true
+ end
end
path = Open.read(res).strip if File.exists? res
end
path = "NO RESULT" if path.nil? or path.empty?
- if $?.success?
+ if success
Log.info "#{Log.color :green, "SUCCESS"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
return [path, true]
else
Log.info "#{Log.color :red, "ERROR"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
return [path, false]
@@ -58,16 +64,17 @@
workflow = Workflow.require_workflow workflow
tasks = task ? [task] : workflow.libdir.examples.glob('*').collect{|file| File.basename file }
task_result = {}
-tasks.each do |task|
+TSV.traverse tasks, :threads => 5 do |task|
names = name ? [name] : workflow.libdir.examples[task].glob('*').collect{|file| File.basename file }
- names.each do |name|
+ TSV.traverse names, :threads => 5 do |name|
success = run_task workflow, task, name
task_result[[task, name]] = success
end
end
+
task_result.each do |code,res|
task, name = code
path, success = res
if success