rbbt-util 5.28.9 → 5.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/entity.rb +1 -1
- data/lib/rbbt/fix_width_table.rb +5 -4
- data/lib/rbbt/hpc.rb +1 -549
- data/lib/rbbt/hpc/orchestrate.rb +23 -0
- data/lib/rbbt/hpc/slurm.rb +570 -0
- data/lib/rbbt/persist.rb +9 -4
- data/lib/rbbt/persist/tsv/adapter.rb +0 -1
- data/lib/rbbt/persist/tsv/fix_width_table.rb +5 -3
- data/lib/rbbt/resource.rb +12 -6
- data/lib/rbbt/resource/path.rb +1 -1
- data/lib/rbbt/tsv/attach.rb +7 -4
- data/lib/rbbt/tsv/dumper.rb +6 -2
- data/lib/rbbt/tsv/parallel.rb +0 -3
- data/lib/rbbt/util/R.rb +2 -2
- data/lib/rbbt/util/cmd.rb +10 -0
- data/lib/rbbt/util/misc/bgzf.rb +1 -1
- data/lib/rbbt/util/misc/indiferent_hash.rb +8 -0
- data/lib/rbbt/util/misc/inspect.rb +11 -7
- data/lib/rbbt/util/named_array.rb +1 -1
- data/lib/rbbt/util/open.rb +17 -16
- data/lib/rbbt/workflow.rb +2 -1
- data/lib/rbbt/workflow/accessor.rb +3 -2
- data/lib/rbbt/workflow/definition.rb +3 -1
- data/lib/rbbt/workflow/examples.rb +2 -2
- data/lib/rbbt/workflow/integration/ansible.rb +53 -0
- data/lib/rbbt/workflow/integration/ansible/workflow.rb +60 -0
- data/lib/rbbt/workflow/step.rb +16 -5
- data/lib/rbbt/workflow/step/accessor.rb +36 -24
- data/lib/rbbt/workflow/step/dependencies.rb +8 -2
- data/lib/rbbt/workflow/step/run.rb +22 -19
- data/lib/rbbt/workflow/util/archive.rb +2 -0
- data/lib/rbbt/workflow/util/orchestrator.rb +30 -12
- data/lib/rbbt/workflow/util/provenance.rb +7 -3
- data/share/rbbt_commands/ansible +55 -0
- data/share/rbbt_commands/purge_job +0 -1
- data/share/rbbt_commands/slurm/list +141 -0
- data/share/rbbt_commands/slurm/orchestrate +47 -0
- data/share/rbbt_commands/{workflow/slurm → slurm/task} +10 -3
- data/share/rbbt_commands/system/status +22 -22
- data/share/rbbt_commands/workflow/forget_deps +9 -0
- data/share/rbbt_commands/workflow/info +12 -9
- data/share/rbbt_commands/workflow/prov +2 -1
- data/test/rbbt/association/test_index.rb +6 -6
- data/test/rbbt/knowledge_base/test_query.rb +3 -3
- data/test/rbbt/knowledge_base/test_registry.rb +1 -1
- data/test/rbbt/persist/tsv/test_cdb.rb +0 -7
- data/test/rbbt/persist/tsv/test_kyotocabinet.rb +2 -8
- data/test/rbbt/persist/tsv/test_leveldb.rb +0 -6
- data/test/rbbt/persist/tsv/test_lmdb.rb +0 -6
- data/test/rbbt/persist/tsv/test_tokyocabinet.rb +15 -14
- data/test/rbbt/test_entity.rb +0 -1
- data/test/rbbt/test_knowledge_base.rb +3 -4
- data/test/rbbt/test_persist.rb +10 -6
- data/test/rbbt/test_workflow.rb +49 -16
- data/test/rbbt/tsv/test_accessor.rb +11 -0
- data/test/rbbt/tsv/test_attach.rb +86 -8
- data/test/rbbt/tsv/test_index.rb +6 -7
- data/test/rbbt/tsv/test_manipulate.rb +2 -3
- data/test/rbbt/util/R/test_model.rb +2 -1
- data/test/rbbt/util/R/test_plot.rb +0 -2
- data/test/rbbt/util/concurrency/test_processes.rb +1 -1
- data/test/rbbt/util/misc/test_bgzf.rb +11 -7
- data/test/rbbt/util/misc/test_lock.rb +0 -1
- data/test/rbbt/util/misc/test_multipart_payload.rb +1 -1
- data/test/rbbt/util/misc/test_pipes.rb +0 -5
- data/test/rbbt/util/test_R.rb +1 -0
- data/test/rbbt/util/test_log.rb +4 -6
- data/test/rbbt/util/test_misc.rb +0 -2
- data/test/rbbt/util/test_open.rb +0 -1
- data/test/rbbt/util/test_python.rb +17 -1
- data/test/rbbt/workflow/test_remote_workflow.rb +1 -1
- data/test/rbbt/workflow/test_step.rb +8 -3
- data/test/rbbt/workflow/util/test_orchestrator.rb +50 -0
- metadata +10 -5
- data/test/rbbt/workflow/remote/test_client.rb +0 -56
@@ -24,6 +24,7 @@ $ rbbt workflow prov <job-result>
|
|
24
24
|
-i--inputs* List of inputs to print
|
25
25
|
-if--info_fields* List of info fields to print
|
26
26
|
-t--touch Update modification times to be consistent
|
27
|
+
-e--expand_repeats Show all the dependency tree even if reapeated dependencies have already been seen before
|
27
28
|
EOF
|
28
29
|
|
29
30
|
SOPT.usage if options[:help]
|
@@ -130,6 +131,6 @@ if options[:plot]
|
|
130
131
|
end
|
131
132
|
|
132
133
|
else
|
133
|
-
puts Step.prov_report(step).strip
|
134
|
+
puts Step.prov_report(step, 0, nil, [], options[:expand_repeats]).strip
|
134
135
|
end
|
135
136
|
|
@@ -73,21 +73,21 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
73
73
|
|
74
74
|
def test_index_flat
|
75
75
|
require 'rbbt/sources/tfacts'
|
76
|
-
file =
|
76
|
+
file = TFactS.regulators
|
77
77
|
tsv = Association.index(file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true)
|
78
78
|
assert tsv.match("TP53").length > 10
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_index_flat_to_matrix
|
82
82
|
require 'rbbt/sources/tfacts'
|
83
|
-
file =
|
83
|
+
file = TFactS.regulators
|
84
84
|
tsv = Association.index(file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true)
|
85
85
|
assert(tsv.to_matrix(false))
|
86
86
|
end
|
87
87
|
|
88
88
|
def test_filter_no_block
|
89
89
|
require 'rbbt/sources/tfacts'
|
90
|
-
file =
|
90
|
+
file = TFactS.regulators
|
91
91
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
92
92
|
tsv.unnamed = false
|
93
93
|
matches = tsv.filter :directed?
|
@@ -96,7 +96,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
96
96
|
|
97
97
|
def test_filter_no_block_value
|
98
98
|
require 'rbbt/sources/tfacts'
|
99
|
-
file =
|
99
|
+
file = TFactS.regulators
|
100
100
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
101
101
|
tsv.unnamed = false
|
102
102
|
matches = tsv.filter :Effect, "inhibition"
|
@@ -105,7 +105,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
105
105
|
|
106
106
|
def test_filter_block_value_field
|
107
107
|
require 'rbbt/sources/tfacts'
|
108
|
-
file =
|
108
|
+
file = TFactS.regulators
|
109
109
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
110
110
|
tsv.unnamed = false
|
111
111
|
matches = tsv.filter :Effect do |value|
|
@@ -116,7 +116,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
116
116
|
|
117
117
|
def test_filter_block_no_value_field
|
118
118
|
require 'rbbt/sources/tfacts'
|
119
|
-
file =
|
119
|
+
file = TFactS.regulators
|
120
120
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
121
121
|
tsv.unnamed = false
|
122
122
|
matches = tsv.filter do |key,values|
|
@@ -22,7 +22,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
22
22
|
:namespace => "Hsa"
|
23
23
|
}
|
24
24
|
|
25
|
-
EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup
|
25
|
+
EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup
|
26
26
|
|
27
27
|
KNOWLEDGE_BASE = KnowledgeBase.new Rbbt.tmp.test.kb_foo2, "Hsa"
|
28
28
|
KNOWLEDGE_BASE.format = {"Gene" => "Ensembl Gene ID"}
|
@@ -34,11 +34,11 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
34
34
|
assert_equal 6, KNOWLEDGE_BASE.subset(:effects, :all).length
|
35
35
|
|
36
36
|
assert_equal 4, KNOWLEDGE_BASE.subset(:effects, :all).target_entity.uniq.length
|
37
|
-
assert_equal %w(Effect), KNOWLEDGE_BASE.subset(:effects, :all).info.first.keys
|
37
|
+
assert_equal %w(Effect), KNOWLEDGE_BASE.subset(:effects, :all).info.first.keys
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def _test_subset_all_persist_format
|
42
42
|
assert KNOWLEDGE_BASE.subset(:effects, :all).target_entity.reject{|e| e =~ /^ENS/}.empty?
|
43
43
|
end
|
44
44
|
|
@@ -45,7 +45,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
45
45
|
|
46
46
|
def test_index_flat
|
47
47
|
require 'rbbt/sources/tfacts'
|
48
|
-
file =
|
48
|
+
file = TFactS.regulators
|
49
49
|
KNOWLEDGE_BASE.register :tfacts, file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true
|
50
50
|
assert KNOWLEDGE_BASE.subset(:tfacts, :source => ["TP53"], :target => :all).length > 10
|
51
51
|
end
|
@@ -4,19 +4,12 @@ require 'rbbt/annotations'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
|
-
module TestAnnotation
|
8
|
-
extend Annotation
|
9
|
-
|
10
|
-
self.annotation :test_annotation
|
11
|
-
end
|
12
|
-
|
13
7
|
class TestPersistTSVCDB < Test::Unit::TestCase
|
14
8
|
|
15
9
|
if Persist.respond_to? :open_cbd
|
16
10
|
def test_organism
|
17
11
|
require 'rbbt/sources/organism'
|
18
12
|
TmpFile.with_file nil do |tmp_file|
|
19
|
-
file = CMD.cmd("head -n 1000000", :in => Organism.identifiers("Hsa").open, :pipe => true)
|
20
13
|
tsv = Organism.identifiers("Hsa").tsv(:key_field => "Associated Gene Name", :fields => ["Ensembl Gene ID"], :type => :single, :persist => true, :persist_engine => "CDB", :persist_dir => tmp_file)
|
21
14
|
assert_equal "ENSG00000141510", tsv["TP53"]
|
22
15
|
end
|
@@ -5,15 +5,9 @@ require 'rbbt/annotations'
|
|
5
5
|
require 'rbbt/util/tmpfile'
|
6
6
|
require 'test/unit'
|
7
7
|
|
8
|
-
module TestAnnotation
|
9
|
-
extend Annotation
|
10
|
-
|
11
|
-
self.annotation :test_annotation
|
12
|
-
end
|
13
|
-
|
14
8
|
class TestPersistTSVKC < Test::Unit::TestCase
|
15
9
|
if Persist.respond_to? :open_kyotocabinet
|
16
|
-
def
|
10
|
+
def test_organism_kch
|
17
11
|
require 'rbbt/sources/organism'
|
18
12
|
TmpFile.with_file do |tmp_file|
|
19
13
|
tsv = Organism.identifiers("Hsa").tsv :key_field => "Associated Gene Name", :fields => ["Ensembl Gene ID"], :type => :single, :persist => true, :persist_engine => "kch", :persist_dir => tmp_file
|
@@ -22,7 +16,7 @@ class TestPersistTSVKC < Test::Unit::TestCase
|
|
22
16
|
end
|
23
17
|
|
24
18
|
|
25
|
-
def
|
19
|
+
def test_organism_kct
|
26
20
|
require 'rbbt/sources/organism'
|
27
21
|
TmpFile.with_file do |tmp_file|
|
28
22
|
tsv = Organism.identifiers("Hsa").tsv :key_field => "Associated Gene Name", :fields => ["Ensembl Gene ID"], :type => :single, :persist => true, :persist_engine => "kct", :persist_dir => tmp_file
|
@@ -4,12 +4,6 @@ require 'rbbt/annotations'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
|
-
module TestAnnotation
|
8
|
-
extend Annotation
|
9
|
-
|
10
|
-
self.annotation :test_annotation
|
11
|
-
end
|
12
|
-
|
13
7
|
class TestPersistTSVLevelDB < Test::Unit::TestCase
|
14
8
|
|
15
9
|
if Persist.respond_to? :open_leveldb
|
@@ -4,7 +4,8 @@ require 'rbbt/annotations'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
|
-
|
7
|
+
|
8
|
+
module TestAnnotationModule
|
8
9
|
extend Annotation
|
9
10
|
|
10
11
|
self.annotation :test_annotation
|
@@ -25,8 +26,8 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
25
26
|
entity1 = "Entity 1"
|
26
27
|
entity2 = "Entity 2"
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
30
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
30
31
|
|
31
32
|
annotations = [entity1, entity2]
|
32
33
|
|
@@ -56,9 +57,9 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
56
57
|
entity2 = "Entity 2"
|
57
58
|
entity2bis = "Entity 2"
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
61
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
62
|
+
TestAnnotationModule.setup(entity2bis, :test_annotation => "2")
|
62
63
|
|
63
64
|
annotations = [entity1, entity2, entity2bis]
|
64
65
|
|
@@ -105,8 +106,8 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
105
106
|
entity1 = "Entity 1"
|
106
107
|
entity2 = "Entity 2"
|
107
108
|
|
108
|
-
|
109
|
-
|
109
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
110
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
110
111
|
|
111
112
|
annotations = [entity1, entity2]
|
112
113
|
|
@@ -138,7 +139,7 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
138
139
|
entity2 = "Entity 2"
|
139
140
|
|
140
141
|
annotations = [entity1, entity2]
|
141
|
-
|
142
|
+
TestAnnotationModule.setup(annotations, :test_annotation => "1")
|
142
143
|
annotations.extend AnnotatedArray
|
143
144
|
|
144
145
|
persisted_annotations = Persist.persist("Test", :annotations, :annotation_repo => repo) do
|
@@ -171,11 +172,11 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
171
172
|
entity2 = "Entity 2"
|
172
173
|
|
173
174
|
annotations = [entity1, entity2]
|
174
|
-
|
175
|
+
TestAnnotationModule.setup(annotations, :test_annotation => "1")
|
175
176
|
annotations.extend AnnotatedArray
|
176
177
|
|
177
178
|
annotations_ary = [annotations]
|
178
|
-
|
179
|
+
TestAnnotationModule.setup(annotations_ary, :test_annotation => "1")
|
179
180
|
annotations_ary.extend AnnotatedArray
|
180
181
|
|
181
182
|
persisted_annotations = Persist.persist("Test", :annotations, :annotation_repo => repo) do
|
@@ -210,9 +211,9 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
210
211
|
entity2 = "Entity 2"
|
211
212
|
entity2bis = "Entity 2"
|
212
213
|
|
213
|
-
|
214
|
-
|
215
|
-
|
214
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
215
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
216
|
+
TestAnnotationModule.setup(entity2bis, :test_annotation => "2")
|
216
217
|
|
217
218
|
annotations = [entity1, entity2, entity2bis]
|
218
219
|
|
data/test/rbbt/test_entity.rb
CHANGED
@@ -62,7 +62,7 @@ class TestKnowledgeBase < Test::Unit::TestCase
|
|
62
62
|
kb = KnowledgeBase.new tmpdir, Organism.default_code("Hsa")
|
63
63
|
kb.format = {"Gene" => "Ensembl Gene ID"}
|
64
64
|
|
65
|
-
kb.register :tfacts,
|
65
|
+
kb.register :tfacts, TFactS.regulators, :source =>"=~Associated Gene Name"
|
66
66
|
|
67
67
|
kb.get_index(:tfacts).reverse
|
68
68
|
end
|
@@ -74,7 +74,7 @@ class TestKnowledgeBase < Test::Unit::TestCase
|
|
74
74
|
kb = KnowledgeBase.new tmpdir, Organism.default_code("Hsa")
|
75
75
|
kb.format = {"Gene" => "Ensembl Gene ID"}
|
76
76
|
|
77
|
-
kb.register :tfacts,
|
77
|
+
kb.register :tfacts, TFactS.regulators, :source =>"=~Associated Gene Name"
|
78
78
|
|
79
79
|
assert_equal "Ensembl Gene ID", kb.get_database(:tfacts).key_field
|
80
80
|
|
@@ -113,10 +113,9 @@ class TestKnowledgeBase < Test::Unit::TestCase
|
|
113
113
|
|
114
114
|
def test_knowledge_base_reuse
|
115
115
|
organism = Organism.default_code("Hsa")
|
116
|
-
Log.severity = 0
|
117
116
|
TmpFile.with_file do |tmpdir|
|
118
117
|
Path.setup(tmpdir)
|
119
|
-
Association.index(
|
118
|
+
Association.index(TFactS.regulators, :persist_file => tmpdir.tfacts, :format => {"Gene" => "Ensembl Gene ID"}, :namespace => Organism.default_code("Hsa"))
|
120
119
|
|
121
120
|
kb = KnowledgeBase.load(tmpdir)
|
122
121
|
assert kb.identify_source('tfacts', "TP53") =~ /ENSG/
|
data/test/rbbt/test_persist.rb
CHANGED
@@ -4,12 +4,6 @@ require 'rbbt/annotations'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
|
-
module TestAnnotation
|
8
|
-
extend Annotation
|
9
|
-
|
10
|
-
self.annotation :test_annotation
|
11
|
-
end
|
12
|
-
|
13
7
|
class TestPersist < Test::Unit::TestCase
|
14
8
|
|
15
9
|
def test_array_persist
|
@@ -78,4 +72,14 @@ class TestPersist < Test::Unit::TestCase
|
|
78
72
|
stream.join
|
79
73
|
end
|
80
74
|
end
|
75
|
+
|
76
|
+
def test_newer
|
77
|
+
TmpFile.with_file("Test1") do |tmp1|
|
78
|
+
sleep 1
|
79
|
+
TmpFile.with_file("Test1") do |tmp2|
|
80
|
+
assert Persist.newer?(tmp1, tmp2)
|
81
|
+
assert ! Persist.newer?(tmp2, tmp1)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
81
85
|
end
|
data/test/rbbt/test_workflow.rb
CHANGED
@@ -156,6 +156,15 @@ for this dependency
|
|
156
156
|
Open.read(file).reverse
|
157
157
|
end
|
158
158
|
|
159
|
+
task :create_file => :text do |file|
|
160
|
+
Open.write(file('a'), "A")
|
161
|
+
Open.write(file('b'), "B")
|
162
|
+
"DONE"
|
163
|
+
end
|
164
|
+
|
165
|
+
dep_task :reverse_step_file, TestWF, :reverse_file do |jobname, options, dependencies|
|
166
|
+
dep = dependencies.flatten.first
|
167
|
+
end
|
159
168
|
|
160
169
|
end
|
161
170
|
|
@@ -204,7 +213,6 @@ class TestWorkflow < Test::Unit::TestCase
|
|
204
213
|
|
205
214
|
def test_update_on_input_dependency_update
|
206
215
|
Open.repository_dirs << File.join(ENV["HOME"],".rbbt/tmp/test/workflow")
|
207
|
-
Log.severity = 0
|
208
216
|
Misc.with_env "RBBT_UPDATE", "true" do
|
209
217
|
send_input_dep_to_reverse_job = TestWF.job(:send_input_dep_to_reverse, nil, :name => "Miguel")
|
210
218
|
send_input_dep_to_reverse_job.clean
|
@@ -376,21 +384,23 @@ class TestWorkflow < Test::Unit::TestCase
|
|
376
384
|
def test_delete_dep
|
377
385
|
job = TestWF.job(:t3).recursive_clean
|
378
386
|
job.run
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
387
|
+
Misc.with_env "RBBT_UPDATE", 'true' do
|
388
|
+
assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
|
389
|
+
job = TestWF.job(:t3)
|
390
|
+
job.step(:t1).clean
|
391
|
+
assert job.checks.select{|d| d.task_name.to_s == "t1" }.empty?
|
392
|
+
job = TestWF.job(:t3).recursive_clean
|
393
|
+
job.run
|
394
|
+
assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
|
395
|
+
job = TestWF.job(:t3)
|
396
|
+
sleep 1
|
397
|
+
Open.touch job.step(:t1).path
|
398
|
+
Misc.with_env "RBBT_UPDATE", "false" do
|
399
|
+
assert job.updated?
|
400
|
+
end
|
401
|
+
Misc.with_env "RBBT_UPDATE", "true" do
|
402
|
+
assert ! job.updated?
|
403
|
+
end
|
394
404
|
end
|
395
405
|
end
|
396
406
|
|
@@ -439,4 +449,27 @@ class TestWorkflow < Test::Unit::TestCase
|
|
439
449
|
end
|
440
450
|
end
|
441
451
|
end
|
452
|
+
|
453
|
+
def test_input_step_file_check
|
454
|
+
job = TestWF.job(:t3).recursive_clean
|
455
|
+
job.run
|
456
|
+
Misc.with_env "RBBT_UPDATE", 'true' do
|
457
|
+
assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
|
458
|
+
job = TestWF.job(:t3)
|
459
|
+
job.step(:t1).clean
|
460
|
+
assert job.checks.select{|d| d.task_name.to_s == "t1" }.empty?
|
461
|
+
job = TestWF.job(:t3).recursive_clean
|
462
|
+
job.run
|
463
|
+
assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
|
464
|
+
job = TestWF.job(:t3)
|
465
|
+
sleep 1
|
466
|
+
Open.touch job.step(:t1).path
|
467
|
+
Misc.with_env "RBBT_UPDATE", "false" do
|
468
|
+
assert job.updated?
|
469
|
+
end
|
470
|
+
Misc.with_env "RBBT_UPDATE", "true" do
|
471
|
+
assert ! job.updated?
|
472
|
+
end
|
473
|
+
end
|
474
|
+
end
|
442
475
|
end
|
@@ -222,6 +222,17 @@ row2 aa|aa|AA|AA b1|b2|B1|B2 Id1|Id1|Id2|Id2
|
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
|
+
def test_to_s_no_fields
|
226
|
+
file1 =<<-EOF
|
227
|
+
row6 dd dd ee
|
228
|
+
row1 a b c
|
229
|
+
row2 A B C
|
230
|
+
row3 1 2 3
|
231
|
+
EOF
|
232
|
+
tsv1 = TSV.open StringIO.new(file1), :sep => " "
|
233
|
+
assert tsv1.to_s(:sort, true).include?('dd')
|
234
|
+
end
|
235
|
+
|
225
236
|
def test_to_s_unmerge_expand
|
226
237
|
content =<<-EOF
|
227
238
|
#Id ValueA ValueB OtherID
|
@@ -566,7 +566,7 @@ row2,CC
|
|
566
566
|
tsv3.keys.each{|k| tsv3[k] = nil if tsv3[k] == ""}
|
567
567
|
end
|
568
568
|
|
569
|
-
assert_equal tsv1.attach(tsv2, :complete => true).attach(tsv3, :complete => true)["row1"]
|
569
|
+
assert_equal [nil, "B", nil], tsv1.attach(tsv2, :complete => true).attach(tsv3, :complete => true)["row1"]
|
570
570
|
end
|
571
571
|
|
572
572
|
def test_attach_index_both_non_key
|
@@ -597,10 +597,10 @@ A Id3
|
|
597
597
|
|
598
598
|
tsv1 = tsv2 = nil
|
599
599
|
|
600
|
-
tsv1 = Rbbt.tmp.test.test1.data.tsv :double, :sep => /\s+/
|
601
|
-
tsv2 = Rbbt.tmp.test.test2.data.tsv :double, :sep => /\s+/
|
600
|
+
tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
|
601
|
+
tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
|
602
602
|
|
603
|
-
tsv2.identifiers = Rbbt.tmp.test.test2.identifiers.produce.find #.to_s
|
603
|
+
tsv2.identifiers = Rbbt.tmp.test.test2.identifiers.produce(true).produce.find #.to_s
|
604
604
|
|
605
605
|
tsv1.attach tsv2, :fields => ["ValueE"] #, :persist_input => true
|
606
606
|
Log.tsv tsv1
|
@@ -627,14 +627,92 @@ E B
|
|
627
627
|
|
628
628
|
tsv1 = tsv2 = nil
|
629
629
|
|
630
|
-
tsv1 = Rbbt.tmp.test.test1.data.tsv :double, :sep => /\s+/
|
631
|
-
tsv2 = Rbbt.tmp.test.test2.data.tsv :double, :sep => /\s+/
|
630
|
+
tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
|
631
|
+
tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
|
632
632
|
|
633
|
-
Log.severity = 0
|
634
633
|
tsv1.attach tsv2, :fields => ["ValueE"] #, :persist_input => true
|
635
634
|
Log.tsv tsv1
|
636
|
-
ppp tsv1
|
637
635
|
|
638
636
|
end
|
637
|
+
|
638
|
+
def test_attach_complete
|
639
|
+
content1 =<<-EOF
|
640
|
+
#: :sep=/\\s+/
|
641
|
+
#Id ValueA
|
642
|
+
row1 a|aa|aaa
|
643
|
+
row2 A
|
644
|
+
EOF
|
645
|
+
|
646
|
+
content2 =<<-EOF
|
647
|
+
#: :sep=/\\s+/
|
648
|
+
#Id ValueB
|
649
|
+
row1 b
|
650
|
+
row3 C
|
651
|
+
EOF
|
652
|
+
Rbbt.claim Rbbt.tmp.test.test1.data, :string, content1
|
653
|
+
Rbbt.claim Rbbt.tmp.test.test2.data, :string, content2
|
654
|
+
|
655
|
+
tsv1 = tsv2 = nil
|
656
|
+
|
657
|
+
tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
|
658
|
+
tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
|
659
|
+
|
660
|
+
tsv1.attach tsv2, :complete => true
|
661
|
+
assert_equal [[], ["C"]], tsv1["row3"]
|
662
|
+
|
663
|
+
tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
|
664
|
+
tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
|
665
|
+
|
666
|
+
ppp tsv1.attach tsv2, :complete => ["AA"]
|
667
|
+
tsv1.attach tsv2, :complete => ["AA"]
|
668
|
+
assert_equal [["AA"], ["C"]], tsv1["row3"]
|
669
|
+
end
|
670
|
+
|
671
|
+
def test_attach_complete_identifiers
|
672
|
+
content1 =<<-EOF
|
673
|
+
#: :sep=/\\s+/
|
674
|
+
#Id ValueA
|
675
|
+
row1 a|aa|aaa
|
676
|
+
row2 A
|
677
|
+
EOF
|
678
|
+
|
679
|
+
content2 =<<-EOF
|
680
|
+
#: :sep=/\\s+/
|
681
|
+
#Id2 ValueB
|
682
|
+
ROW_1 b
|
683
|
+
ROW_2 C
|
684
|
+
EOF
|
685
|
+
|
686
|
+
identifiers =<<-EOF
|
687
|
+
#: :sep=/\\s+/
|
688
|
+
#Id Id2
|
689
|
+
row1 ROW_1
|
690
|
+
row2 ROW_2
|
691
|
+
row3 ROW_3
|
692
|
+
EOF
|
693
|
+
Rbbt.claim Rbbt.tmp.test.test1.data, :string, content1
|
694
|
+
Rbbt.claim Rbbt.tmp.test.test2.data, :string, content2
|
695
|
+
Rbbt.claim Rbbt.tmp.test.identifiers.data, :string, identifiers
|
696
|
+
|
697
|
+
tsv1 = tsv2 = nil
|
698
|
+
|
699
|
+
tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
|
700
|
+
tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
|
701
|
+
ids = Rbbt.tmp.test.identifiers.data.produce(true).tsv :double, :sep => /\s+/
|
702
|
+
|
703
|
+
tsv1.identifiers = ids
|
704
|
+
|
705
|
+
tsv1.attach tsv2
|
706
|
+
assert_equal [["A"], ["C"]], tsv1["row2"]
|
707
|
+
|
708
|
+
tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
|
709
|
+
tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
|
710
|
+
ids = Rbbt.tmp.test.identifiers.data.produce(true).tsv :double, :sep => /\s+/
|
711
|
+
|
712
|
+
tsv1.identifiers = ids
|
713
|
+
|
714
|
+
tsv1.attach tsv2, :complete => true
|
715
|
+
assert_equal [["A"], ["C"]], tsv1["row2"]
|
716
|
+
end
|
639
717
|
end
|
640
718
|
|