scout-gear 10.4.0 → 10.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +100 -656
  3. data/Rakefile +1 -0
  4. data/VERSION +1 -1
  5. data/bin/scout +1 -3
  6. data/lib/scout/association/fields.rb +170 -0
  7. data/lib/scout/association/index.rb +229 -0
  8. data/lib/scout/association/item.rb +227 -0
  9. data/lib/scout/association/util.rb +7 -0
  10. data/lib/scout/association.rb +100 -0
  11. data/lib/scout/entity/format.rb +62 -0
  12. data/lib/scout/entity/identifiers.rb +111 -0
  13. data/lib/scout/entity/object.rb +20 -0
  14. data/lib/scout/entity/property.rb +165 -0
  15. data/lib/scout/entity.rb +40 -0
  16. data/lib/scout/offsite/step.rb +2 -2
  17. data/lib/scout/{tsv/persist → persist/engine}/fix_width_table.rb +25 -33
  18. data/lib/scout/persist/engine/packed_index.rb +100 -0
  19. data/lib/scout/persist/engine/sharder.rb +219 -0
  20. data/lib/scout/{tsv/persist → persist/engine}/tkrzw.rb +0 -17
  21. data/lib/scout/{tsv/persist → persist/engine}/tokyocabinet.rb +55 -31
  22. data/lib/scout/persist/engine.rb +4 -0
  23. data/lib/scout/{tsv/persist/adapter.rb → persist/tsv/adapter/base.rb} +80 -51
  24. data/lib/scout/persist/tsv/adapter/fix_width_table.rb +106 -0
  25. data/lib/scout/persist/tsv/adapter/packed_index.rb +95 -0
  26. data/lib/scout/persist/tsv/adapter/sharder.rb +54 -0
  27. data/lib/scout/persist/tsv/adapter/tkrzw.rb +18 -0
  28. data/lib/scout/persist/tsv/adapter/tokyocabinet.rb +65 -0
  29. data/lib/scout/persist/tsv/adapter.rb +6 -0
  30. data/lib/scout/{tsv/persist → persist/tsv}/serialize.rb +5 -0
  31. data/lib/scout/persist/tsv.rb +107 -0
  32. data/lib/scout/tsv/annotation/repo.rb +83 -0
  33. data/lib/scout/tsv/annotation.rb +169 -0
  34. data/lib/scout/tsv/attach.rb +95 -19
  35. data/lib/scout/tsv/change_id/translate.rb +148 -0
  36. data/lib/scout/tsv/change_id.rb +3 -0
  37. data/lib/scout/tsv/csv.rb +85 -0
  38. data/lib/scout/tsv/dumper.rb +113 -25
  39. data/lib/scout/tsv/entity.rb +5 -0
  40. data/lib/scout/tsv/index.rb +88 -36
  41. data/lib/scout/tsv/open.rb +21 -8
  42. data/lib/scout/tsv/parser.rb +153 -90
  43. data/lib/scout/tsv/path.rb +7 -2
  44. data/lib/scout/tsv/stream.rb +48 -6
  45. data/lib/scout/tsv/transformer.rb +4 -3
  46. data/lib/scout/tsv/traverse.rb +26 -18
  47. data/lib/scout/tsv/util/process.rb +7 -0
  48. data/lib/scout/tsv/util/reorder.rb +25 -15
  49. data/lib/scout/tsv/util/select.rb +9 -1
  50. data/lib/scout/tsv/util/sort.rb +90 -2
  51. data/lib/scout/tsv/util/unzip.rb +56 -0
  52. data/lib/scout/tsv/util.rb +52 -5
  53. data/lib/scout/tsv.rb +45 -27
  54. data/lib/scout/work_queue/socket.rb +8 -0
  55. data/lib/scout/work_queue/worker.rb +22 -5
  56. data/lib/scout/work_queue.rb +38 -24
  57. data/lib/scout/workflow/definition.rb +11 -10
  58. data/lib/scout/workflow/deployment/orchestrator.rb +20 -3
  59. data/lib/scout/workflow/deployment/trace.rb +205 -0
  60. data/lib/scout/workflow/deployment.rb +1 -0
  61. data/lib/scout/workflow/documentation.rb +1 -1
  62. data/lib/scout/workflow/step/archive.rb +42 -0
  63. data/lib/scout/workflow/step/children.rb +51 -0
  64. data/lib/scout/workflow/step/config.rb +1 -1
  65. data/lib/scout/workflow/step/dependencies.rb +24 -7
  66. data/lib/scout/workflow/step/file.rb +19 -0
  67. data/lib/scout/workflow/step/info.rb +37 -9
  68. data/lib/scout/workflow/step/progress.rb +11 -2
  69. data/lib/scout/workflow/step/status.rb +8 -1
  70. data/lib/scout/workflow/step.rb +80 -25
  71. data/lib/scout/workflow/task/dependencies.rb +4 -1
  72. data/lib/scout/workflow/task/inputs.rb +91 -41
  73. data/lib/scout/workflow/task.rb +54 -57
  74. data/lib/scout/workflow/usage.rb +1 -1
  75. data/lib/scout/workflow/util.rb +4 -0
  76. data/lib/scout/workflow.rb +110 -13
  77. data/lib/scout-gear.rb +2 -0
  78. data/lib/scout.rb +0 -1
  79. data/scout-gear.gemspec +80 -23
  80. data/scout_commands/rbbt +2 -0
  81. data/test/data/person/brothers +4 -0
  82. data/test/data/person/identifiers +10 -0
  83. data/test/data/person/marriages +3 -0
  84. data/test/data/person/parents +6 -0
  85. data/test/scout/association/test_fields.rb +105 -0
  86. data/test/scout/association/test_index.rb +70 -0
  87. data/test/scout/association/test_item.rb +21 -0
  88. data/test/scout/entity/test_format.rb +19 -0
  89. data/test/scout/entity/test_identifiers.rb +58 -0
  90. data/test/scout/entity/test_object.rb +0 -0
  91. data/test/scout/entity/test_property.rb +345 -0
  92. data/test/scout/{tsv/persist → persist/engine}/test_fix_width_table.rb +0 -1
  93. data/test/scout/persist/engine/test_packed_index.rb +99 -0
  94. data/test/scout/persist/engine/test_sharder.rb +31 -0
  95. data/test/scout/persist/engine/test_tkrzw.rb +0 -0
  96. data/test/scout/persist/engine/test_tokyocabinet.rb +17 -0
  97. data/test/scout/persist/test_tsv.rb +146 -0
  98. data/test/scout/{tsv/persist/test_adapter.rb → persist/tsv/adapter/test_base.rb} +3 -4
  99. data/test/scout/persist/tsv/adapter/test_fix_width_table.rb +46 -0
  100. data/test/scout/persist/tsv/adapter/test_packed_index.rb +37 -0
  101. data/test/scout/persist/tsv/adapter/test_serialize.rb +0 -0
  102. data/test/scout/persist/tsv/adapter/test_sharder.rb +290 -0
  103. data/test/scout/{tsv/persist → persist/tsv/adapter}/test_tkrzw.rb +3 -6
  104. data/test/scout/persist/tsv/adapter/test_tokyocabinet.rb +282 -0
  105. data/test/scout/persist/tsv/test_serialize.rb +12 -0
  106. data/test/scout/test_association.rb +51 -0
  107. data/test/scout/test_entity.rb +40 -0
  108. data/test/scout/test_tsv.rb +33 -4
  109. data/test/scout/test_work_queue.rb +3 -2
  110. data/test/scout/test_workflow.rb +16 -15
  111. data/test/scout/tsv/annotation/test_repo.rb +150 -0
  112. data/test/scout/tsv/change_id/test_translate.rb +178 -0
  113. data/test/scout/tsv/test_annotation.rb +52 -0
  114. data/test/scout/tsv/test_attach.rb +226 -1
  115. data/test/scout/tsv/test_change_id.rb +25 -0
  116. data/test/scout/tsv/test_csv.rb +50 -0
  117. data/test/scout/tsv/test_dumper.rb +38 -0
  118. data/test/scout/tsv/test_entity.rb +0 -0
  119. data/test/scout/tsv/test_index.rb +82 -0
  120. data/test/scout/tsv/test_open.rb +44 -0
  121. data/test/scout/tsv/test_parser.rb +70 -0
  122. data/test/scout/tsv/test_stream.rb +22 -0
  123. data/test/scout/tsv/test_transformer.rb +27 -3
  124. data/test/scout/tsv/test_traverse.rb +78 -0
  125. data/test/scout/tsv/util/test_process.rb +16 -0
  126. data/test/scout/tsv/util/test_reorder.rb +67 -0
  127. data/test/scout/tsv/util/test_sort.rb +28 -1
  128. data/test/scout/tsv/util/test_unzip.rb +32 -0
  129. data/test/scout/work_queue/test_socket.rb +4 -1
  130. data/test/scout/workflow/deployment/test_orchestrator.rb +17 -26
  131. data/test/scout/workflow/deployment/test_trace.rb +25 -0
  132. data/test/scout/workflow/step/test_archive.rb +28 -0
  133. data/test/scout/workflow/step/test_children.rb +25 -0
  134. data/test/scout/workflow/step/test_info.rb +16 -0
  135. data/test/scout/workflow/task/test_dependencies.rb +16 -16
  136. data/test/scout/workflow/task/test_inputs.rb +45 -1
  137. data/test/scout/workflow/test_definition.rb +52 -0
  138. data/test/scout/workflow/test_step.rb +57 -0
  139. data/test/scout/workflow/test_task.rb +26 -1
  140. data/test/scout/workflow/test_usage.rb +4 -4
  141. data/test/test_helper.rb +23 -1
  142. metadata +71 -14
  143. data/lib/scout/tsv/persist.rb +0 -27
  144. data/test/scout/tsv/persist/test_tokyocabinet.rb +0 -120
  145. data/test/scout/tsv/test_persist.rb +0 -45
@@ -14,5 +14,57 @@ class TestWorkflowDefinition < Test::Unit::TestCase
14
14
  end
15
15
  assert_equal 5, wf.job(:str_length, :string => "12345").run
16
16
  end
17
+
18
+ def test_as_jobname
19
+ wf = Workflow.annonymous_workflow do
20
+ self.name = "CallName"
21
+ input :name, :string, "Name to call", nil, :jobname => true
22
+ task :call_name => :string do |name|
23
+ "Hi #{name}"
24
+ end
25
+ end
26
+ assert_equal "Hi Miguel", wf.job(:call_name, "Miguel").run
27
+ assert_equal "Hi Cleia", wf.job(:call_name, "Miguel", name: "Cleia").run
28
+ assert_equal "Miguel", wf.job(:call_name, "Miguel", name: "Cleia").clean_name
29
+ assert_equal "Cleia", wf.job(:call_name, name: "Cleia").clean_name
30
+ end
31
+
32
+ def test_task_alias
33
+ wf = Workflow.annonymous_workflow do
34
+ self.name = "CallName"
35
+ input :name, :string, "Name to call", nil, :jobname => true
36
+ task :call_name => :string do |name|
37
+ "Hi #{name}"
38
+ end
39
+
40
+ task_alias :call_miguel, self, :call_name, name: "Miguel"
41
+ end
42
+
43
+ job = wf.job(:call_miguel)
44
+ assert_equal "Hi Miguel", job.run
45
+ end
46
+
47
+ def test_task_alias_remove_dep
48
+ wf = Workflow.annonymous_workflow do
49
+ self.name = "CallName"
50
+ input :name, :string, "Name to call", nil, :jobname => true
51
+ task :call_name => :string do |name|
52
+ "Hi #{name}"
53
+ end
54
+
55
+ task_alias :call_miguel, self, :call_name, name: "Miguel"
56
+ end
57
+
58
+ old_cache = Scout::Config::CACHE.dup
59
+ Scout::Config.set({:forget_dep_tasks => true, :remove_dep_tasks => true}, 'task:CallName#call_miguel')
60
+ job = wf.job(:call_miguel)
61
+ dep_path = job.step(:call_name).path
62
+ assert_equal "Hi Miguel", job.run
63
+ refute job.dependencies.any?
64
+ refute Open.exist?(dep_path)
65
+ Scout::Config::CACHE.replace old_cache
66
+ assert_include job.archived_info, dep_path
67
+ assert_equal :done, job.archived_info[dep_path][:status]
68
+ end
17
69
  end
18
70
 
@@ -31,6 +31,29 @@ class TestWorkflowStep < Test::Unit::TestCase
31
31
  assert_equal "12 has 2 characters", step2.run
32
32
  end
33
33
 
34
+ def test_dependency_load
35
+ tmpfile = tmpdir
36
+ step1 = Step.new tmpdir.test_task1.step1, ["12"] do |s|
37
+ s.length
38
+ end
39
+
40
+ step2 = Step.new tmpdir.test_task2.step2 do
41
+ step1 = dependencies.first
42
+ step1.inputs.first + " has " + step1.load.to_s + " characters"
43
+ end
44
+
45
+ step2.dependencies = [step1]
46
+
47
+ step2.run
48
+
49
+ assert_equal "12 has 2 characters", step2.run
50
+
51
+ new_step = Step.new step2.path
52
+
53
+ assert_equal "12 has 2 characters", new_step.run
54
+ assert_equal 2, new_step.step(:test_task1).run
55
+ end
56
+
34
57
  def test_streaming
35
58
  tmpfile = tmpdir.test_step
36
59
 
@@ -58,6 +81,11 @@ class TestWorkflowStep < Test::Unit::TestCase
58
81
  step1.join
59
82
  step1.clean
60
83
 
84
+ step1.clean
85
+ res = step1.run(:no_load)
86
+ assert res.nil?
87
+ step1.clean
88
+
61
89
  step2 = Step.new tmpfile.step2 do
62
90
  step1 = dependencies.first
63
91
  stream = step1.stream
@@ -95,6 +123,7 @@ class TestWorkflowStep < Test::Unit::TestCase
95
123
  lines << line
96
124
  end
97
125
 
126
+ stream.join
98
127
  assert step1.path.read.end_with? "line-#{times-1}\n"
99
128
  assert_equal times/2, lines.length
100
129
  assert_equal times/2, step2.join.path.read.split("\n").length
@@ -338,4 +367,32 @@ class TestWorkflowStep < Test::Unit::TestCase
338
367
  assert_equal "12 has 2 characters", step2.run
339
368
  end
340
369
 
370
+ def test_semaphore
371
+
372
+ tmpfile = tmpdir.test_step
373
+ step1 = Step.new tmpfile.step1 do |s|
374
+ sleep 2
375
+ "done1"
376
+ end
377
+
378
+ step2 = Step.new tmpfile.step2 do
379
+ sleep 2
380
+ "done2"
381
+ end
382
+
383
+ step1.dependencies = []
384
+ step2.dependencies = []
385
+
386
+ ScoutSemaphore.with_semaphore(1) do |sem|
387
+ step1.fork(false, sem)
388
+ step2.fork(false, sem)
389
+ sleep 1
390
+ assert((step1.status == :queue) || (step2.status == :queue))
391
+ step1.join
392
+ step2.join
393
+ assert_equal "done2", step2.run
394
+ end
395
+
396
+ end
397
+
341
398
  end
@@ -21,5 +21,30 @@ class TestTask < Test::Unit::TestCase
21
21
  assert_equal 2, s.run
22
22
  end
23
23
 
24
- end
24
+ def __test_benchmark
25
+ tasks = []
26
+ wf = Module.new do
27
+ extend Workflow
28
+ self.name = "TestWF"
29
+
30
+ 500.times do |i|
31
+ task_name = "task_#{i}"
32
+ last_task_name = "task_#{i-1}"
33
+ if i == 0
34
+ task task_name => :array do
35
+ [task_name]
36
+ end
37
+ else
38
+ dep last_task_name
39
+ task task_name => :array do
40
+ step(last_task_name).load.push(task_name)
41
+ end
42
+ end
43
+ end
44
+ end
25
45
 
46
+ Misc.benchmark(1000) do
47
+ wf.job(:task_499)
48
+ end
49
+ end
50
+ end
@@ -53,10 +53,10 @@ class TestWorkflowUsage < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  def test_task_input_fixed
56
- assert_match /Desc2_fixed/, UsageWorkflow.tasks[:step2_fixed].usage(UsageWorkflow)
57
- refute_match /--array/, UsageWorkflow.tasks[:step2_fixed].usage(UsageWorkflow)
58
- assert_match /Desc3/, UsageWorkflow.tasks[:step3_fixed].usage(UsageWorkflow)
59
- refute_match /--array/, UsageWorkflow.tasks[:step3_fixed].usage(UsageWorkflow)
56
+ assert_match(/Desc2_fixed/, UsageWorkflow.tasks[:step2_fixed].usage(UsageWorkflow))
57
+ refute_match(/--array/, UsageWorkflow.tasks[:step2_fixed].usage(UsageWorkflow))
58
+ assert_match(/Desc3/, UsageWorkflow.tasks[:step3_fixed].usage(UsageWorkflow))
59
+ refute_match(/--array/, UsageWorkflow.tasks[:step3_fixed].usage(UsageWorkflow))
60
60
  end
61
61
  end
62
62
 
data/test/test_helper.rb CHANGED
@@ -32,11 +32,16 @@ class Test::Unit::TestCase
32
32
  assert_equal File.expand_path(path1), File.expand_path(path2)
33
33
  end
34
34
 
35
+ def self.tmpdir
36
+ @@tmpdir ||= Path.setup('tmp/test_tmpdir').find
37
+ end
38
+
35
39
  def tmpdir
36
- @tmpdir ||= Path.setup('tmp/test_tmpdir').find
40
+ @tmpdir ||= Test::Unit::TestCase.tmpdir
37
41
  end
38
42
 
39
43
  setup do
44
+ Open.rm_rf tmpdir
40
45
  TmpFile.tmpdir = tmpdir.tmpfiles
41
46
  Log::ProgressBar.default_severity = 0
42
47
  Persist.cache_dir = tmpdir.var.cache
@@ -44,9 +49,26 @@ class Test::Unit::TestCase
44
49
  Open.remote_cache_dir = tmpdir.var.cache
45
50
  Workflow.directory = tmpdir.var.jobs
46
51
  Workflow.workflows.each{|wf| wf.directory = Workflow.directory[wf.name] }
52
+ Entity.entity_property_cache = tmpdir.entity_properties if defined?(Entity)
47
53
  end
48
54
 
49
55
  teardown do
50
56
  Open.rm_rf tmpdir
51
57
  end
58
+
59
+ def self.datadir_test
60
+ Path.setup(File.join(File.dirname(__FILE__), 'data'))
61
+ end
62
+
63
+ def self.datafile_test(file)
64
+ datadir_test[file.to_s]
65
+ end
66
+
67
+ def datadir_test
68
+ Test::Unit::TestCase.datadir_test
69
+ end
70
+
71
+ def datafile_test(file)
72
+ Test::Unit::TestCase.datafile_test(file)
73
+ end
52
74
  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.4.0
4
+ version: 10.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-09 00:00:00.000000000 Z
11
+ date: 2024-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: scout-essentials
@@ -145,26 +145,50 @@ files:
145
145
  - lib/rbbt-scout.rb
146
146
  - lib/scout-gear.rb
147
147
  - lib/scout.rb
148
+ - lib/scout/association.rb
149
+ - lib/scout/association/fields.rb
150
+ - lib/scout/association/index.rb
151
+ - lib/scout/association/item.rb
152
+ - lib/scout/association/util.rb
153
+ - lib/scout/entity.rb
154
+ - lib/scout/entity/format.rb
155
+ - lib/scout/entity/identifiers.rb
156
+ - lib/scout/entity/object.rb
157
+ - lib/scout/entity/property.rb
148
158
  - lib/scout/offsite.rb
149
159
  - lib/scout/offsite/exceptions.rb
150
160
  - lib/scout/offsite/ssh.rb
151
161
  - lib/scout/offsite/step.rb
152
162
  - lib/scout/offsite/sync.rb
163
+ - lib/scout/persist/engine.rb
164
+ - lib/scout/persist/engine/fix_width_table.rb
165
+ - lib/scout/persist/engine/packed_index.rb
166
+ - lib/scout/persist/engine/sharder.rb
167
+ - lib/scout/persist/engine/tkrzw.rb
168
+ - lib/scout/persist/engine/tokyocabinet.rb
169
+ - lib/scout/persist/tsv.rb
170
+ - lib/scout/persist/tsv/adapter.rb
171
+ - lib/scout/persist/tsv/adapter/base.rb
172
+ - lib/scout/persist/tsv/adapter/fix_width_table.rb
173
+ - lib/scout/persist/tsv/adapter/packed_index.rb
174
+ - lib/scout/persist/tsv/adapter/sharder.rb
175
+ - lib/scout/persist/tsv/adapter/tkrzw.rb
176
+ - lib/scout/persist/tsv/adapter/tokyocabinet.rb
177
+ - lib/scout/persist/tsv/serialize.rb
153
178
  - lib/scout/semaphore.rb
154
179
  - lib/scout/tsv.rb
180
+ - lib/scout/tsv/annotation.rb
181
+ - lib/scout/tsv/annotation/repo.rb
155
182
  - lib/scout/tsv/attach.rb
156
183
  - lib/scout/tsv/change_id.rb
184
+ - lib/scout/tsv/change_id/translate.rb
185
+ - lib/scout/tsv/csv.rb
157
186
  - lib/scout/tsv/dumper.rb
187
+ - lib/scout/tsv/entity.rb
158
188
  - lib/scout/tsv/index.rb
159
189
  - lib/scout/tsv/open.rb
160
190
  - lib/scout/tsv/parser.rb
161
191
  - lib/scout/tsv/path.rb
162
- - lib/scout/tsv/persist.rb
163
- - lib/scout/tsv/persist/adapter.rb
164
- - lib/scout/tsv/persist/fix_width_table.rb
165
- - lib/scout/tsv/persist/serialize.rb
166
- - lib/scout/tsv/persist/tkrzw.rb
167
- - lib/scout/tsv/persist/tokyocabinet.rb
168
192
  - lib/scout/tsv/stream.rb
169
193
  - lib/scout/tsv/transformer.rb
170
194
  - lib/scout/tsv/traverse.rb
@@ -184,8 +208,11 @@ files:
184
208
  - lib/scout/workflow/definition.rb
185
209
  - lib/scout/workflow/deployment.rb
186
210
  - lib/scout/workflow/deployment/orchestrator.rb
211
+ - lib/scout/workflow/deployment/trace.rb
187
212
  - lib/scout/workflow/documentation.rb
188
213
  - lib/scout/workflow/step.rb
214
+ - lib/scout/workflow/step/archive.rb
215
+ - lib/scout/workflow/step/children.rb
189
216
  - lib/scout/workflow/step/config.rb
190
217
  - lib/scout/workflow/step/dependencies.rb
191
218
  - lib/scout/workflow/step/file.rb
@@ -226,26 +253,53 @@ files:
226
253
  - share/software/install_helpers
227
254
  - share/templates/command
228
255
  - share/templates/workflow.rb
256
+ - test/data/person/brothers
257
+ - test/data/person/identifiers
258
+ - test/data/person/marriages
259
+ - test/data/person/parents
260
+ - test/scout/association/test_fields.rb
261
+ - test/scout/association/test_index.rb
262
+ - test/scout/association/test_item.rb
263
+ - test/scout/entity/test_format.rb
264
+ - test/scout/entity/test_identifiers.rb
265
+ - test/scout/entity/test_object.rb
266
+ - test/scout/entity/test_property.rb
229
267
  - test/scout/offsite/test_ssh.rb
230
268
  - test/scout/offsite/test_step.rb
231
269
  - test/scout/offsite/test_sync.rb
232
270
  - test/scout/offsite/test_task.rb
271
+ - test/scout/persist/engine/test_fix_width_table.rb
272
+ - test/scout/persist/engine/test_packed_index.rb
273
+ - test/scout/persist/engine/test_sharder.rb
274
+ - test/scout/persist/engine/test_tkrzw.rb
275
+ - test/scout/persist/engine/test_tokyocabinet.rb
276
+ - test/scout/persist/test_tsv.rb
277
+ - test/scout/persist/tsv/adapter/test_base.rb
278
+ - test/scout/persist/tsv/adapter/test_fix_width_table.rb
279
+ - test/scout/persist/tsv/adapter/test_packed_index.rb
280
+ - test/scout/persist/tsv/adapter/test_serialize.rb
281
+ - test/scout/persist/tsv/adapter/test_sharder.rb
282
+ - test/scout/persist/tsv/adapter/test_tkrzw.rb
283
+ - test/scout/persist/tsv/adapter/test_tokyocabinet.rb
284
+ - test/scout/persist/tsv/test_serialize.rb
285
+ - test/scout/test_association.rb
286
+ - test/scout/test_entity.rb
233
287
  - test/scout/test_offsite.rb
234
288
  - test/scout/test_semaphore.rb
235
289
  - test/scout/test_tsv.rb
236
290
  - test/scout/test_work_queue.rb
237
291
  - test/scout/test_workflow.rb
238
- - test/scout/tsv/persist/test_adapter.rb
239
- - test/scout/tsv/persist/test_fix_width_table.rb
240
- - test/scout/tsv/persist/test_tkrzw.rb
241
- - test/scout/tsv/persist/test_tokyocabinet.rb
292
+ - test/scout/tsv/annotation/test_repo.rb
293
+ - test/scout/tsv/change_id/test_translate.rb
294
+ - test/scout/tsv/test_annotation.rb
242
295
  - test/scout/tsv/test_attach.rb
243
296
  - test/scout/tsv/test_change_id.rb
297
+ - test/scout/tsv/test_csv.rb
244
298
  - test/scout/tsv/test_dumper.rb
299
+ - test/scout/tsv/test_entity.rb
245
300
  - test/scout/tsv/test_index.rb
246
301
  - test/scout/tsv/test_open.rb
247
302
  - test/scout/tsv/test_parser.rb
248
- - test/scout/tsv/test_persist.rb
249
303
  - test/scout/tsv/test_stream.rb
250
304
  - test/scout/tsv/test_transformer.rb
251
305
  - test/scout/tsv/test_traverse.rb
@@ -260,6 +314,9 @@ files:
260
314
  - test/scout/work_queue/test_socket.rb
261
315
  - test/scout/work_queue/test_worker.rb
262
316
  - test/scout/workflow/deployment/test_orchestrator.rb
317
+ - test/scout/workflow/deployment/test_trace.rb
318
+ - test/scout/workflow/step/test_archive.rb
319
+ - test/scout/workflow/step/test_children.rb
263
320
  - test/scout/workflow/step/test_dependencies.rb
264
321
  - test/scout/workflow/step/test_info.rb
265
322
  - test/scout/workflow/step/test_load.rb
@@ -295,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
352
  - !ruby/object:Gem::Version
296
353
  version: '0'
297
354
  requirements: []
298
- rubygems_version: 3.5.0.dev
355
+ rubygems_version: 3.5.10
299
356
  signing_key:
300
357
  specification_version: 4
301
358
  summary: basic gear for scouts
@@ -1,27 +0,0 @@
1
- require 'scout/persist'
2
- require_relative 'persist/adapter'
3
-
4
- begin
5
- require_relative 'persist/tokyocabinet'
6
- rescue Exception
7
- end
8
-
9
- begin
10
- require_relative 'persist/tkrzw'
11
- rescue Exception
12
- end
13
-
14
- Persist.save_drivers[:tsv] = proc do |file,content|
15
- stream = if IO === content
16
- content
17
- elsif content.respond_to?(:stream)
18
- content.stream
19
- elsif content.respond_to?(:dumper_stream)
20
- content.dumper_stream
21
- else
22
- content
23
- end
24
- Open.sensible_write(file, stream)
25
- end
26
-
27
- Persist.load_drivers[:tsv] = proc do |file| TSV.open file end
@@ -1,120 +0,0 @@
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
- require 'scout/tsv'
5
-
6
- class TestTSVTokyo < Test::Unit::TestCase
7
- def test_tokyo
8
- content =<<-'EOF'
9
- #: :sep=/\s+/#:type=:double#:merge=:concat
10
- #Id ValueA ValueB OtherID
11
- row1 a|aa|aaa b Id1|Id2
12
- row2 A B Id3
13
- row2 a a id3
14
- EOF
15
-
16
- tsv = TmpFile.with_file(content) do |filename|
17
- Persist.persist(__method__, :HDB) do
18
- TSV.open(filename)
19
- end
20
- end
21
-
22
- assert_equal %w(a aa aaa), tsv["row1"][0]
23
-
24
- assert TSVAdapter === tsv
25
- assert TSV === tsv
26
- assert_include tsv.instance_variable_get(:@extension_attrs), :key_field
27
- assert_include tsv.instance_variable_get(:@extension_attrs), :serializer
28
-
29
- tsv_loaded = assert_nothing_raised do
30
- TmpFile.with_file(content) do |filename|
31
- Persist.persist(__method__, :HDB) do
32
- raise
33
- end
34
- end
35
- end
36
-
37
-
38
- assert_equal %w(a aa aaa), tsv_loaded["row1"][0]
39
- end
40
-
41
- def test_custom_load
42
- tsv = TSV.setup({}, :type => :double, :key_field => "Key", :fields => %w(Field1 Field2))
43
-
44
- size = 100_000
45
- (0..size).each do |i|
46
- k = "key-#{i}"
47
- values1 = 3.times.collect{|j| "value-#{i}-1-#{j}" }
48
- values2 = 5.times.collect{|j| "value-#{i}-2-#{j}" }
49
-
50
- tsv[k] = [values1, values2]
51
- end
52
-
53
- tc = Persist.persist(__method__, :HDB) do |file|
54
- tsv
55
- end
56
-
57
- 100.times do
58
- i = rand(size).floor
59
- assert_equal tc["key-#{i}"], tsv["key-#{i}"]
60
- end
61
- end
62
-
63
- def __test_speed
64
- tsv = TSV.setup({}, :type => :double, :key_field => "Key", :fields => %w(Field1 Field2))
65
-
66
- size = 100_000
67
- (0..size).each do |i|
68
- k = "key-#{i}"
69
- values1 = 3.times.collect{|j| "value-#{i}-1-#{j}" }
70
- values2 = 5.times.collect{|j| "value-#{i}-2-#{j}" }
71
-
72
- tsv[k] = [values1, values2]
73
- end
74
-
75
- tc = Persist.persist(__method__, :HDB) do |file|
76
- data = ScoutCabinet.open(file, true, "HDB")
77
- TSV.setup(data, :type => :double, :key_field => "Key", :fields => %w(Field1 Field2))
78
- data.extend TSVAdapter
79
- Log::ProgressBar.with_bar size do |b|
80
- (0..size).each do |i|
81
- b.tick
82
- k = "key-#{i}"
83
- values1 = 3.times.collect{|j| "value-#{i}-1-#{j}" }
84
- values2 = 5.times.collect{|j| "value-#{i}-2-#{j}" }
85
-
86
- data[k] = [values1, values2]
87
- end
88
- end
89
- data
90
- end
91
-
92
- 100.times do
93
- i = rand(size).floor
94
- assert_equal tc["key-#{i}"], tsv["key-#{i}"]
95
- end
96
- end
97
-
98
- def test_float_array
99
- content =<<-EOF
100
- #Id ValueA ValueB OtherID
101
- row1 0.2 0.3 0
102
- row2 0.1 4.5 0
103
- EOF
104
-
105
- TmpFile.with_file(content) do |filename|
106
- tsv = TSV.open(filename, :sep => /\s+/, :persist => true, :type => :list, :cast => :to_f)
107
- tsv.save_extension_attr_hash
108
- assert_equal [0.2, 0.3, 0], tsv["row1"]
109
- assert_equal TSVAdapter::FloatArraySerializer, tsv.serializer
110
- Open.cp tsv.persistence_path, tmpdir.persistence.foo
111
- tsv2 = ScoutCabinet.open(tmpdir.persistence.foo, false)
112
- tsv2.extend TSVAdapter
113
- assert_equal [0.2, 0.3, 0], tsv2["row1"]
114
- assert_equal TSVAdapter::FloatArraySerializer, tsv2.serializer
115
- end
116
-
117
- end
118
-
119
- end
120
-
@@ -1,45 +0,0 @@
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
- require 'scout/tsv'
5
-
6
- class TestTSVPersist < Test::Unit::TestCase
7
- def test_persist
8
- content =<<-'EOF'
9
- #: :sep=/\s+/#:type=:double#:merge=:concat
10
- #Id ValueA ValueB OtherID
11
- row1 a|aa|aaa b Id1|Id2
12
- row2 A B Id3
13
- row2 a a id3
14
- EOF
15
-
16
-
17
- tsv = Persist.persist("TEST Persist TSV", :tsv) do
18
- TmpFile.with_file(content) do |filename|
19
- TSV.open(filename)
20
- end
21
- end
22
-
23
- assert_include tsv.keys, 'row1'
24
- assert_include tsv.keys, 'row2'
25
-
26
- tsv = Persist.persist("TEST Persist TSV", :tsv) do
27
- TmpFile.with_file(content) do |filename|
28
- TSV.open(filename)
29
- end
30
- end
31
-
32
- assert_include tsv.keys, 'row1'
33
- assert_include tsv.keys, 'row2'
34
-
35
- assert_nothing_raised do
36
- tsv = Persist.persist("TEST Persist TSV", :tsv) do
37
- raise
38
- end
39
- end
40
-
41
- assert_include tsv.keys, 'row1'
42
- assert_include tsv.keys, 'row2'
43
- end
44
- end
45
-