scout-gear 10.11.4 → 10.11.7
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/.vimproject +17 -2
- data/VERSION +1 -1
- data/bin/scout +10 -10
- data/lib/scout/association/fields.rb +15 -15
- data/lib/scout/association/index.rb +6 -6
- data/lib/scout/association/item.rb +18 -8
- data/lib/scout/association.rb +4 -4
- data/lib/scout/entity/identifiers.rb +5 -5
- data/lib/scout/entity/property.rb +2 -2
- data/lib/scout/entity.rb +1 -1
- data/lib/scout/knowledge_base/description.rb +10 -10
- data/lib/scout/knowledge_base/entity.rb +6 -6
- data/lib/scout/knowledge_base/list.rb +1 -1
- data/lib/scout/knowledge_base/query.rb +4 -4
- data/lib/scout/knowledge_base/registry.rb +6 -6
- data/lib/scout/knowledge_base/traverse.rb +7 -40
- data/lib/scout/persist/engine/fix_width_table.rb +6 -6
- data/lib/scout/persist/engine/packed_index.rb +2 -2
- data/lib/scout/persist/engine/sharder.rb +4 -4
- data/lib/scout/persist/engine/tkrzw.rb +1 -1
- data/lib/scout/persist/engine/tokyocabinet.rb +2 -2
- data/lib/scout/persist/tsv/adapter/fix_width_table.rb +1 -1
- data/lib/scout/persist/tsv/adapter/packed_index.rb +1 -1
- data/lib/scout/persist/tsv/adapter/tkrzw.rb +1 -1
- data/lib/scout/persist/tsv/adapter/tokyocabinet.rb +3 -3
- data/lib/scout/persist/tsv/serialize.rb +3 -3
- data/lib/scout/persist/tsv.rb +1 -1
- data/lib/scout/semaphore.rb +100 -17
- data/lib/scout/tsv/annotation/repo.rb +4 -4
- data/lib/scout/tsv/annotation.rb +2 -2
- data/lib/scout/tsv/attach.rb +7 -7
- data/lib/scout/tsv/change_id/translate.rb +1 -1
- data/lib/scout/tsv/csv.rb +3 -3
- data/lib/scout/tsv/dumper.rb +8 -8
- data/lib/scout/tsv/index.rb +1 -1
- data/lib/scout/tsv/open.rb +3 -3
- data/lib/scout/tsv/stream.rb +2 -2
- data/lib/scout/tsv/traverse.rb +4 -4
- data/lib/scout/tsv/util/filter.rb +9 -9
- data/lib/scout/tsv/util/process.rb +2 -2
- data/lib/scout/tsv/util/reorder.rb +2 -2
- data/lib/scout/tsv/util/select.rb +3 -3
- data/lib/scout/tsv/util/unzip.rb +2 -2
- data/lib/scout/tsv/util.rb +1 -1
- data/lib/scout/tsv.rb +2 -2
- data/lib/scout/work_queue/socket.rb +3 -2
- data/lib/scout/work_queue/worker.rb +4 -4
- data/lib/scout/work_queue.rb +7 -7
- data/lib/scout/workflow/definition.rb +18 -16
- data/lib/scout/workflow/deployment/local.rb +81 -62
- data/lib/scout/workflow/deployment/orchestrator/batches.rb +66 -5
- data/lib/scout/workflow/deployment/orchestrator/chains.rb +47 -30
- data/lib/scout/workflow/deployment/orchestrator/rules.rb +3 -3
- data/lib/scout/workflow/deployment/orchestrator/workload.rb +11 -22
- data/lib/scout/workflow/deployment/scheduler/job.rb +34 -36
- data/lib/scout/workflow/deployment/scheduler/lfs.rb +1 -1
- data/lib/scout/workflow/deployment/scheduler/pbs.rb +4 -4
- data/lib/scout/workflow/deployment/scheduler/slurm.rb +2 -2
- data/lib/scout/workflow/deployment/scheduler.rb +23 -12
- data/lib/scout/workflow/deployment/trace.rb +2 -2
- data/lib/scout/workflow/documentation.rb +4 -4
- data/lib/scout/workflow/export.rb +1 -1
- data/lib/scout/workflow/path.rb +2 -2
- data/lib/scout/workflow/step/children.rb +1 -1
- data/lib/scout/workflow/step/dependencies.rb +36 -3
- data/lib/scout/workflow/step/info.rb +5 -19
- data/lib/scout/workflow/step/inputs.rb +1 -1
- data/lib/scout/workflow/step/progress.rb +2 -2
- data/lib/scout/workflow/step/provenance.rb +4 -4
- data/lib/scout/workflow/step/status.rb +23 -9
- data/lib/scout/workflow/step.rb +21 -19
- data/lib/scout/workflow/task/dependencies.rb +10 -3
- data/lib/scout/workflow/task/info.rb +3 -3
- data/lib/scout/workflow/task/inputs.rb +8 -8
- data/lib/scout/workflow/task.rb +37 -22
- data/lib/scout/workflow/usage.rb +13 -13
- data/lib/scout/workflow/util.rb +1 -1
- data/lib/scout/workflow.rb +6 -6
- data/scout-gear.gemspec +4 -3
- data/scout_commands/alias +1 -1
- data/scout_commands/batch/clean +12 -12
- data/scout_commands/batch/list +26 -25
- data/scout_commands/batch/tail +9 -5
- data/scout_commands/cat +1 -1
- data/scout_commands/doc +2 -2
- data/scout_commands/entity +4 -4
- data/scout_commands/find +1 -1
- data/scout_commands/kb/config +1 -1
- data/scout_commands/kb/entities +1 -1
- data/scout_commands/kb/list +1 -1
- data/scout_commands/kb/query +2 -2
- data/scout_commands/kb/register +1 -1
- data/scout_commands/kb/show +1 -1
- data/scout_commands/kb/traverse +1 -1
- data/scout_commands/log +6 -6
- data/scout_commands/resource/produce +2 -2
- data/scout_commands/resource/sync +1 -1
- data/scout_commands/system/clean +7 -7
- data/scout_commands/system/status +4 -4
- data/scout_commands/template +1 -1
- data/scout_commands/update +1 -1
- data/scout_commands/workflow/cmd +2 -1
- data/scout_commands/workflow/example +123 -0
- data/scout_commands/workflow/info +10 -1
- data/scout_commands/workflow/install +1 -1
- data/scout_commands/workflow/list +2 -2
- data/scout_commands/workflow/process +2 -2
- data/scout_commands/workflow/prov +3 -3
- data/scout_commands/workflow/task +36 -11
- data/scout_commands/workflow/trace +1 -1
- data/scout_commands/workflow/write_info +2 -2
- data/share/templates/command +1 -1
- data/test/scout/association/test_item.rb +5 -0
- data/test/scout/entity/test_property.rb +3 -3
- data/test/scout/knowledge_base/test_description.rb +1 -1
- data/test/scout/knowledge_base/test_traverse.rb +2 -2
- data/test/scout/persist/engine/test_packed_index.rb +6 -6
- data/test/scout/persist/test_tsv.rb +4 -4
- data/test/scout/persist/tsv/adapter/test_packed_index.rb +4 -4
- data/test/scout/persist/tsv/adapter/test_sharder.rb +23 -23
- data/test/scout/persist/tsv/adapter/test_tokyocabinet.rb +1 -1
- data/test/scout/persist/tsv/test_serialize.rb +1 -1
- data/test/scout/test_association.rb +1 -1
- data/test/scout/test_tsv.rb +2 -2
- data/test/scout/test_workflow.rb +2 -2
- data/test/scout/tsv/test_annotation.rb +4 -4
- data/test/scout/tsv/test_index.rb +1 -1
- data/test/scout/tsv/test_open.rb +2 -2
- data/test/scout/tsv/test_parser.rb +2 -2
- data/test/scout/tsv/test_stream.rb +1 -1
- data/test/scout/tsv/test_transformer.rb +1 -1
- data/test/scout/tsv/util/test_filter.rb +1 -1
- data/test/scout/tsv/util/test_melt.rb +1 -1
- data/test/scout/tsv/util/test_reorder.rb +1 -1
- data/test/scout/work_queue/test_socket.rb +3 -3
- data/test/scout/work_queue/test_worker.rb +2 -2
- data/test/scout/workflow/deployment/orchestrator/test_batches.rb +13 -3
- data/test/scout/workflow/deployment/orchestrator/test_chains.rb +15 -13
- data/test/scout/workflow/deployment/orchestrator/test_workload.rb +1 -1
- data/test/scout/workflow/deployment/test_local.rb +2 -2
- data/test/scout/workflow/deployment/test_scheduler.rb +1 -2
- data/test/scout/workflow/step/test_children.rb +1 -1
- data/test/scout/workflow/step/test_dependencies.rb +36 -1
- data/test/scout/workflow/step/test_info.rb +3 -35
- data/test/scout/workflow/step/test_load.rb +1 -1
- data/test/scout/workflow/step/test_provenance.rb +1 -1
- data/test/scout/workflow/step/test_status.rb +33 -1
- data/test/scout/workflow/task/test_dependencies.rb +9 -7
- data/test/scout/workflow/task/test_inputs.rb +1 -1
- data/test/scout/workflow/test_definition.rb +1 -1
- data/test/scout/workflow/test_documentation.rb +1 -1
- data/test/scout/workflow/test_entity.rb +2 -2
- data/test/scout/workflow/test_step.rb +13 -13
- data/test/scout/workflow/test_usage.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +3 -2
data/lib/scout/tsv/dumper.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module TSV
|
|
2
2
|
class Dumper
|
|
3
3
|
def self.header(options={})
|
|
4
|
-
key_field, fields, sep, header_hash, preamble, unnamed = IndiferentHash.process_options options,
|
|
4
|
+
key_field, fields, sep, header_hash, preamble, unnamed = IndiferentHash.process_options options,
|
|
5
5
|
:key_field, :fields, :sep, :header_hash, :preamble, :unnamed,
|
|
6
6
|
:sep => "\t", :header_hash => "#", :preamble => true
|
|
7
7
|
|
|
@@ -29,8 +29,8 @@ module TSV
|
|
|
29
29
|
attr_accessor :options, :initialized, :type, :sep, :compact, :filename, :namespace
|
|
30
30
|
def initialize(options = {})
|
|
31
31
|
options = options.options.merge(sep: nil) if TSV::Parser === options || TSV === options
|
|
32
|
-
@sep, @type = IndiferentHash.process_options options,
|
|
33
|
-
:sep, :type,
|
|
32
|
+
@sep, @type = IndiferentHash.process_options options,
|
|
33
|
+
:sep, :type,
|
|
34
34
|
:sep => "\t", :type => :double
|
|
35
35
|
@compact = options[:compact]
|
|
36
36
|
@options = options
|
|
@@ -54,7 +54,7 @@ module TSV
|
|
|
54
54
|
def key_field
|
|
55
55
|
@options[:key_field]
|
|
56
56
|
end
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
def fields
|
|
59
59
|
@options[:fields]
|
|
60
60
|
end
|
|
@@ -62,7 +62,7 @@ module TSV
|
|
|
62
62
|
def key_field=(key_field)
|
|
63
63
|
@options[:key_field] = key_field
|
|
64
64
|
end
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
def fields=(fields)
|
|
67
67
|
@options[:fields] = fields
|
|
68
68
|
end
|
|
@@ -100,7 +100,7 @@ module TSV
|
|
|
100
100
|
when :double
|
|
101
101
|
@sin << key + @sep + value.collect{|v| Array === v ? (@compact ? v.compact : v) * "|" : v } * @sep << "\n"
|
|
102
102
|
else
|
|
103
|
-
if Array === value
|
|
103
|
+
if Array === value
|
|
104
104
|
if Array === value.first
|
|
105
105
|
@sin << key + @sep + value.collect{|v| Array === v ? (@compact ? v.compact : v) * "|" : v } * @sep << "\n"
|
|
106
106
|
else
|
|
@@ -147,7 +147,7 @@ module TSV
|
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def dumper_stream(options = {})
|
|
150
|
-
preamble, unmerge, keys, stream = IndiferentHash.process_options options,
|
|
150
|
+
preamble, unmerge, keys, stream = IndiferentHash.process_options options,
|
|
151
151
|
:preamble, :unmerge, :keys, :stream,
|
|
152
152
|
:preamble => true, :unmerge => false
|
|
153
153
|
unmerge = false unless @type === :double
|
|
@@ -177,7 +177,7 @@ module TSV
|
|
|
177
177
|
|
|
178
178
|
self.with_unnamed do
|
|
179
179
|
if stream.nil?
|
|
180
|
-
t = Thread.new do
|
|
180
|
+
t = Thread.new do
|
|
181
181
|
begin
|
|
182
182
|
Thread.current.report_on_exception = true
|
|
183
183
|
Thread.current["name"] = "Dumper thread"
|
data/lib/scout/tsv/index.rb
CHANGED
data/lib/scout/tsv/open.rb
CHANGED
|
@@ -62,7 +62,7 @@ module Open
|
|
|
62
62
|
|
|
63
63
|
if into.respond_to?(:close)
|
|
64
64
|
obj = obj.find if Path === obj
|
|
65
|
-
into_thread = Thread.new do
|
|
65
|
+
into_thread = Thread.new do
|
|
66
66
|
Thread.current.report_on_exception = false
|
|
67
67
|
Thread.current["name"] = "Traverse into"
|
|
68
68
|
error = false
|
|
@@ -96,7 +96,7 @@ module Open
|
|
|
96
96
|
queue.process do |res|
|
|
97
97
|
callback.call res if callback
|
|
98
98
|
end
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
begin
|
|
101
101
|
self.traverse(obj, **options) do |*args|
|
|
102
102
|
queue.write args
|
|
@@ -210,7 +210,7 @@ module TSV
|
|
|
210
210
|
|
|
211
211
|
def self.process_stream(stream, header_hash: "#", &block)
|
|
212
212
|
sout = Open.open_pipe do |sin|
|
|
213
|
-
while line = stream.gets
|
|
213
|
+
while line = stream.gets
|
|
214
214
|
break unless line.start_with?(header_hash)
|
|
215
215
|
sin.puts line
|
|
216
216
|
end
|
data/lib/scout/tsv/stream.rb
CHANGED
|
@@ -77,7 +77,7 @@ module TSV
|
|
|
77
77
|
fields = fields.compact.flatten
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
options = input_options.first
|
|
80
|
+
options = input_options.first
|
|
81
81
|
type ||= options[:type]
|
|
82
82
|
type ||= :list if type == :single
|
|
83
83
|
type ||= :double if type == :flat
|
|
@@ -152,7 +152,7 @@ module TSV
|
|
|
152
152
|
|
|
153
153
|
if k == keys[i]
|
|
154
154
|
new_parts = NamedArray.zip_fields([new_parts]).zip(p).collect{|p| [p.flatten * "|"] }
|
|
155
|
-
raise TryAgain
|
|
155
|
+
raise TryAgain
|
|
156
156
|
end
|
|
157
157
|
keys[i]= k
|
|
158
158
|
parts[i]= p
|
data/lib/scout/tsv/traverse.rb
CHANGED
|
@@ -60,9 +60,9 @@ module TSV
|
|
|
60
60
|
key = values.delete_at(key_pos)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
|
-
else
|
|
63
|
+
else
|
|
64
64
|
orig_key = key
|
|
65
|
-
key = @type == :flat ? values : values[key_pos] if key_pos != :key
|
|
65
|
+
key = @type == :flat ? values : values[key_pos] if key_pos != :key
|
|
66
66
|
|
|
67
67
|
values = values.values_at(*positions)
|
|
68
68
|
if key_index
|
|
@@ -85,7 +85,7 @@ module TSV
|
|
|
85
85
|
|
|
86
86
|
values = TSV.cast_value(values, cast) if cast
|
|
87
87
|
|
|
88
|
-
if Array === key
|
|
88
|
+
if Array === key
|
|
89
89
|
key = key.uniq if uniq
|
|
90
90
|
if @type == :double && one2one
|
|
91
91
|
if one2one == :strict
|
|
@@ -159,7 +159,7 @@ module TSV
|
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
161
|
end
|
|
162
|
-
|
|
162
|
+
|
|
163
163
|
|
|
164
164
|
[key_name, field_names]
|
|
165
165
|
end
|
|
@@ -27,7 +27,7 @@ module Filtered
|
|
|
27
27
|
@value = value
|
|
28
28
|
@unsaved = []
|
|
29
29
|
|
|
30
|
-
case
|
|
30
|
+
case
|
|
31
31
|
when Hash === persistence
|
|
32
32
|
@persistence = persistence
|
|
33
33
|
when String === persistence
|
|
@@ -57,7 +57,7 @@ module Filtered
|
|
|
57
57
|
self
|
|
58
58
|
end.class_eval <<-EOC
|
|
59
59
|
def match_entry(key, entry)
|
|
60
|
-
value = entry[@fieldnum]
|
|
60
|
+
value = entry[@fieldnum]
|
|
61
61
|
value == @value or (Array === value and value.include? @value)
|
|
62
62
|
end
|
|
63
63
|
EOC
|
|
@@ -67,7 +67,7 @@ module Filtered
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def key
|
|
70
|
-
case
|
|
70
|
+
case
|
|
71
71
|
when String === value
|
|
72
72
|
value
|
|
73
73
|
else
|
|
@@ -162,7 +162,7 @@ module Filtered
|
|
|
162
162
|
if not base.respond_to? :unfiltered_set
|
|
163
163
|
class << base
|
|
164
164
|
attr_accessor :filter_dir, :filters
|
|
165
|
-
|
|
165
|
+
|
|
166
166
|
alias unfiltered_set []=
|
|
167
167
|
alias []= filtered_set
|
|
168
168
|
|
|
@@ -200,7 +200,7 @@ module Filtered
|
|
|
200
200
|
if filters.empty?
|
|
201
201
|
self.send(:unfiltered_set, key, value, clean)
|
|
202
202
|
else
|
|
203
|
-
filters.each do |filter|
|
|
203
|
+
filters.each do |filter|
|
|
204
204
|
filter.add key if filter.match_entry key, value
|
|
205
205
|
end
|
|
206
206
|
self.send(:unfiltered_set, key, value, clean)
|
|
@@ -215,10 +215,10 @@ module Filtered
|
|
|
215
215
|
end
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
-
def filtered_values
|
|
219
|
-
if filters.empty?
|
|
220
|
-
self.send(:unfiltered_values)
|
|
221
|
-
else
|
|
218
|
+
def filtered_values
|
|
219
|
+
if filters.empty?
|
|
220
|
+
self.send(:unfiltered_values)
|
|
221
|
+
else
|
|
222
222
|
ids = filters.inject(nil){|list,filter| list.nil? ? filter.ids.dup : Misc.intersect_sorted_arrays(list, filter.ids.dup)}
|
|
223
223
|
self.send :values_at, *ids
|
|
224
224
|
end
|
|
@@ -13,7 +13,7 @@ module TSV
|
|
|
13
13
|
field_values = values[field_pos]
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
new_values = case
|
|
16
|
+
new_values = case
|
|
17
17
|
when block.arity == 1
|
|
18
18
|
yield(field_values)
|
|
19
19
|
when block.arity == 2
|
|
@@ -54,7 +54,7 @@ module TSV
|
|
|
54
54
|
values = new_values
|
|
55
55
|
when (values.nil? and (fields.nil? or fields.empty?))
|
|
56
56
|
values = [new_values]
|
|
57
|
-
when values.nil?
|
|
57
|
+
when values.nil?
|
|
58
58
|
values = [nil] * fields.length + [new_values]
|
|
59
59
|
when Array === values
|
|
60
60
|
values += [new_values]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'matrix'
|
|
2
2
|
|
|
3
3
|
module TSV
|
|
4
|
-
def reorder(key_field = nil, fields = nil, merge: true, one2one: true, data: nil, unnamed: true, **kwargs)
|
|
4
|
+
def reorder(key_field = nil, fields = nil, merge: true, one2one: true, data: nil, unnamed: true, **kwargs)
|
|
5
5
|
res = data || self.annotate({})
|
|
6
6
|
res.type = kwargs[:type] if kwargs.include?(:type)
|
|
7
7
|
kwargs[:one2one] = one2one
|
|
@@ -61,7 +61,7 @@ module TSV
|
|
|
61
61
|
new = self.annotate({})
|
|
62
62
|
TSV.setup(new, :key_field => key_field, :fields => new_fields, :type => type, :filename => filename, :identifiers => identifiers)
|
|
63
63
|
|
|
64
|
-
m = Matrix.rows values
|
|
64
|
+
m = Matrix.rows values
|
|
65
65
|
new_rows = m.transpose.to_a
|
|
66
66
|
|
|
67
67
|
fields.zip(new_rows) do |key,row|
|
|
@@ -41,7 +41,7 @@ module TSV
|
|
|
41
41
|
if block_given?
|
|
42
42
|
field = method
|
|
43
43
|
field = fields.index?(field) if fields && String === field
|
|
44
|
-
case
|
|
44
|
+
case
|
|
45
45
|
when block.arity == 1
|
|
46
46
|
if (method == key_field or method == :key)
|
|
47
47
|
yield(key)
|
|
@@ -69,7 +69,7 @@ module TSV
|
|
|
69
69
|
new = TSV.setup({}, :key_field => key_field, :fields => fields, :type => type, :filename => filename, :identifiers => identifiers)
|
|
70
70
|
|
|
71
71
|
self.annotate(new)
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
case
|
|
74
74
|
when (method.nil? and block_given?)
|
|
75
75
|
through do |key, values|
|
|
@@ -101,7 +101,7 @@ module TSV
|
|
|
101
101
|
end
|
|
102
102
|
when ((String === method) || (Symbol === method))
|
|
103
103
|
if block_given?
|
|
104
|
-
case
|
|
104
|
+
case
|
|
105
105
|
when block.arity == 1
|
|
106
106
|
with_unnamed do
|
|
107
107
|
case
|
data/lib/scout/tsv/util/unzip.rb
CHANGED
|
@@ -20,7 +20,7 @@ module TSV
|
|
|
20
20
|
else
|
|
21
21
|
target
|
|
22
22
|
end
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
target.fields = new_fields
|
|
25
25
|
target.key_field = new_key_field
|
|
26
26
|
target.type = type
|
|
@@ -57,7 +57,7 @@ module TSV
|
|
|
57
57
|
[new_key, new_values]
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
MultipleResult.setup(res)
|
|
62
62
|
else
|
|
63
63
|
field_value = v[field_pos]
|
data/lib/scout/tsv/util.rb
CHANGED
|
@@ -129,7 +129,7 @@ module TSV
|
|
|
129
129
|
|
|
130
130
|
filename = @filename
|
|
131
131
|
filename = "No filename" if filename.nil? || String === filename && filename.empty?
|
|
132
|
-
filename.find if Path === filename
|
|
132
|
+
filename.find if Path === filename
|
|
133
133
|
filename = File.basename(filename) + " [" + File.basename(persistence_path) + "]" if respond_to?(:persistence_path) and persistence_path
|
|
134
134
|
|
|
135
135
|
with_unnamed do
|
data/lib/scout/tsv.rb
CHANGED
|
@@ -68,7 +68,7 @@ module TSV
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def self.str_setup(option_str, obj)
|
|
71
|
-
options = TSV.str2options(option_str)
|
|
71
|
+
options = TSV.str2options(option_str)
|
|
72
72
|
setup(obj, **options)
|
|
73
73
|
end
|
|
74
74
|
|
|
@@ -87,7 +87,7 @@ module TSV
|
|
|
87
87
|
|
|
88
88
|
file = StringIO.new file if String === file && ! (Path === file) && file.index("\n")
|
|
89
89
|
|
|
90
|
-
source_name, options =
|
|
90
|
+
source_name, options =
|
|
91
91
|
case file
|
|
92
92
|
when StringIO
|
|
93
93
|
[file.inspect, options]
|
|
@@ -22,6 +22,7 @@ class WorkQueue
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def clean
|
|
25
|
+
return if @cleaned
|
|
25
26
|
@cleaned = true
|
|
26
27
|
@sread.close unless @sread.closed?
|
|
27
28
|
@swrite.close unless @swrite.closed?
|
|
@@ -56,9 +57,9 @@ class WorkQueue
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
write_length = str.length
|
|
59
|
-
wrote = stream.write(str)
|
|
60
|
+
wrote = stream.write(str)
|
|
60
61
|
while wrote < write_length
|
|
61
|
-
wrote += stream.write(str[wrote..-1])
|
|
62
|
+
wrote += stream.write(str[wrote..-1])
|
|
62
63
|
end
|
|
63
64
|
end
|
|
64
65
|
|
|
@@ -41,10 +41,10 @@ class WorkQueue
|
|
|
41
41
|
while obj = input.read
|
|
42
42
|
if DoneProcessing === obj
|
|
43
43
|
output.write DoneProcessing.new
|
|
44
|
-
raise obj
|
|
44
|
+
raise obj
|
|
45
45
|
end
|
|
46
46
|
res = block.call obj
|
|
47
|
-
output.write res unless ignore_ouput || res == :ignore
|
|
47
|
+
output.write res unless ignore_ouput || res == :ignore
|
|
48
48
|
end
|
|
49
49
|
rescue DoneProcessing
|
|
50
50
|
rescue Interrupt
|
|
@@ -64,7 +64,7 @@ class WorkQueue
|
|
|
64
64
|
begin
|
|
65
65
|
Log.medium "Aborting worker #{worker_id}"
|
|
66
66
|
Process.kill SIGNAL, @pid
|
|
67
|
-
rescue Errno::ECHILD
|
|
67
|
+
rescue Errno::ECHILD
|
|
68
68
|
rescue Errno::ESRCH
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -77,7 +77,7 @@ class WorkQueue
|
|
|
77
77
|
def self.join(workers)
|
|
78
78
|
workers = [workers] unless Array === workers
|
|
79
79
|
begin
|
|
80
|
-
while pid = Process.wait
|
|
80
|
+
while pid = Process.wait
|
|
81
81
|
status = $?
|
|
82
82
|
worker = workers.select{|w| w.pid == pid }.first
|
|
83
83
|
end
|
data/lib/scout/work_queue.rb
CHANGED
|
@@ -62,7 +62,7 @@ class WorkQueue
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def process(&callback)
|
|
65
|
-
@workers.each do |w|
|
|
65
|
+
@workers.each do |w|
|
|
66
66
|
w.process @input, @output, &@worker_proc
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -126,10 +126,10 @@ class WorkQueue
|
|
|
126
126
|
t
|
|
127
127
|
end
|
|
128
128
|
exceptions = []
|
|
129
|
-
threads.each do |t|
|
|
129
|
+
threads.each do |t|
|
|
130
130
|
begin
|
|
131
|
-
t.join
|
|
132
|
-
rescue
|
|
131
|
+
t.join
|
|
132
|
+
rescue Exception
|
|
133
133
|
exceptions << $!
|
|
134
134
|
end
|
|
135
135
|
end
|
|
@@ -155,10 +155,10 @@ class WorkQueue
|
|
|
155
155
|
@aborted = true
|
|
156
156
|
Log.low "Aborting #{@workers.length} workers in queue #{queue_id}"
|
|
157
157
|
@worker_mutex.synchronize do
|
|
158
|
-
@workers.each do |w|
|
|
158
|
+
@workers.each do |w|
|
|
159
159
|
ScoutSemaphore.post_semaphore(@output.write_sem)
|
|
160
160
|
ScoutSemaphore.post_semaphore(@input.read_sem)
|
|
161
|
-
w.abort
|
|
161
|
+
w.abort
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
end
|
|
@@ -175,7 +175,7 @@ class WorkQueue
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
def clean
|
|
178
|
-
@waiter.join if @waiter
|
|
178
|
+
@waiter.join if @waiter && Thread.current != @waiter
|
|
179
179
|
@input.clean
|
|
180
180
|
@output.clean
|
|
181
181
|
end
|
|
@@ -123,7 +123,7 @@ module Workflow
|
|
|
123
123
|
block = lambda &self.method(name) if block.nil?
|
|
124
124
|
begin
|
|
125
125
|
@annotate_next_task ||= {}
|
|
126
|
-
@annotate_next_task[:extension] ||=
|
|
126
|
+
@annotate_next_task[:extension] ||=
|
|
127
127
|
case type
|
|
128
128
|
when :tsv
|
|
129
129
|
"tsv"
|
|
@@ -144,24 +144,24 @@ module Workflow
|
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
FORGET_TASK_ALIAS = begin
|
|
147
|
+
FORGET_TASK_ALIAS = begin
|
|
148
148
|
%w(SCOUT_FORGET_TASK_ALIAS SCOUT_FORGET_DEP_TASKS RBBT_FORGET_DEP_TASKS).select do |var|
|
|
149
149
|
ENV[var] == 'true'
|
|
150
150
|
end.any?
|
|
151
151
|
end
|
|
152
|
-
REMOVE_TASK_ALIAS = begin
|
|
152
|
+
REMOVE_TASK_ALIAS = begin
|
|
153
153
|
remove = %w(SCOUT_REMOVE_TASK_ALIAS SCOUT_REMOVE_DEP_TASKS RBBT_REMOVE_DEP_TASKS).select do |var|
|
|
154
154
|
ENV.include?(var) && ENV[var] != 'false'
|
|
155
155
|
end.first
|
|
156
156
|
remove.nil? ? false : remove
|
|
157
157
|
end
|
|
158
158
|
def task_alias(name, workflow, oname, *rest, &block)
|
|
159
|
-
dep(workflow, oname, *rest, &block)
|
|
159
|
+
dep(workflow, oname, *rest, &block)
|
|
160
160
|
extension :dep_task unless @extension
|
|
161
161
|
task_proc = workflow.tasks[oname] if workflow.tasks
|
|
162
162
|
if task_proc
|
|
163
163
|
returns task_proc.returns if @returns.nil?
|
|
164
|
-
type = task_proc.type
|
|
164
|
+
type = task_proc.type
|
|
165
165
|
end
|
|
166
166
|
task name => type do
|
|
167
167
|
raise ScoutException, "dep_task does not have any dependencies" if dependencies.empty?
|
|
@@ -187,25 +187,27 @@ module Workflow
|
|
|
187
187
|
Open.rm_rf self.files_dir if Open.exist? self.files_dir
|
|
188
188
|
Open.link_dir dep.files_dir, self.files_dir if Open.exist?(dep.files_dir)
|
|
189
189
|
|
|
190
|
-
if dep.overriden?
|
|
190
|
+
if dep.overriden? || dep.overrider?
|
|
191
191
|
Open.link dep.path, self.tmp_path
|
|
192
192
|
else
|
|
193
193
|
Open.ln_h dep.path, self.tmp_path
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
195
|
+
if Open.exists?(dep.info_file)
|
|
196
|
+
case remove.to_s
|
|
197
|
+
when 'true'
|
|
198
|
+
dep.clean
|
|
199
|
+
when 'recursive'
|
|
200
|
+
(dep.dependencies.to_a + dep.rec_dependencies.to_a).uniq.each do |d|
|
|
201
|
+
next if d.overriden
|
|
202
|
+
d.clean unless Scout::Config.get(:remove_dep, "task:#{d.task_signature}", "task:#{d.task_name}", "workflow:#{d.workflow.name}", :default => true).to_s == 'false'
|
|
203
|
+
end
|
|
204
|
+
dep.clean unless Scout::Config.get(:remove_dep, "task:#{dep.task_signature}", "task:#{dep.task_name}", "workflow:#{dep.workflow.name}", :default => true).to_s == 'false'
|
|
202
205
|
end
|
|
203
|
-
|
|
204
|
-
end
|
|
206
|
+
end
|
|
205
207
|
end
|
|
206
208
|
else
|
|
207
209
|
if Open.exists?(dep.files_dir)
|
|
208
|
-
Open.rm_rf self.files_dir
|
|
210
|
+
Open.rm_rf self.files_dir
|
|
209
211
|
Open.link dep.files_dir, self.files_dir
|
|
210
212
|
end
|
|
211
213
|
if defined?(RemoteStep) && RemoteStep === dep
|