scout-gear 10.7.1 → 10.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +6 -0
  3. data/VERSION +1 -1
  4. data/lib/scout/association/index.rb +1 -1
  5. data/lib/scout/association.rb +21 -5
  6. data/lib/scout/entity/format.rb +9 -4
  7. data/lib/scout/entity/identifiers.rb +2 -2
  8. data/lib/scout/entity/named_array.rb +13 -0
  9. data/lib/scout/entity/property.rb +2 -1
  10. data/lib/scout/entity.rb +7 -4
  11. data/lib/scout/persist/tsv/adapter/base.rb +13 -1
  12. data/lib/scout/persist/tsv.rb +2 -1
  13. data/lib/scout/tsv/attach.rb +10 -2
  14. data/lib/scout/tsv/change_id.rb +3 -0
  15. data/lib/scout/tsv/dumper.rb +34 -30
  16. data/lib/scout/tsv/open.rb +1 -0
  17. data/lib/scout/tsv/parser.rb +21 -10
  18. data/lib/scout/tsv/path.rb +8 -0
  19. data/lib/scout/tsv/stream.rb +15 -8
  20. data/lib/scout/tsv/traverse.rb +12 -2
  21. data/lib/scout/tsv/util/process.rb +4 -1
  22. data/lib/scout/tsv/util/select.rb +8 -2
  23. data/lib/scout/tsv/util/sort.rb +23 -15
  24. data/lib/scout/tsv/util.rb +11 -2
  25. data/lib/scout/tsv.rb +23 -11
  26. data/lib/scout/workflow/definition.rb +3 -3
  27. data/lib/scout/workflow/deployment/orchestrator.rb +8 -5
  28. data/lib/scout/workflow/step/dependencies.rb +35 -11
  29. data/lib/scout/workflow/step/file.rb +2 -1
  30. data/lib/scout/workflow/step/info.rb +14 -2
  31. data/lib/scout/workflow/step/load.rb +5 -3
  32. data/lib/scout/workflow/step/progress.rb +6 -0
  33. data/lib/scout/workflow/step/provenance.rb +1 -1
  34. data/lib/scout/workflow/step/status.rb +10 -4
  35. data/lib/scout/workflow/step.rb +32 -12
  36. data/lib/scout/workflow/task/dependencies.rb +33 -24
  37. data/lib/scout/workflow/task/inputs.rb +40 -12
  38. data/lib/scout/workflow/task.rb +22 -10
  39. data/lib/scout/workflow/usage.rb +2 -2
  40. data/lib/scout/workflow.rb +1 -1
  41. data/scout-gear.gemspec +10 -4
  42. data/scout_commands/db/query +83 -0
  43. data/scout_commands/db/register +43 -0
  44. data/scout_commands/db/show +47 -0
  45. data/test/scout/entity/test_named_array.rb +21 -0
  46. data/test/scout/persist/test_tsv.rb +20 -0
  47. data/test/scout/persist/tsv/adapter/test_base.rb +20 -0
  48. data/test/scout/test_tsv.rb +40 -0
  49. data/test/scout/tsv/test_dumper.rb +24 -0
  50. data/test/scout/tsv/test_path.rb +24 -0
  51. data/test/scout/tsv/test_stream.rb +93 -0
  52. data/test/scout/tsv/test_traverse.rb +99 -0
  53. data/test/scout/tsv/test_util.rb +2 -0
  54. data/test/scout/tsv/util/test_select.rb +22 -0
  55. data/test/scout/tsv/util/test_sort.rb +24 -0
  56. data/test/scout/workflow/step/test_dependencies.rb +26 -0
  57. data/test/scout/workflow/step/test_info.rb +35 -0
  58. data/test/scout/workflow/task/test_dependencies.rb +67 -1
  59. data/test/scout/workflow/task/test_inputs.rb +24 -7
  60. data/test/scout/workflow/test_task.rb +36 -0
  61. data/test/scout/workflow/test_usage.rb +0 -1
  62. metadata +9 -3
@@ -387,4 +387,44 @@ row2 A B Id3
387
387
  tsv = TSV.open(filename, :sep => /\s+/, :identifiers => Scout.share.identifiers)
388
388
  end
389
389
  end
390
+
391
+ def test_identifier_file_auto
392
+ content =<<-EOF
393
+ #Id ValueA ValueB OtherID
394
+ row1 a|aa|aaa b Id1|Id2
395
+ row2 A B Id3
396
+ EOF
397
+
398
+ ids =<<-EOF
399
+ #Id Alias
400
+ row1 r1
401
+ row2 r2
402
+ EOF
403
+
404
+ TmpFile.with_dir do |dir|
405
+ Path.setup(dir)
406
+ Open.write(dir.tsv_file, content)
407
+ Open.write(dir.identifiers, ids)
408
+ tsv = TSV.open(dir.tsv_file)
409
+ assert_equal dir.identifiers, tsv.identifiers
410
+ end
411
+ end
412
+
413
+ def test_single_field
414
+ content =<<-EOF
415
+ #Id ValueA ValueB OtherID
416
+ row1 a|aa|aaa b Id1|Id2
417
+ row2 A B Id3
418
+ EOF
419
+
420
+ TmpFile.with_file(content) do |filename|
421
+ tsv = TSV.open(filename, :sep => /\s+/, field: "ValueB")
422
+ assert_equal "b", tsv["row1"]
423
+ end
424
+
425
+ TmpFile.with_file(content) do |filename|
426
+ tsv = TSV.open(filename, :sep => /\s+/, field: "ValueA", type: :flat)
427
+ assert_equal %w(a aa aaa), tsv["row1"]
428
+ end
429
+ end
390
430
  end
@@ -78,5 +78,29 @@ b\t2|22\t3|33
78
78
  assert tsv2.filename
79
79
  end
80
80
 
81
+ def test_compact
82
+ dumper = TSV::Dumper.new :key_field => "Key", :fields => %w(Field1 Field2), :type => :double, compact: true
83
+ dumper.init
84
+ t = Thread.new do
85
+ dumper.add "a", [["1", "11"], ["2", "22"]]
86
+ dumper.add "b", [[nil, nil], ["3", "33"]]
87
+ dumper.close
88
+ end
89
+
90
+ tsv = TSV.open(dumper.stream)
91
+ assert_equal [], tsv["b"]["Field1"]
92
+
93
+ dumper = TSV::Dumper.new :key_field => "Key", :fields => %w(Field1 Field2), :type => :double, compact: false
94
+ dumper.init
95
+ t = Thread.new do
96
+ dumper.add "a", [["1", "11"], ["2", "22"]]
97
+ dumper.add "b", [[nil, nil], ["3", "33"]]
98
+ dumper.close
99
+ end
100
+
101
+ tsv = TSV.open(dumper.stream)
102
+ assert_equal ["", ""], tsv["b"]["Field1"]
103
+ end
104
+
81
105
  end
82
106
 
@@ -0,0 +1,24 @@
1
+ require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
+ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
3
+
4
+ class TestTsvPath < Test::Unit::TestCase
5
+ def test_tsv_open_persist
6
+ content =<<-'EOF'
7
+ #Id ValueA ValueB OtherID
8
+ row1 a|aa|aaa b Id1|Id2
9
+ row2 A B Id3
10
+ row2 a a id3
11
+ EOF
12
+
13
+
14
+ tsv = nil
15
+ TmpFile.with_file(content) do |filename|
16
+ Path.setup(filename)
17
+ tsv = filename.tsv persist: true, merge: true, type: :list, sep: /\s+/
18
+ assert_equal %w(ValueA ValueB OtherID), tsv.fields
19
+ tsv = filename.tsv persist: true, merge: true, type: :list, sep: /\s+/
20
+ assert_equal %w(ValueA ValueB OtherID), tsv.fields
21
+ end
22
+ end
23
+ end
24
+
@@ -218,5 +218,98 @@ row2\tBB
218
218
  assert_equal ["AAA"], tsv["row3"][0]
219
219
  end
220
220
 
221
+ def test_concat_4_streams
222
+
223
+ text1=<<-EOF
224
+ #Key\tValueA
225
+ row1\tA
226
+ row2\tAA
227
+ EOF
228
+
229
+ text2=<<-EOF
230
+ #Key\tValueA
231
+ row3\tAAA
232
+ row2\tBB
233
+ EOF
234
+
235
+ text3=<<-EOF
236
+ #Key\tValueA
237
+ row4\tAAA
238
+ row5\tBB
239
+ EOF
240
+
241
+ text4=<<-EOF
242
+ #Key\tValueA
243
+ row6\tAAA
244
+ row7\tBB
245
+ EOF
246
+
247
+ s1 = StringIO.new text1
248
+ s2 = StringIO.new text2
249
+ s3 = StringIO.new text3
250
+ s4 = StringIO.new text4
251
+ tsv = TSV.open TSV.concat_streams([s1,s2,s3,s4]), :merge => true
252
+ assert_equal ["A"], tsv["row1"][0]
253
+ assert_equal ["AA","BB"], tsv["row2"][0]
254
+ assert_equal ["AAA"], tsv["row3"][0]
255
+ assert_equal ["BB"], tsv["row7"][0]
256
+ end
257
+
258
+
259
+ def test_paste_streams_repeat
260
+ text1=<<-EOF
261
+ YHR055C 856452|856450 YHR055C|YHR055C
262
+ YPR161C 856290 YPR161C
263
+ YOL138C 853982 YOL138C
264
+ YDR395W 852004 YDR395W
265
+ YGR129W 853030 YGR129W
266
+ YPR165W 856294 YPR165W
267
+ YPR098C 856213 YPR098C
268
+ YPL015C 856092 YPL015C
269
+ YCL050C 850307 YCL050C
270
+ YAL069W YAL069W
271
+ EOF
272
+
273
+ text2=<<-EOF
274
+ YHR055C CUP1-2 AAA34541
275
+ YHR055C CUP1-2 AAB68382
276
+ YHR055C CUP1-2 AAS56843
277
+ YHR055C CUP1-2 DAA06748
278
+ YHR055C CUP1-2 AAB68384
279
+ YHR055C CUP1-2 AAT93096
280
+ YHR055C CUP1-2 DAA06746
281
+ YPR161C SGV1 BAA14347
282
+ YPR161C SGV1 AAB59314
283
+ YPR161C SGV1 AAB68058
284
+ EOF
285
+
286
+ s1 = StringIO.new text1
287
+ s2 = StringIO.new text2
288
+ tsv = TSV.open(TSV.paste_streams([s1,s2], sort:true, one2one: false), merge: true, one2one: false)
289
+ assert_equal 2, tsv["YHR055C"][0].length
290
+ assert_equal %w(SGV1) * 3, tsv["YPR161C"][2]
291
+ end
292
+
293
+ def test_paste_stream_flat
294
+ text1=<<-EOF
295
+ #: :sep=" "
296
+ #Row LabelA LabelB LabelC
297
+ row1 A B C
298
+ row2 AA BB CC
299
+ row3 AAA BBB CCC
300
+ EOF
301
+
302
+ text2=<<-EOF
303
+ #: :sep=" "#:type=:flat
304
+ #Row Flat
305
+ row1 f1 f2 f3
306
+ EOF
307
+
308
+
309
+ s1 = StringIO.new text1
310
+ s2 = StringIO.new text2
311
+ tsv = TSV.open TSV.paste_streams([s1,s2], :sep => " ", :type => :double)
312
+ assert_include tsv["row1"], %w(f1 f2 f3)
313
+ end
221
314
  end
222
315
 
@@ -275,5 +275,104 @@ row3 a
275
275
  assert_equal %w(a aa aaa), data["row1"]
276
276
  end
277
277
  end
278
+
279
+ def test_traverse_entity_list
280
+ m = Module.new do
281
+ extend Entity
282
+ self.format = "ValueA"
283
+ end
284
+
285
+ content =<<-EOF
286
+ #Id ValueA
287
+ row1 a
288
+ row2 A
289
+ row3 a
290
+ EOF
291
+
292
+ TmpFile.with_file(content) do |filename|
293
+ tsv = TSV.open(File.open(filename), :sep => /\s+/, :type => :list)
294
+ data = {}
295
+ k, f = tsv.traverse "Id", ["ValueA"] do |k,v|
296
+ data[k] = v
297
+ end
298
+ assert_equal %w(a), data["row1"]
299
+ assert Annotation::AnnotatedObject === data["row1"]
300
+ end
301
+ end
302
+
303
+ def test_traverse_entity_double
304
+ m = Module.new do
305
+ extend Entity
306
+ self.format = "ValueA"
307
+ end
308
+
309
+ content =<<-EOF
310
+ #Id ValueA
311
+ row1 a|aa|aaa
312
+ row2 A
313
+ row3 a
314
+ EOF
315
+
316
+ TmpFile.with_file(content) do |filename|
317
+ tsv = TSV.open(File.open(filename), :sep => /\s+/)
318
+ data = {}
319
+ k, f = tsv.traverse "Id", ["ValueA"] do |k,v|
320
+ data[k] = v
321
+ end
322
+ assert_equal %w(a aa aaa), data["row1"][0]
323
+ assert NamedArray === data["row1"]
324
+ assert AnnotatedArray === data["row1"]["ValueA"]
325
+ end
326
+ end
327
+
328
+
329
+ def test_traverse_entity_flat
330
+ m = Module.new do
331
+ extend Entity
332
+ self.format = "ValueA"
333
+ end
334
+
335
+ content =<<-EOF
336
+ #Id ValueA
337
+ row1 a aa aaa
338
+ row2 A
339
+ row3 a
340
+ EOF
341
+
342
+ TmpFile.with_file(content) do |filename|
343
+ tsv = TSV.open(File.open(filename), :sep => /\s+/, :type => :flat)
344
+ data = {}
345
+ k, f = tsv.traverse "Id", ["ValueA"] do |k,v|
346
+ data[k] = v
347
+ end
348
+ assert_equal %w(a aa aaa), data["row1"]
349
+ assert AnnotatedArray === data["row1"]
350
+ assert Annotation::AnnotatedObject === data["row1"][0]
351
+ end
352
+ end
353
+
354
+ def test_traverse_entity_single
355
+ m = Module.new do
356
+ extend Entity
357
+ self.format = "ValueA"
358
+ end
359
+
360
+ content =<<-EOF
361
+ #Id ValueA
362
+ row1 a
363
+ row2 A
364
+ row3 a
365
+ EOF
366
+
367
+ TmpFile.with_file(content) do |filename|
368
+ tsv = TSV.open(File.open(filename), :sep => /\s+/, :type => :single)
369
+ data = {}
370
+ k, f = tsv.traverse "Id", ["ValueA"] do |k,v|
371
+ data[k] = v
372
+ end
373
+ assert_equal "a", data["row1"]
374
+ assert Annotation::AnnotatedObject === data["row1"]
375
+ end
376
+ end
278
377
  end
279
378
 
@@ -16,6 +16,8 @@ row2 a a id3
16
16
  TSV.open(filename, :sep => " " )
17
17
  end
18
18
  assert_equal %w(row1 row2), tsv.collect{|k,v| k }
19
+ refute NamedArray === tsv.collect{|k,v| v }.first
20
+ tsv.unnamed = false
19
21
  assert NamedArray === tsv.collect{|k,v| v }.first
20
22
  assert "row1", tsv["row1"].key
21
23
  end
@@ -23,6 +23,28 @@ row2 AA BB Id33
23
23
  assert_equal ['row2'], s.keys
24
24
  end
25
25
 
26
+ def test_select_invert
27
+ content =<<-'EOF'
28
+ #: :sep=/\s+/#:type=:double
29
+ #Id ValueA ValueB OtherID
30
+ row1 a|aa|aaa b Id1|Id2
31
+ row2 A B Id3
32
+ row2 AA BB Id33
33
+ EOF
34
+
35
+ tsv = TmpFile.with_file(content) do |filename|
36
+ TSV.open(filename, :persist => true)
37
+ end
38
+
39
+ s = tsv.select("ValueA" => 'a')
40
+
41
+ assert_equal ['row1'], s.keys
42
+
43
+ s = tsv.select({"ValueA" => 'a'}, true)
44
+
45
+ assert_equal ['row2'], s.keys
46
+ end
47
+
26
48
  def test_select_values
27
49
  content =<<-'EOF'
28
50
  #: :sep=" "
@@ -46,5 +46,29 @@ row2 A b C
46
46
  assert_equal %w(row1 row2), tsv.sort("ValueB"){|a,b| a[1] <=> b[1] }.collect{|k,v| k}
47
47
  end
48
48
  end
49
+
50
+ def test_sort_entity
51
+ content =<<-EOF
52
+ #ID ValueA ValueB Comment NumericValue
53
+ row1 a B c 20
54
+ row2 A b C 100
55
+ row3 A b C 3
56
+ EOF
57
+
58
+ m = Module.new do
59
+ extend Entity
60
+ self.format = "NumericValue"
61
+
62
+ def <=>(b)
63
+ self.to_f <=> b.to_f
64
+ end
65
+ end
66
+
67
+
68
+ TmpFile.with_file(content) do |filename|
69
+ tsv = TSV.open(File.open(filename), :type => :list, :sep => /\s/)
70
+ assert_equal %w(row3 row1 row2), tsv.sort("NumericValue", true)
71
+ end
72
+ end
49
73
  end
50
74
 
@@ -89,5 +89,31 @@ class TestStepDependencies < Test::Unit::TestCase
89
89
  end
90
90
  end
91
91
  end
92
+
93
+ def test_recursive_inputs_priority
94
+ tmpfile = tmpdir.test_step
95
+ step1 = Step.new tmpfile.step1, NamedArray.setup(["1"], %w(input1)) do |s|
96
+ s.length
97
+ end
98
+
99
+ step2 = Step.new tmpfile.step2, NamedArray.setup(["2"], %w(input1)) do |times|
100
+ step1 = dependencies.first
101
+ (step1.inputs.first + " has " + step1.load.to_s + " characters") * times
102
+ end
103
+
104
+ step3 = Step.new tmpfile.step2, NamedArray.setup([], %w()) do |times|
105
+ step1 = dependencies.first
106
+ (step1.inputs.first + " has " + step1.load.to_s + " characters") * times
107
+ end
108
+
109
+
110
+ step2.dependencies = [step1]
111
+
112
+ step3.dependencies = [step1, step2]
113
+
114
+ assert_equal "2", step2.inputs["input1"]
115
+ assert_equal "2", step2.recursive_inputs["input1"]
116
+ assert_equal "1", step3.recursive_inputs["input1"]
117
+ end
92
118
  end
93
119
 
@@ -58,4 +58,39 @@ class TestStepInfo < Test::Unit::TestCase
58
58
  assert_equal %w(Message1 Message2), step1.messages
59
59
  end
60
60
  end
61
+
62
+ def test_overriden_fixed
63
+ TmpFile.with_file("HELLO") do |file|
64
+ wf = Module.new do
65
+ extend Workflow
66
+
67
+ self.name = "TestWF"
68
+
69
+ task :message => :string do
70
+ "HI"
71
+ end
72
+
73
+ dep :message
74
+ task :say => :string do
75
+ "I say #{step(:message).load}"
76
+ end
77
+
78
+ task_alias :say_hello, self, :say, "TestWF#message" => file, :not_overriden => true
79
+ end
80
+
81
+ assert_equal "I say HI", wf.job(:say).run
82
+
83
+ job1 = wf.job(:say, "TestWF#message" => file)
84
+ assert_equal "I say HELLO", job1.run
85
+
86
+ job2 = wf.job(:say_hello)
87
+ assert_equal "I say HELLO", job2.run
88
+
89
+ assert job1.overriden?
90
+ refute job2.overriden?
91
+
92
+ assert job1.overriden_deps.any?
93
+ refute job2.overriden_deps.any?
94
+ end
95
+ end
61
96
  end
@@ -353,5 +353,71 @@ class TestTaskDependencies < Test::Unit::TestCase
353
353
  assert_equal "0", wf.job(:step2, :input1 => "-2").run
354
354
  end
355
355
 
356
- end
356
+ def test_jobname_input
357
+ wf = Workflow.annonymous_workflow "JobnameInput" do
358
+ input :input1, :string, "", nil, jobname: true
359
+ task :step1 => :string do |i1|
360
+ i1
361
+ end
362
+
363
+ input :input2, :string, "", "Hi"
364
+ dep :step1 do |jobname,options|
365
+ {jobname: options[:input2]}
366
+ end
367
+ task :step2 do
368
+ step(:step1).load
369
+ end
370
+ end
371
+
372
+ assert_equal "Hi", wf.job(:step2).run.strip
373
+ assert_equal "Hello", wf.job(:step2, input2: "Hello").run.strip
357
374
 
375
+ job = wf.job(:step2, input1: "Hello")
376
+ assert_equal "Hello", job.run
377
+ assert_equal "Default", job.clean_name
378
+ assert_equal "Hi", job.step(:step1).clean_name
379
+ end
380
+
381
+ def test_jobname_input_reset
382
+ wf = Workflow.annonymous_workflow "JobnameInput" do
383
+ input :input1, :string, "", nil, jobname: true
384
+ task :step1 => :string do |i1|
385
+ i1
386
+ end
387
+
388
+ input :input2, :string, "", "Hi", jobname: true
389
+ dep :step1, input1: "Name1", jobname: nil do |jobname,options|
390
+ {inputs: options}
391
+ end
392
+ task :step2 do
393
+ step(:step1).load
394
+ end
395
+
396
+ end
397
+
398
+ job = wf.job(:step2, input2: "Name2")
399
+ assert_equal "Name2", job.clean_name
400
+ assert_equal "Name1", job.step(:step1).clean_name
401
+ assert_equal "Name", wf.job(:step1, input1: "Name").clean_name
402
+ end
403
+
404
+ def test_non_default_inputs_ignore_hidden
405
+ wf = Workflow.annonymous_workflow "JobnameInput" do
406
+ input :input1, :string, "", nil, jobname: true
407
+ task :step1 => :string do |i1|
408
+ i1
409
+ end
410
+
411
+ dep :step1, jobname: nil, input1: :placeholder do |jobname,options|
412
+ {inputs: options.merge(input1: "TEST") }
413
+ end
414
+ task :step2 do
415
+ step(:step1).load
416
+ end
417
+
418
+ end
419
+
420
+ job = wf.job(:step2, input2: "Name2")
421
+ assert job.non_default_inputs.empty?
422
+ end
423
+ end
@@ -36,17 +36,17 @@ class TestTaskInput < Test::Unit::TestCase
36
36
  def test_assign_inputs
37
37
  task = self.example_task
38
38
 
39
- assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => %w(1 2)).last
39
+ assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => %w(1 2))[1]
40
40
 
41
41
  TmpFile.with_file("1\n2") do |integer_array_file|
42
- assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => integer_array_file).last
42
+ assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => integer_array_file)[1]
43
43
  end
44
44
  end
45
45
 
46
46
  def test_boolean
47
47
  task = self.example_task
48
48
 
49
- assert_equal [:boolean], task.assign_inputs(:string => "String", :integer => 1, :boolean => true).last
49
+ assert_equal [:boolean], task.assign_inputs(:string => "String", :integer => 1, :boolean => true)[1]
50
50
 
51
51
  TmpFile.with_file("1\n2") do |integer_array_file|
52
52
  Open.open(integer_array_file) do |f|
@@ -60,7 +60,7 @@ class TestTaskInput < Test::Unit::TestCase
60
60
  def test_keep_stream
61
61
  task = self.example_task
62
62
 
63
- assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => %w(1 2)).last
63
+ assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => %w(1 2))[1]
64
64
 
65
65
  TmpFile.with_file("1\n2") do |integer_array_file|
66
66
  Open.open(integer_array_file) do |f|
@@ -76,15 +76,15 @@ class TestTaskInput < Test::Unit::TestCase
76
76
  task = self.example_task
77
77
 
78
78
  TmpFile.with_file("2\n3") do |integer_array_file|
79
- assert_equal task.process_inputs(:string => "String", :integer => 2, :integer_array => %w(2 3)).last,
80
- task.process_inputs(:string => "String", :integer => 2, :integer_array => integer_array_file).last
79
+ assert_equal task.process_inputs(:string => "String", :integer => 2, :integer_array => %w(2 3))[1],
80
+ task.process_inputs(:string => "String", :integer => 2, :integer_array => integer_array_file)[1]
81
81
  end
82
82
  end
83
83
 
84
84
  def test_digest_stream
85
85
  task = self.example_task
86
86
 
87
- assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => %w(1 2)).last
87
+ assert_equal [:integer], task.assign_inputs(:string => "String", :integer => 2, :integer_array => %w(1 2))[1]
88
88
 
89
89
  TmpFile.with_file("1\n2") do |integer_array_file|
90
90
  hash1 = Open.open(integer_array_file) do |f|
@@ -271,4 +271,21 @@ class TestTaskInput < Test::Unit::TestCase
271
271
 
272
272
  assert w.tasks[:repeat_salute_miguel].recursive_inputs.empty?
273
273
  end
274
+
275
+ def test_jobname
276
+ w = Module.new do
277
+ extend Workflow
278
+
279
+ self.name = "SaluteWF"
280
+
281
+ input :name, :string, "Name", "Peter", jobname: true
282
+ task :salute => :string do |name|
283
+ "Hi #{name}"
284
+ end
285
+
286
+ end
287
+
288
+ assert_equal [["Paul"], [:name], nil], w.tasks[:salute].assign_inputs({}, "Paul")
289
+ assert_equal [["Paul"], [:name], :name], w.tasks[:salute].assign_inputs({name: "Paul"}, "Paul")
290
+ end
274
291
  end
@@ -47,4 +47,40 @@ class TestTask < Test::Unit::TestCase
47
47
  wf.job(:task_499)
48
48
  end
49
49
  end
50
+
51
+ def test_dependencies_jobname_input
52
+ wf = Module.new do
53
+ extend Workflow
54
+ self.name = "TestWF"
55
+
56
+ input :name, :string, "Name", nil, jobname: true
57
+ task :step1 => :string do |name|
58
+ name
59
+ end
60
+
61
+ dep :step1
62
+ task :step2 => :string do
63
+ step(:step1).load
64
+ end
65
+
66
+ dep :step1, jobname: nil
67
+ task :step3 => :string do
68
+ step(:step1).load
69
+ end
70
+ end
71
+
72
+ Log.with_severity 0 do
73
+ job = wf.job(:step2, nil, name: "Name")
74
+ assert_equal "Name", job.run
75
+ assert_equal "Name", job.step(:step1).name
76
+ job = wf.job(:step2, "Name2", name: "Name")
77
+ assert_equal "Name", job.run
78
+ assert_equal "Name2", job.step(:step1).clean_name
79
+ job = wf.job(:step3, "Name2", name: "Name")
80
+ assert_equal "Name", job.run
81
+ assert_equal "Name", job.step(:step1).name
82
+
83
+ assert_equal "Name", wf.job(:step1, "Test", name: "Name").inputs[:name]
84
+ end
85
+ end
50
86
  end
@@ -39,7 +39,6 @@ class TestWorkflowUsage < Test::Unit::TestCase
39
39
  end
40
40
  end
41
41
 
42
-
43
42
  def test_workflow_usage
44
43
  assert_match "evaluate if the documentation", UsageWorkflow.usage
45
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-gear
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.7.1
4
+ version: 10.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-01 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: scout-essentials
@@ -153,6 +153,7 @@ files:
153
153
  - lib/scout/entity.rb
154
154
  - lib/scout/entity/format.rb
155
155
  - lib/scout/entity/identifiers.rb
156
+ - lib/scout/entity/named_array.rb
156
157
  - lib/scout/entity/object.rb
157
158
  - lib/scout/entity/property.rb
158
159
  - lib/scout/offsite.rb
@@ -233,6 +234,9 @@ files:
233
234
  - scout_commands/alias
234
235
  - scout_commands/batch/clean
235
236
  - scout_commands/batch/list
237
+ - scout_commands/db/query
238
+ - scout_commands/db/register
239
+ - scout_commands/db/show
236
240
  - scout_commands/doc
237
241
  - scout_commands/find
238
242
  - scout_commands/glob
@@ -263,6 +267,7 @@ files:
263
267
  - test/scout/association/test_item.rb
264
268
  - test/scout/entity/test_format.rb
265
269
  - test/scout/entity/test_identifiers.rb
270
+ - test/scout/entity/test_named_array.rb
266
271
  - test/scout/entity/test_object.rb
267
272
  - test/scout/entity/test_property.rb
268
273
  - test/scout/offsite/test_ssh.rb
@@ -300,6 +305,7 @@ files:
300
305
  - test/scout/tsv/test_index.rb
301
306
  - test/scout/tsv/test_open.rb
302
307
  - test/scout/tsv/test_parser.rb
308
+ - test/scout/tsv/test_path.rb
303
309
  - test/scout/tsv/test_stream.rb
304
310
  - test/scout/tsv/test_transformer.rb
305
311
  - test/scout/tsv/test_traverse.rb
@@ -353,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
359
  - !ruby/object:Gem::Version
354
360
  version: '0'
355
361
  requirements: []
356
- rubygems_version: 3.5.10
362
+ rubygems_version: 3.5.23
357
363
  signing_key:
358
364
  specification_version: 4
359
365
  summary: basic gear for scouts