scout-gear 7.1.0 → 7.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +65 -2
  3. data/VERSION +1 -1
  4. data/bin/scout +5 -1
  5. data/lib/rbbt-scout.rb +5 -0
  6. data/lib/scout/concurrent_stream.rb +13 -8
  7. data/lib/scout/config.rb +168 -0
  8. data/lib/scout/exceptions.rb +5 -3
  9. data/lib/scout/indiferent_hash/options.rb +1 -0
  10. data/lib/scout/indiferent_hash.rb +4 -2
  11. data/lib/scout/log/color.rb +3 -2
  12. data/lib/scout/log/progress/report.rb +1 -0
  13. data/lib/scout/log/progress/util.rb +66 -1
  14. data/lib/scout/log/progress.rb +5 -3
  15. data/lib/scout/log.rb +3 -2
  16. data/lib/scout/misc/helper.rb +31 -0
  17. data/lib/scout/misc/monitor.rb +4 -1
  18. data/lib/scout/misc/system.rb +15 -0
  19. data/lib/scout/misc.rb +2 -0
  20. data/lib/scout/named_array.rb +68 -0
  21. data/lib/scout/open/stream.rb +58 -33
  22. data/lib/scout/path/find.rb +27 -3
  23. data/lib/scout/path/util.rb +7 -4
  24. data/lib/scout/persist/serialize.rb +7 -14
  25. data/lib/scout/persist.rb +46 -12
  26. data/lib/scout/resource/produce.rb +7 -94
  27. data/lib/scout/resource/software.rb +176 -0
  28. data/lib/scout/semaphore.rb +8 -1
  29. data/lib/scout/tsv/dumper.rb +112 -0
  30. data/lib/scout/tsv/index.rb +161 -0
  31. data/lib/scout/tsv/open.rb +128 -0
  32. data/lib/scout/tsv/parser.rb +230 -30
  33. data/lib/scout/tsv/path.rb +13 -0
  34. data/lib/scout/tsv/persist/adapter.rb +367 -0
  35. data/lib/scout/tsv/persist/fix_width_table.rb +324 -0
  36. data/lib/scout/tsv/persist/serialize.rb +117 -0
  37. data/lib/scout/tsv/persist/tokyocabinet.rb +113 -0
  38. data/lib/scout/tsv/persist.rb +13 -0
  39. data/lib/scout/tsv/traverse.rb +143 -0
  40. data/lib/scout/tsv/util/filter.rb +303 -0
  41. data/lib/scout/tsv/util/process.rb +73 -0
  42. data/lib/scout/tsv/util/select.rb +220 -0
  43. data/lib/scout/tsv/util.rb +82 -0
  44. data/lib/scout/tsv.rb +16 -3
  45. data/lib/scout/work_queue/worker.rb +4 -4
  46. data/lib/scout/work_queue.rb +22 -7
  47. data/lib/scout/workflow/definition.rb +101 -4
  48. data/lib/scout/workflow/step/config.rb +18 -0
  49. data/lib/scout/workflow/step/dependencies.rb +40 -0
  50. data/lib/scout/workflow/step/file.rb +15 -0
  51. data/lib/scout/workflow/step/info.rb +35 -4
  52. data/lib/scout/workflow/step/progress.rb +14 -0
  53. data/lib/scout/workflow/step/provenance.rb +148 -0
  54. data/lib/scout/workflow/step.rb +71 -17
  55. data/lib/scout/workflow/task.rb +10 -5
  56. data/lib/scout/workflow/usage.rb +3 -1
  57. data/lib/scout/workflow.rb +11 -3
  58. data/lib/scout-gear.rb +1 -0
  59. data/lib/scout.rb +1 -0
  60. data/scout-gear.gemspec +64 -10
  61. data/scout_commands/find +1 -1
  62. data/scout_commands/workflow/task +16 -9
  63. data/scout_commands/workflow/task_old +2 -2
  64. data/share/software/install_helpers +523 -0
  65. data/test/scout/log/test_progress.rb +0 -2
  66. data/test/scout/misc/test_system.rb +21 -0
  67. data/test/scout/open/test_stream.rb +160 -1
  68. data/test/scout/path/test_find.rb +14 -7
  69. data/test/scout/resource/test_software.rb +24 -0
  70. data/test/scout/test_config.rb +66 -0
  71. data/test/scout/test_meta_extension.rb +10 -0
  72. data/test/scout/test_named_array.rb +19 -0
  73. data/test/scout/test_persist.rb +96 -0
  74. data/test/scout/test_tmpfile.rb +1 -1
  75. data/test/scout/test_tsv.rb +50 -1
  76. data/test/scout/test_work_queue.rb +41 -13
  77. data/test/scout/tsv/persist/test_adapter.rb +44 -0
  78. data/test/scout/tsv/persist/test_fix_width_table.rb +134 -0
  79. data/test/scout/tsv/persist/test_tokyocabinet.rb +92 -0
  80. data/test/scout/tsv/test_dumper.rb +44 -0
  81. data/test/scout/tsv/test_index.rb +156 -0
  82. data/test/scout/tsv/test_open.rb +9 -0
  83. data/test/scout/tsv/test_parser.rb +114 -3
  84. data/test/scout/tsv/test_persist.rb +43 -0
  85. data/test/scout/tsv/test_traverse.rb +116 -0
  86. data/test/scout/tsv/test_util.rb +23 -0
  87. data/test/scout/tsv/util/test_filter.rb +188 -0
  88. data/test/scout/tsv/util/test_process.rb +47 -0
  89. data/test/scout/tsv/util/test_select.rb +44 -0
  90. data/test/scout/work_queue/test_worker.rb +66 -9
  91. data/test/scout/workflow/step/test_dependencies.rb +25 -0
  92. data/test/scout/workflow/step/test_info.rb +15 -17
  93. data/test/scout/workflow/step/test_load.rb +19 -21
  94. data/test/scout/workflow/step/test_provenance.rb +25 -0
  95. data/test/scout/workflow/test_step.rb +206 -10
  96. data/test/scout/workflow/test_task.rb +0 -3
  97. data/test/test_helper.rb +9 -1
  98. metadata +50 -6
@@ -2,15 +2,26 @@ require_relative '../path'
2
2
  require_relative '../persist'
3
3
  require_relative 'step/info'
4
4
  require_relative 'step/load'
5
+ require_relative 'step/file'
6
+ require_relative 'step/dependencies'
7
+ require_relative 'step/provenance'
8
+ require_relative 'step/config'
9
+ require_relative 'step/progress'
5
10
 
6
11
  class Step
7
12
 
8
- attr_accessor :path, :inputs, :dependencies, :task
13
+ attr_accessor :path, :inputs, :dependencies, :task, :tee_copies
9
14
  def initialize(path, inputs = nil, dependencies = nil, &task)
10
15
  @path = path
11
16
  @inputs = inputs
12
17
  @dependencies = dependencies
13
18
  @task = task
19
+ @mutex = Mutex.new
20
+ @tee_copies = 1
21
+ end
22
+
23
+ def synchronize(&block)
24
+ @mutex.synchronize(&block)
14
25
  end
15
26
 
16
27
  def inputs
@@ -48,15 +59,20 @@ class Step
48
59
  @task_name ||= @task.name if @task.respond_to?(:name)
49
60
  end
50
61
 
62
+ def workflow
63
+ @task.workflow if @task
64
+ end
65
+
51
66
  def exec
52
- self.instance_exec(*inputs, &task)
67
+ @result = self.instance_exec(*inputs, &task)
53
68
  end
54
69
 
55
70
  attr_reader :result
56
71
  def run
57
72
  return @result || self.load if done?
58
- dependencies.each{|dep| dep.run }
59
- @result = Persist.persist(name, type, :path => path) do
73
+ prepare_dependencies
74
+ run_dependencies
75
+ @result = Persist.persist(name, type, :path => path, :tee_copies => tee_copies) do
60
76
  begin
61
77
  merge_info :status => :start, :start => Time.now,
62
78
  :pid => Process.pid, :pid_hostname => ENV["HOSTNAME"],
@@ -64,17 +80,34 @@ class Step
64
80
  :dependencies => dependencies.collect{|d| d.path }
65
81
 
66
82
  @result = exec
83
+ @result = @result.respond_to?(:stream) ? @result.stream : @result
84
+ @result
85
+ rescue Exception => e
86
+ merge_info :status => :error, :exception => e
87
+ raise e
67
88
  ensure
68
- if streaming?
69
- ConcurrentStream.setup(@result) do
89
+ if ! (error? || aborted?)
90
+ if streaming?
91
+ ConcurrentStream.setup(@result) do
92
+ merge_info :status => :done, :end => Time.now
93
+ end
94
+
95
+ @result.abort_callback = proc do |exception|
96
+ if Aborted === exception || Interrupt === exception
97
+ merge_info :status => :aborted, :end => Time.now
98
+ else
99
+ merge_info :status => :error, :exception => exception, :end => Time.now
100
+ end
101
+ end
102
+
103
+ log :streaming
104
+ else
70
105
  merge_info :status => :done, :end => Time.now
71
106
  end
72
- log :streaming
73
- else
74
- merge_info :status => :done, :end => Time.now
75
107
  end
76
108
  end
77
109
  end
110
+ @result
78
111
  end
79
112
 
80
113
  def done?
@@ -82,19 +115,35 @@ class Step
82
115
  end
83
116
 
84
117
  def streaming?
85
- IO === @result || StringIO === @result
118
+ @take_stream || IO === @result || StringIO === @result
86
119
  end
87
120
 
88
121
  def stream
89
- join
90
- streaming? ? @result : Open.open(path)
122
+ synchronize do
123
+ if streaming? && ! @result.nil?
124
+ if @result.next
125
+ Log.debug "Taking result #{Log.fingerprint @result} next #{Log.fingerprint @result.next}"
126
+ else
127
+ Log.debug "Taking result #{Log.fingerprint @result}"
128
+ end
129
+ @take_stream, @result = @result, @result.next
130
+ @take_stream
131
+ elsif done?
132
+ Open.open(self.path)
133
+ else
134
+ if running?
135
+ nil
136
+ else
137
+ exec
138
+ end
139
+ end
140
+ end
91
141
  end
92
142
 
93
143
  def join
94
- if streaming?
95
- Open.consume_stream(@result, false)
96
- @result = nil
97
- end
144
+ io = self.stream if streaming?
145
+ Open.consume_stream(io, false) if io
146
+ self
98
147
  end
99
148
 
100
149
  def produce
@@ -109,8 +158,13 @@ class Step
109
158
  end
110
159
 
111
160
  def clean
161
+ @take_stream = nil
162
+ @result = nil
163
+ @info = nil
164
+ @info_load_time = nil
112
165
  Open.rm path if Open.exist?(path)
113
166
  Open.rm info_file if Open.exist?(info_file)
167
+ Open.rm_rf files_dir if Open.exist?(files_dir)
114
168
  end
115
169
 
116
170
  def recursive_clean
@@ -128,6 +182,6 @@ class Step
128
182
  end
129
183
 
130
184
  def digest_str
131
- path
185
+ path.dup
132
186
  end
133
187
  end
@@ -1,10 +1,11 @@
1
1
  require_relative '../meta_extension'
2
+ require_relative '../named_array'
2
3
  require_relative 'step'
3
4
  require_relative 'task/inputs'
4
5
 
5
6
  module Task
6
7
  extend MetaExtension
7
- extension_attr :name, :type, :inputs, :deps, :directory, :description
8
+ extension_attr :name, :type, :inputs, :deps, :directory, :description, :returns, :extension, :workflow
8
9
 
9
10
  DEFAULT_NAME = "Default"
10
11
 
@@ -24,7 +25,7 @@ module Task
24
25
  return inputs if deps.nil?
25
26
  deps.inject(inputs) do |acc,dep|
26
27
  workflow, task = dep
27
- next if workflow.nil?
28
+ next acc if workflow.nil? || task.nil?
28
29
  acc += workflow.tasks[task].recursive_inputs
29
30
  end
30
31
  end
@@ -54,7 +55,7 @@ module Task
54
55
  resolved_inputs = {}
55
56
  inputs.each do |k,v|
56
57
  if Symbol === v
57
- input_dep = dependencies.select{|d| d.task_name == v}.first
58
+ input_dep = dependencies.select{|d| d.task_name == v }.first
58
59
  resolved_inputs[k] = input_dep || inputs[v] || k
59
60
  else
60
61
  resolved_inputs[k] = v
@@ -144,12 +145,16 @@ module Task
144
145
 
145
146
  if non_default_inputs.any?
146
147
  hash = Misc.digest(:inputs => input_hash, :dependencies => dependencies)
147
- Log.debug "Hash #{name} - #{hash}: #{Misc.digest_str(:inputs => inputs, :non_default_inputs => non_default_inputs, :dependencies => dependencies)}"
148
+ Log.debug "Hash #{name} - #{hash}: #{Log.fingerprint(:inputs => inputs, :non_default_inputs => non_default_inputs, :dependencies => dependencies)}"
148
149
  id = [id, hash] * "_"
149
150
  end
150
151
 
151
152
  path = directory[id]
152
153
 
153
- Step.new path.find, inputs, dependencies, &self
154
+ Persist.memory(path) do
155
+ Log.debug "Creating job #{path} #{Log.fingerprint inputs} #{Log.fingerprint dependencies}"
156
+ NamedArray.setup(inputs, @inputs.collect{|i| i[0] }) if @inputs
157
+ Step.new path.find, inputs, dependencies, &self
158
+ end
154
159
  end
155
160
  end
@@ -20,6 +20,7 @@ module Task
20
20
  seen = inputs.collect{|name,_| name }
21
21
  dep_inputs = {}
22
22
  deps.each do |dep_workflow,task_name|
23
+ next if task_name.nil?
23
24
  task = dep_workflow.tasks[task_name]
24
25
  next if task.inputs.nil?
25
26
  inputs = task.inputs.reject{|name, _| seen.include? name }
@@ -34,7 +35,6 @@ module Task
34
35
  str.puts Log.color :yellow, dep + ":"
35
36
  str.puts
36
37
  str.puts SOPT.input_array_doc(inputs)
37
- str.puts
38
38
  end
39
39
 
40
40
  #task_inputs = dep_inputs deps, workflow
@@ -72,6 +72,7 @@ module Task
72
72
  str.puts
73
73
  end
74
74
 
75
+ str.puts
75
76
  str.puts Log.color(:magenta, "Returns: ") << Log.color(:blue, type.to_s) << "\n"
76
77
  str.puts
77
78
 
@@ -122,6 +123,7 @@ module Workflow
122
123
  next if seen.include? dep
123
124
  seen << dep
124
125
  workflow, task, *rest = dep
126
+ next if task.nil?
125
127
 
126
128
  key = [workflow, task]
127
129
 
@@ -24,17 +24,25 @@ module Workflow
24
24
  base.libdir = Path.setup(libdir).tap{|p| p.resource = base}
25
25
  end
26
26
 
27
- def self.require_workflow(workflow)
28
- workflow = Path.setup('workflows')[workflow]["workflow.rb"] unless Open.exists?(workflow)
27
+ def self.require_workflow(workflow_name)
28
+ workflow = workflow_name
29
+ workflow = Path.setup('workflows')[workflow_name]["workflow.rb"] unless Open.exists?(workflow)
30
+ workflow = Path.setup('workflows')[Misc.snake_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
31
+ workflow = Path.setup('workflows')[Misc.camel_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
29
32
  if Open.exists?(workflow)
30
33
  workflow = workflow.find if Path === workflow
34
+ $LOAD_PATH.unshift(File.join(File.dirname(workflow), 'lib'))
31
35
  load workflow
36
+ else
37
+ raise "Workflow #{workflow_name} not found"
32
38
  end
33
39
  workflows.last
34
40
  end
35
41
 
36
42
  def job(name, *args)
37
43
  task = tasks[name]
38
- task.job(*args)
44
+ step = task.job(*args)
45
+ step.extend step_module
46
+ step
39
47
  end
40
48
  end
data/lib/scout-gear.rb CHANGED
@@ -7,3 +7,4 @@ require_relative 'scout/simple_opt'
7
7
  require_relative 'scout/resource'
8
8
  require_relative 'scout/resource/scout'
9
9
  require_relative 'scout/persist'
10
+ require_relative 'scout/tsv'
data/lib/scout.rb CHANGED
@@ -1 +1,2 @@
1
1
  require 'workflow-scout'
2
+ require 'rbbt-scout'
data/scout-gear.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: scout-gear 7.1.0 ruby lib
5
+ # stub: scout-gear 7.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scout-gear".freeze
9
- s.version = "7.1.0"
9
+ s.version = "7.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Miguel Vazquez".freeze]
14
- s.date = "2023-05-01"
14
+ s.date = "2023-05-12"
15
15
  s.description = "Temporary files, logs, etc.".freeze
16
16
  s.email = "mikisvaz@gmail.com".freeze
17
17
  s.executables = ["scout".freeze]
@@ -28,10 +28,12 @@ Gem::Specification.new do |s|
28
28
  "Rakefile",
29
29
  "VERSION",
30
30
  "bin/scout",
31
+ "lib/rbbt-scout.rb",
31
32
  "lib/scout-gear.rb",
32
33
  "lib/scout.rb",
33
34
  "lib/scout/cmd.rb",
34
35
  "lib/scout/concurrent_stream.rb",
36
+ "lib/scout/config.rb",
35
37
  "lib/scout/exceptions.rb",
36
38
  "lib/scout/indiferent_hash.rb",
37
39
  "lib/scout/indiferent_hash/case_insensitive.rb",
@@ -48,8 +50,11 @@ Gem::Specification.new do |s|
48
50
  "lib/scout/misc/digest.rb",
49
51
  "lib/scout/misc/filesystem.rb",
50
52
  "lib/scout/misc/format.rb",
53
+ "lib/scout/misc/helper.rb",
51
54
  "lib/scout/misc/insist.rb",
52
55
  "lib/scout/misc/monitor.rb",
56
+ "lib/scout/misc/system.rb",
57
+ "lib/scout/named_array.rb",
53
58
  "lib/scout/open.rb",
54
59
  "lib/scout/open/lock.rb",
55
60
  "lib/scout/open/remote.rb",
@@ -68,6 +73,7 @@ Gem::Specification.new do |s|
68
73
  "lib/scout/resource/produce.rb",
69
74
  "lib/scout/resource/produce/rake.rb",
70
75
  "lib/scout/resource/scout.rb",
76
+ "lib/scout/resource/software.rb",
71
77
  "lib/scout/resource/util.rb",
72
78
  "lib/scout/semaphore.rb",
73
79
  "lib/scout/simple_opt.rb",
@@ -78,7 +84,21 @@ Gem::Specification.new do |s|
78
84
  "lib/scout/simple_opt/setup.rb",
79
85
  "lib/scout/tmpfile.rb",
80
86
  "lib/scout/tsv.rb",
87
+ "lib/scout/tsv/dumper.rb",
88
+ "lib/scout/tsv/index.rb",
89
+ "lib/scout/tsv/open.rb",
81
90
  "lib/scout/tsv/parser.rb",
91
+ "lib/scout/tsv/path.rb",
92
+ "lib/scout/tsv/persist.rb",
93
+ "lib/scout/tsv/persist/adapter.rb",
94
+ "lib/scout/tsv/persist/fix_width_table.rb",
95
+ "lib/scout/tsv/persist/serialize.rb",
96
+ "lib/scout/tsv/persist/tokyocabinet.rb",
97
+ "lib/scout/tsv/traverse.rb",
98
+ "lib/scout/tsv/util.rb",
99
+ "lib/scout/tsv/util/filter.rb",
100
+ "lib/scout/tsv/util/process.rb",
101
+ "lib/scout/tsv/util/select.rb",
82
102
  "lib/scout/work_queue.rb",
83
103
  "lib/scout/work_queue/socket.rb",
84
104
  "lib/scout/work_queue/worker.rb",
@@ -86,8 +106,13 @@ Gem::Specification.new do |s|
86
106
  "lib/scout/workflow/definition.rb",
87
107
  "lib/scout/workflow/documentation.rb",
88
108
  "lib/scout/workflow/step.rb",
109
+ "lib/scout/workflow/step/config.rb",
110
+ "lib/scout/workflow/step/dependencies.rb",
111
+ "lib/scout/workflow/step/file.rb",
89
112
  "lib/scout/workflow/step/info.rb",
90
113
  "lib/scout/workflow/step/load.rb",
114
+ "lib/scout/workflow/step/progress.rb",
115
+ "lib/scout/workflow/step/provenance.rb",
91
116
  "lib/scout/workflow/task.rb",
92
117
  "lib/scout/workflow/task/inputs.rb",
93
118
  "lib/scout/workflow/usage.rb",
@@ -104,6 +129,7 @@ Gem::Specification.new do |s|
104
129
  "scout_commands/workflow/task_old",
105
130
  "share/color/color_names",
106
131
  "share/color/diverging_colors.hex",
132
+ "share/software/install_helpers",
107
133
  "test/scout/indiferent_hash/test_case_insensitive.rb",
108
134
  "test/scout/indiferent_hash/test_options.rb",
109
135
  "test/scout/log/test_color.rb",
@@ -111,6 +137,7 @@ Gem::Specification.new do |s|
111
137
  "test/scout/misc/test_digest.rb",
112
138
  "test/scout/misc/test_filesystem.rb",
113
139
  "test/scout/misc/test_insist.rb",
140
+ "test/scout/misc/test_system.rb",
114
141
  "test/scout/open/test_lock.rb",
115
142
  "test/scout/open/test_remote.rb",
116
143
  "test/scout/open/test_stream.rb",
@@ -122,6 +149,7 @@ Gem::Specification.new do |s|
122
149
  "test/scout/persist/test_serialize.rb",
123
150
  "test/scout/resource/test_path.rb",
124
151
  "test/scout/resource/test_produce.rb",
152
+ "test/scout/resource/test_software.rb",
125
153
  "test/scout/resource/test_util.rb",
126
154
  "test/scout/simple_opt/test_doc.rb",
127
155
  "test/scout/simple_opt/test_get.rb",
@@ -129,10 +157,12 @@ Gem::Specification.new do |s|
129
157
  "test/scout/simple_opt/test_setup.rb",
130
158
  "test/scout/test_cmd.rb",
131
159
  "test/scout/test_concurrent_stream.rb",
160
+ "test/scout/test_config.rb",
132
161
  "test/scout/test_indiferent_hash.rb",
133
162
  "test/scout/test_log.rb",
134
163
  "test/scout/test_meta_extension.rb",
135
164
  "test/scout/test_misc.rb",
165
+ "test/scout/test_named_array.rb",
136
166
  "test/scout/test_open.rb",
137
167
  "test/scout/test_path.rb",
138
168
  "test/scout/test_persist.rb",
@@ -142,11 +172,25 @@ Gem::Specification.new do |s|
142
172
  "test/scout/test_tsv.rb",
143
173
  "test/scout/test_work_queue.rb",
144
174
  "test/scout/test_workflow.rb",
175
+ "test/scout/tsv/persist/test_adapter.rb",
176
+ "test/scout/tsv/persist/test_fix_width_table.rb",
177
+ "test/scout/tsv/persist/test_tokyocabinet.rb",
178
+ "test/scout/tsv/test_dumper.rb",
179
+ "test/scout/tsv/test_index.rb",
180
+ "test/scout/tsv/test_open.rb",
145
181
  "test/scout/tsv/test_parser.rb",
182
+ "test/scout/tsv/test_persist.rb",
183
+ "test/scout/tsv/test_traverse.rb",
184
+ "test/scout/tsv/test_util.rb",
185
+ "test/scout/tsv/util/test_filter.rb",
186
+ "test/scout/tsv/util/test_process.rb",
187
+ "test/scout/tsv/util/test_select.rb",
146
188
  "test/scout/work_queue/test_socket.rb",
147
189
  "test/scout/work_queue/test_worker.rb",
190
+ "test/scout/workflow/step/test_dependencies.rb",
148
191
  "test/scout/workflow/step/test_info.rb",
149
192
  "test/scout/workflow/step/test_load.rb",
193
+ "test/scout/workflow/step/test_provenance.rb",
150
194
  "test/scout/workflow/task/test_inputs.rb",
151
195
  "test/scout/workflow/test_definition.rb",
152
196
  "test/scout/workflow/test_documentation.rb",
@@ -159,15 +203,25 @@ Gem::Specification.new do |s|
159
203
  ]
160
204
  s.homepage = "http://github.com/mikisvaz/scout-gear".freeze
161
205
  s.licenses = ["MIT".freeze]
162
- s.rubygems_version = "3.4.11".freeze
206
+ s.rubygems_version = "3.2.15".freeze
163
207
  s.summary = "basic gear for scouts".freeze
164
208
 
165
- s.specification_version = 4
209
+ if s.respond_to? :specification_version then
210
+ s.specification_version = 4
211
+ end
166
212
 
167
- s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
168
- s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
169
- s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
170
- s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
171
- s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
213
+ if s.respond_to? :add_runtime_dependency then
214
+ s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
215
+ s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
216
+ s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
217
+ s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
218
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
219
+ else
220
+ s.add_dependency(%q<term-ansicolor>.freeze, [">= 0"])
221
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
222
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
223
+ s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
224
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
225
+ end
172
226
  end
173
227
 
data/scout_commands/find CHANGED
@@ -69,7 +69,7 @@ end if resource
69
69
 
70
70
  path = (resource || Scout)[path.dup]
71
71
 
72
- if where.nil? || where == 'all' || path.search_paths.include?(where.to_sym)
72
+ if where.nil? || where == 'all' || path.path_maps.include?(where.to_sym)
73
73
  location = path.find(where)
74
74
 
75
75
  if Array === location
@@ -13,6 +13,7 @@ $ #{$0} [<options>] <workflow> <task>
13
13
  -h--help Print this help
14
14
  -jn--job_name* Name to use as job identifier
15
15
  -pf--print_filepath Print the file path
16
+ -prov--provenance Print the step provenance
16
17
  -cl--clean Clean the last step
17
18
  -rcl--recursive_clean Clean all steps
18
19
  EOF
@@ -22,6 +23,7 @@ workflow_name, task_name = ARGV
22
23
  raise MissingParameterException.new :workflow if workflow_name.nil?
23
24
 
24
25
  workflow = Workflow.require_workflow workflow_name
26
+ task_name = task_name.to_sym if task_name
25
27
  task = workflow.tasks[task_name.to_sym] if task_name
26
28
 
27
29
  options[:help] = true if task.nil?
@@ -38,20 +40,25 @@ if options[:help]
38
40
  end
39
41
 
40
42
  job_options = task.get_SOPT(task)
41
- job = task.job(options[:job_name], job_options)
43
+ job = workflow.job(task_name, options[:job_name], job_options)
42
44
 
43
45
  job.recursive_clean if options[:recursive_clean]
44
46
  job.clean if options[:clean]
45
47
 
46
- job.run
47
-
48
- if options[:print_filepath]
49
- path = job.path
50
- path = path.find if Path === path
51
- puts path
48
+ if options[:provenance]
49
+ puts Step.prov_report(job)
52
50
  else
53
- if ! Open.consume_stream(job.stream, false, STDOUT, false).end_with? "\n"
54
- puts
51
+ job.run unless job.done?
52
+
53
+ if options[:print_filepath]
54
+ job.join
55
+ path = job.path
56
+ path = path.find if Path === path
57
+ puts path
58
+ else
59
+ if ! ((c = Open.consume_stream(job.stream, false, STDOUT, false)) && c.end_with?("\n"))
60
+ puts
61
+ end
55
62
  end
56
63
  end
57
64
 
@@ -656,12 +656,12 @@ when (defined?(RemoteStep) and RemoteStep)
656
656
  end
657
657
  when Step
658
658
  if res.streaming?
659
- io = TSV.get_stream res
659
+ io = TSV.stream res
660
660
  Misc.consume_stream(io, false, out)
661
661
  io.join if io.respond_to? :join
662
662
  elsif IO === res.result
663
663
  begin
664
- io = res.get_stream
664
+ io = res.stream
665
665
  Misc.consume_stream(io, false, out)
666
666
  io.join if io.respond_to? :join
667
667
  rescue Aborted, Interrupt