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
@@ -15,22 +15,218 @@ class TestWorkflowStep < Test::Unit::TestCase
15
15
  end
16
16
 
17
17
  def test_dependency
18
- Log.with_severity 0 do
19
- tmpfile = tmpdir.test_step
20
- step1 = Step.new tmpfile.step1, ["12"] do |s|
21
- s.length
18
+ tmpfile = tmpdir.test_step
19
+ step1 = Step.new tmpfile.step1, ["12"] do |s|
20
+ s.length
21
+ end
22
+
23
+ step2 = Step.new tmpfile.step2 do
24
+ step1 = dependencies.first
25
+ step1.inputs.first + " has " + step1.load.to_s + " characters"
26
+ end
27
+
28
+ step2.dependencies = [step1]
29
+
30
+ assert_equal "12 has 2 characters", step2.run
31
+ assert_equal "12 has 2 characters", step2.run
32
+ end
33
+
34
+ def test_streaming
35
+ tmpfile = tmpdir.test_step
36
+
37
+ times = 10_000
38
+ sleep = 1 / times
39
+
40
+ step1 = Step.new tmpfile.step1, [times, sleep] do |times,sleep|
41
+ Open.open_pipe do |sin|
42
+ times.times do |i|
43
+ sin.puts "line-#{i}"
44
+ sleep sleep
45
+ end
46
+ end
47
+ end
48
+ step1.type = :array
49
+
50
+ step2 = Step.new tmpfile.step2 do
51
+ step1 = dependencies.first
52
+ stream = step1.stream
53
+
54
+ Open.open_pipe do |sin|
55
+ while line = stream.gets
56
+ num = line.split("-").last
57
+ next if num.to_i % 2 == 1
58
+ sin.puts line
59
+ end
60
+ end
61
+ end
62
+ step2.type = :array
63
+ step2.dependencies = [step1]
64
+
65
+ step1.run
66
+ step1.join
67
+ assert step1.path.read.end_with? "line-#{times-1}\n"
68
+
69
+ step1.clean
70
+
71
+ stream = step2.exec
72
+ lines = []
73
+ while line = stream.gets
74
+ lines << line
75
+ end
76
+ assert_equal times/2, lines.length
77
+
78
+ stream = step2.run
79
+ assert step1.streaming?
80
+ assert step2.streaming?
81
+
82
+ lines = []
83
+ while line = stream.gets
84
+ lines << line
85
+ end
86
+
87
+ assert step1.path.read.end_with? "line-#{times-1}\n"
88
+ assert_equal times/2, lines.length
89
+ assert_equal times/2, step2.join.path.read.split("\n").length
90
+ end
91
+
92
+ def test_streaming_duplicate
93
+ tmpfile = tmpdir.test_step
94
+
95
+ times = 10_000
96
+ sleep = 0.01 / times
97
+
98
+ step1 = Step.new tmpfile.step1, [times, sleep] do |times,sleep|
99
+ Open.open_pipe do |sin|
100
+ times.times do |i|
101
+ sin.puts "line-#{i}"
102
+ sleep sleep
103
+ end
104
+ end
105
+ end
106
+ step1.type = :array
107
+
108
+ step2 = Step.new tmpfile.step2 do
109
+ step1 = dependencies.first
110
+ stream = step1.stream
111
+
112
+ Open.open_pipe do |sin|
113
+ while line = stream.gets
114
+ num = line.split("-").last
115
+ next if num.to_i % 2 == 1
116
+ sin.puts line
117
+ end
22
118
  end
119
+ end
120
+ step2.type = :array
121
+ step2.dependencies = [step1]
23
122
 
24
- step2 = Step.new tmpfile.step2 do
25
- step1 = dependencies.first
26
- step1.inputs.first + " has " + step1.load.to_s + " characters"
123
+ step3 = Step.new tmpfile.step3 do
124
+ step1, step2 = dependencies
125
+ stream = step2.stream
126
+
127
+ Open.open_pipe do |sin|
128
+ while line = stream.gets
129
+ num = line.split("-").last
130
+ next if num.to_i % 2 == 1
131
+ sin.puts line
132
+ end
27
133
  end
134
+ end
135
+ step3.type = :array
136
+ step3.dependencies = [step1, step2]
28
137
 
29
- step2.dependencies = [step1]
138
+ step3.recursive_clean
30
139
 
140
+ stream = step3.run
141
+ out = []
142
+ while l = stream.gets
143
+ out << l
144
+ end
145
+ assert_equal times/2, out.length
146
+ end
31
147
 
32
- assert_equal "12 has 2 characters", step2.run
33
- assert_equal "12 has 2 characters", step2.run
148
+ def test_fork_stream
149
+ tmpfile = tmpdir.test_step
150
+
151
+ times = 10_000
152
+ sleep = 0.1 / times
153
+
154
+ step1 = Step.new tmpfile.step1, [times, sleep] do |times,sleep|
155
+ Open.open_pipe do |sin|
156
+ times.times do |i|
157
+ sin.puts "line-#{i}"
158
+ sleep sleep
159
+ end
160
+ end
161
+ end
162
+ step1.type = :array
163
+
164
+ step2 = Step.new tmpfile.step2 do
165
+ step1 = dependencies.first
166
+ stream = step1.stream
167
+
168
+ Open.open_pipe do |sin|
169
+ while line = stream.gets
170
+ num = line.split("-").last
171
+ next if num.to_i % 2 == 1
172
+ sin.puts "S2: " + line
173
+ end
174
+ end
34
175
  end
176
+ step2.type = :array
177
+ step2.dependencies = [step1]
178
+
179
+ step3 = Step.new tmpfile.step3 do
180
+ step1 = dependencies.first
181
+ stream = step1.stream
182
+
183
+ Open.open_pipe do |sin|
184
+ while line = stream.gets
185
+ num = line.split("-").last
186
+ next if num.to_i % 2 == 0
187
+ sin.puts "S3: " + line
188
+ end
189
+ end
190
+ end
191
+ step3.type = :array
192
+ step3.dependencies = [step1]
193
+
194
+
195
+ step4 = Step.new tmpfile.step4 do
196
+ step2, step3 = dependencies
197
+
198
+ mutex = Mutex.new
199
+ Open.open_pipe do |sin|
200
+ t2 = Thread.new do
201
+ stream2 = step2.stream
202
+ while line = stream2.gets
203
+ sin.puts line
204
+ end
205
+ end
206
+
207
+ t3 = Thread.new do
208
+ stream3 = step3.stream
209
+ while line = stream3.gets
210
+ sin.puts line
211
+ end
212
+ end
213
+ t2.join
214
+ t3.join
215
+ end
216
+ end
217
+ step4.type = :array
218
+ step4.dependencies = [step2, step3]
219
+
220
+ lines = []
221
+ io = step4.run
222
+ Log::ProgressBar.with_bar severity: 0 do |b|
223
+ while line = io.gets
224
+ b.tick
225
+ lines << line.strip
226
+ end
227
+ end
228
+ io.close
229
+
230
+ assert_equal times, lines.length
35
231
  end
36
232
  end
@@ -37,7 +37,6 @@ class TestTask < Test::Unit::TestCase
37
37
  end
38
38
 
39
39
  def test_override_inputs_block
40
- Log.severity = 0
41
40
  wf = Workflow.annonymous_workflow "TaskInputs" do
42
41
  input :input1, :string
43
42
  task :step1 => :string do |i| i end
@@ -55,7 +54,6 @@ class TestTask < Test::Unit::TestCase
55
54
  end
56
55
 
57
56
  def test_task_override_dep
58
- Log.severity = 0
59
57
  wf = Workflow.annonymous_workflow "TaskInputs" do
60
58
  input :input1, :integer
61
59
  task :step1 => :integer do |i| i end
@@ -171,7 +169,6 @@ class TestTask < Test::Unit::TestCase
171
169
  end
172
170
  end
173
171
 
174
- Log.severity = 0
175
172
  job = wf.job(:my_sum, :vv1 => 2, :vv2 => 3)
176
173
  assert_equal 5, job.run
177
174
  end
data/test/test_helper.rb CHANGED
@@ -22,17 +22,25 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
22
22
  #require 'scout/helper/misc/development'
23
23
  require 'scout/tmpfile'
24
24
  require 'scout/log'
25
+ require 'scout/open'
25
26
  require 'scout/persist'
26
27
  require 'scout/workflow'
27
28
 
28
29
  class Test::Unit::TestCase
29
30
 
31
+ def assert_equal_path(path1, path2)
32
+ assert_equal File.expand_path(path1), File.expand_path(path2)
33
+ end
34
+
30
35
  def tmpdir
31
- @tmpdir = Path.setup('tmp/test_tmpdir').find
36
+ @tmpdir ||= Path.setup('tmp/test_tmpdir').find
32
37
  end
33
38
 
34
39
  setup do
40
+ TmpFile.tmpdir = tmpdir.tmpfiles
41
+ Log::ProgressBar.default_severity = 0
35
42
  Persist.cache_dir = tmpdir.var.cache
43
+ Persist::MEMORY_CACHE.clear
36
44
  Open.remote_cache_dir = tmpdir.var.cache
37
45
  Workflow.directory = tmpdir.var.jobs
38
46
  Workflow.workflows.each{|wf| wf.directory = Workflow.directory[wf.name] }
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: 7.1.0
4
+ version: 7.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-01 00:00:00.000000000 Z
11
+ date: 2023-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor
@@ -97,10 +97,12 @@ files:
97
97
  - Rakefile
98
98
  - VERSION
99
99
  - bin/scout
100
+ - lib/rbbt-scout.rb
100
101
  - lib/scout-gear.rb
101
102
  - lib/scout.rb
102
103
  - lib/scout/cmd.rb
103
104
  - lib/scout/concurrent_stream.rb
105
+ - lib/scout/config.rb
104
106
  - lib/scout/exceptions.rb
105
107
  - lib/scout/indiferent_hash.rb
106
108
  - lib/scout/indiferent_hash/case_insensitive.rb
@@ -117,8 +119,11 @@ files:
117
119
  - lib/scout/misc/digest.rb
118
120
  - lib/scout/misc/filesystem.rb
119
121
  - lib/scout/misc/format.rb
122
+ - lib/scout/misc/helper.rb
120
123
  - lib/scout/misc/insist.rb
121
124
  - lib/scout/misc/monitor.rb
125
+ - lib/scout/misc/system.rb
126
+ - lib/scout/named_array.rb
122
127
  - lib/scout/open.rb
123
128
  - lib/scout/open/lock.rb
124
129
  - lib/scout/open/remote.rb
@@ -137,6 +142,7 @@ files:
137
142
  - lib/scout/resource/produce.rb
138
143
  - lib/scout/resource/produce/rake.rb
139
144
  - lib/scout/resource/scout.rb
145
+ - lib/scout/resource/software.rb
140
146
  - lib/scout/resource/util.rb
141
147
  - lib/scout/semaphore.rb
142
148
  - lib/scout/simple_opt.rb
@@ -147,7 +153,21 @@ files:
147
153
  - lib/scout/simple_opt/setup.rb
148
154
  - lib/scout/tmpfile.rb
149
155
  - lib/scout/tsv.rb
156
+ - lib/scout/tsv/dumper.rb
157
+ - lib/scout/tsv/index.rb
158
+ - lib/scout/tsv/open.rb
150
159
  - lib/scout/tsv/parser.rb
160
+ - lib/scout/tsv/path.rb
161
+ - lib/scout/tsv/persist.rb
162
+ - lib/scout/tsv/persist/adapter.rb
163
+ - lib/scout/tsv/persist/fix_width_table.rb
164
+ - lib/scout/tsv/persist/serialize.rb
165
+ - lib/scout/tsv/persist/tokyocabinet.rb
166
+ - lib/scout/tsv/traverse.rb
167
+ - lib/scout/tsv/util.rb
168
+ - lib/scout/tsv/util/filter.rb
169
+ - lib/scout/tsv/util/process.rb
170
+ - lib/scout/tsv/util/select.rb
151
171
  - lib/scout/work_queue.rb
152
172
  - lib/scout/work_queue/socket.rb
153
173
  - lib/scout/work_queue/worker.rb
@@ -155,8 +175,13 @@ files:
155
175
  - lib/scout/workflow/definition.rb
156
176
  - lib/scout/workflow/documentation.rb
157
177
  - lib/scout/workflow/step.rb
178
+ - lib/scout/workflow/step/config.rb
179
+ - lib/scout/workflow/step/dependencies.rb
180
+ - lib/scout/workflow/step/file.rb
158
181
  - lib/scout/workflow/step/info.rb
159
182
  - lib/scout/workflow/step/load.rb
183
+ - lib/scout/workflow/step/progress.rb
184
+ - lib/scout/workflow/step/provenance.rb
160
185
  - lib/scout/workflow/task.rb
161
186
  - lib/scout/workflow/task/inputs.rb
162
187
  - lib/scout/workflow/usage.rb
@@ -173,6 +198,7 @@ files:
173
198
  - scout_commands/workflow/task_old
174
199
  - share/color/color_names
175
200
  - share/color/diverging_colors.hex
201
+ - share/software/install_helpers
176
202
  - test/scout/indiferent_hash/test_case_insensitive.rb
177
203
  - test/scout/indiferent_hash/test_options.rb
178
204
  - test/scout/log/test_color.rb
@@ -180,6 +206,7 @@ files:
180
206
  - test/scout/misc/test_digest.rb
181
207
  - test/scout/misc/test_filesystem.rb
182
208
  - test/scout/misc/test_insist.rb
209
+ - test/scout/misc/test_system.rb
183
210
  - test/scout/open/test_lock.rb
184
211
  - test/scout/open/test_remote.rb
185
212
  - test/scout/open/test_stream.rb
@@ -191,6 +218,7 @@ files:
191
218
  - test/scout/persist/test_serialize.rb
192
219
  - test/scout/resource/test_path.rb
193
220
  - test/scout/resource/test_produce.rb
221
+ - test/scout/resource/test_software.rb
194
222
  - test/scout/resource/test_util.rb
195
223
  - test/scout/simple_opt/test_doc.rb
196
224
  - test/scout/simple_opt/test_get.rb
@@ -198,10 +226,12 @@ files:
198
226
  - test/scout/simple_opt/test_setup.rb
199
227
  - test/scout/test_cmd.rb
200
228
  - test/scout/test_concurrent_stream.rb
229
+ - test/scout/test_config.rb
201
230
  - test/scout/test_indiferent_hash.rb
202
231
  - test/scout/test_log.rb
203
232
  - test/scout/test_meta_extension.rb
204
233
  - test/scout/test_misc.rb
234
+ - test/scout/test_named_array.rb
205
235
  - test/scout/test_open.rb
206
236
  - test/scout/test_path.rb
207
237
  - test/scout/test_persist.rb
@@ -211,11 +241,25 @@ files:
211
241
  - test/scout/test_tsv.rb
212
242
  - test/scout/test_work_queue.rb
213
243
  - test/scout/test_workflow.rb
244
+ - test/scout/tsv/persist/test_adapter.rb
245
+ - test/scout/tsv/persist/test_fix_width_table.rb
246
+ - test/scout/tsv/persist/test_tokyocabinet.rb
247
+ - test/scout/tsv/test_dumper.rb
248
+ - test/scout/tsv/test_index.rb
249
+ - test/scout/tsv/test_open.rb
214
250
  - test/scout/tsv/test_parser.rb
251
+ - test/scout/tsv/test_persist.rb
252
+ - test/scout/tsv/test_traverse.rb
253
+ - test/scout/tsv/test_util.rb
254
+ - test/scout/tsv/util/test_filter.rb
255
+ - test/scout/tsv/util/test_process.rb
256
+ - test/scout/tsv/util/test_select.rb
215
257
  - test/scout/work_queue/test_socket.rb
216
258
  - test/scout/work_queue/test_worker.rb
259
+ - test/scout/workflow/step/test_dependencies.rb
217
260
  - test/scout/workflow/step/test_info.rb
218
261
  - test/scout/workflow/step/test_load.rb
262
+ - test/scout/workflow/step/test_provenance.rb
219
263
  - test/scout/workflow/task/test_inputs.rb
220
264
  - test/scout/workflow/test_definition.rb
221
265
  - test/scout/workflow/test_documentation.rb
@@ -229,7 +273,7 @@ homepage: http://github.com/mikisvaz/scout-gear
229
273
  licenses:
230
274
  - MIT
231
275
  metadata: {}
232
- post_install_message:
276
+ post_install_message:
233
277
  rdoc_options: []
234
278
  require_paths:
235
279
  - lib
@@ -244,8 +288,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
288
  - !ruby/object:Gem::Version
245
289
  version: '0'
246
290
  requirements: []
247
- rubygems_version: 3.4.11
248
- signing_key:
291
+ rubygems_version: 3.2.15
292
+ signing_key:
249
293
  specification_version: 4
250
294
  summary: basic gear for scouts
251
295
  test_files: []