rbbt-util 5.8.3 → 5.8.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f878977d61954ff0e75db2c46a479f60cdb9ac0
4
- data.tar.gz: 0d525ca80ffcc1bb9ab128968406e399552fa4d5
3
+ metadata.gz: 4c797873ae505de56e3946d6effdb0cabd417c6a
4
+ data.tar.gz: f191e7f6bd071f97dd3147d0b7c5b672a708c69d
5
5
  SHA512:
6
- metadata.gz: a35853cd5698117c360befd9dc876a36b2c590c3eaa171424700bdd1d28ba75106d28badfb0d76534dd975fe0fe50a43cc92794c3be5b44b66077e649296ab0c
7
- data.tar.gz: d4522e6efe04efaa658e19bfee22cf15b41dce5a771e2e5be3137a518691b80dbd6aebf0a638696f6f1d632db6bffc97b4ad8e9266d5236d22bb62ed42a1d435
6
+ metadata.gz: da7d7f21f11c5564514be72b81734958f0a46b742f40a50252f62442dd4089a96c41da2b0d714c8d135d3851699d519c1f4b95fd3a2830dd89d452453cc4ca2e
7
+ data.tar.gz: e38d5a7d439fda5310a8db460337414e808762a5996fbc7f6413da71c7506b57d91f5b4d6fab28d2f774652614848a20d4016a8476f58f72d5e91e648d66d90b
@@ -342,7 +342,7 @@ module Open
342
342
 
343
343
  if block_given?
344
344
  res = yield(io)
345
- io.close
345
+ io.close unless io.closed?
346
346
  return res
347
347
  else
348
348
  io
@@ -10,24 +10,35 @@ def run_task(workflow, task, name)
10
10
  example_dir = workflow.libdir.examples[task][name].find
11
11
  Log.debug "Using #{example_dir}"
12
12
 
13
- ARGV.replace([workflow.to_s, task, '--load_inputs', example_dir, '--jobname', name,'--pf'] + $saved_args)
14
-
15
- @pid = Process.fork{
16
- load Rbbt.share.rbbt_commands.workflow.task.find
17
- }
18
- Signal.trap(:INT) do
19
- begin
20
- Process.kill "INT", @pid
21
- ensure
22
- exit -1
13
+ ARGV.replace([workflow.to_s, task, '--load_inputs', example_dir, '--jobname', name,'-pf'] + $saved_args)
14
+
15
+ path = nil
16
+ TmpFile.with_file do |res|
17
+ Open.open(res, :mode => 'w') do |file|
18
+ @pid = Process.fork{
19
+ STDOUT.reopen res
20
+ load Rbbt.share.rbbt_commands.workflow.task.find
21
+ }
22
+ file.close
23
+ Signal.trap(:INT) do
24
+ begin
25
+ Process.kill "INT", @pid
26
+ ensure
27
+ exit -1
28
+ end
29
+ end
30
+ Process.wait @pid
23
31
  end
32
+ path = Open.read(res) if File.exists? res
24
33
  end
25
- Process.wait @pid
34
+ path = "NO RESULT" if path.nil? or path.empty?
26
35
 
27
36
  if $?.success?
28
37
  Log.info "#{Log.color :green, "SUCCESS"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
38
+ return [path, true]
29
39
  else
30
40
  Log.info "#{Log.color :red, "ERROR"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
41
+ return [path, false]
31
42
  end
32
43
  end
33
44
 
@@ -42,14 +53,27 @@ name = nil if name == '--'
42
53
 
43
54
  $saved_args = ARGV.dup
44
55
 
45
-
46
56
  workflow = Workflow.require_workflow workflow
47
57
 
48
58
  tasks = task ? [task] : workflow.libdir.examples.glob('*').collect{|file| File.basename file }
49
59
 
60
+ task_result = {}
50
61
  tasks.each do |task|
51
62
  names = name ? [name] : workflow.libdir.examples[task].glob('*').collect{|file| File.basename file }
52
63
  names.each do |name|
53
- run_task workflow, task, name
64
+ success = run_task workflow, task, name
65
+ task_result[[task, name]] = success
66
+ end
67
+ end
68
+
69
+ task_result.each do |code,res|
70
+ task, name = code
71
+ path, success = res
72
+ if success
73
+ puts "#{Log.color :green, "SUCCESS"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
74
+ puts path
75
+ else
76
+ puts "#{Log.color :red, "ERROR"} #{Log.color :magenta, workflow.to_s}##{Log.color :yellow, task} -- #{Log.color :cyan, name}"
77
+ puts path
54
78
  end
55
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.3
4
+ version: 5.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez