scout-gear 9.1.0 → 10.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +3 -3
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/lib/scout/offsite/exceptions.rb +9 -0
- data/lib/scout/offsite/ssh.rb +1 -0
- data/lib/scout/semaphore.rb +2 -0
- data/lib/scout/tsv/open.rb +1 -1
- data/lib/scout/tsv/parser.rb +1 -1
- data/lib/scout/tsv/persist/adapter.rb +2 -2
- data/lib/scout/tsv/persist.rb +1 -0
- data/lib/scout/tsv.rb +1 -1
- data/lib/scout/work_queue/exceptions.rb +18 -0
- data/lib/scout/work_queue.rb +1 -0
- data/lib/scout/workflow/definition.rb +1 -1
- data/lib/scout/workflow/step/config.rb +1 -1
- data/lib/scout/workflow/step.rb +2 -2
- data/lib/scout/workflow/task/inputs.rb +1 -1
- data/lib/scout/workflow/task.rb +2 -2
- data/lib/scout/workflow.rb +2 -2
- data/lib/scout-gear.rb +1 -10
- data/scout-gear.gemspec +8 -98
- data/test/scout/workflow/task/test_inputs.rb +0 -4
- metadata +7 -110
- data/lib/scout/cmd.rb +0 -347
- data/lib/scout/concurrent_stream.rb +0 -284
- data/lib/scout/config.rb +0 -168
- data/lib/scout/exceptions.rb +0 -151
- data/lib/scout/indiferent_hash/case_insensitive.rb +0 -30
- data/lib/scout/indiferent_hash/options.rb +0 -115
- data/lib/scout/indiferent_hash.rb +0 -96
- data/lib/scout/log/color.rb +0 -224
- data/lib/scout/log/color_class.rb +0 -269
- data/lib/scout/log/fingerprint.rb +0 -69
- data/lib/scout/log/progress/report.rb +0 -244
- data/lib/scout/log/progress/util.rb +0 -173
- data/lib/scout/log/progress.rb +0 -106
- data/lib/scout/log/trap.rb +0 -107
- data/lib/scout/log.rb +0 -441
- data/lib/scout/meta_extension.rb +0 -100
- data/lib/scout/misc/digest.rb +0 -63
- data/lib/scout/misc/filesystem.rb +0 -25
- data/lib/scout/misc/format.rb +0 -255
- data/lib/scout/misc/helper.rb +0 -31
- data/lib/scout/misc/insist.rb +0 -56
- data/lib/scout/misc/monitor.rb +0 -66
- data/lib/scout/misc/system.rb +0 -73
- data/lib/scout/misc.rb +0 -10
- data/lib/scout/named_array.rb +0 -138
- data/lib/scout/open/lock/lockfile.rb +0 -587
- data/lib/scout/open/lock.rb +0 -68
- data/lib/scout/open/remote.rb +0 -135
- data/lib/scout/open/stream.rb +0 -491
- data/lib/scout/open/util.rb +0 -244
- data/lib/scout/open.rb +0 -170
- data/lib/scout/path/find.rb +0 -204
- data/lib/scout/path/tmpfile.rb +0 -8
- data/lib/scout/path/util.rb +0 -127
- data/lib/scout/path.rb +0 -51
- data/lib/scout/persist/open.rb +0 -17
- data/lib/scout/persist/path.rb +0 -15
- data/lib/scout/persist/serialize.rb +0 -157
- data/lib/scout/persist.rb +0 -104
- data/lib/scout/resource/open.rb +0 -8
- data/lib/scout/resource/path.rb +0 -80
- data/lib/scout/resource/produce/rake.rb +0 -69
- data/lib/scout/resource/produce.rb +0 -151
- data/lib/scout/resource/scout.rb +0 -3
- data/lib/scout/resource/software.rb +0 -178
- data/lib/scout/resource/util.rb +0 -59
- data/lib/scout/resource.rb +0 -41
- data/lib/scout/simple_opt/accessor.rb +0 -54
- data/lib/scout/simple_opt/doc.rb +0 -126
- data/lib/scout/simple_opt/get.rb +0 -57
- data/lib/scout/simple_opt/parse.rb +0 -67
- data/lib/scout/simple_opt/setup.rb +0 -26
- data/lib/scout/simple_opt.rb +0 -5
- data/lib/scout/tmpfile.rb +0 -129
- data/test/scout/indiferent_hash/test_case_insensitive.rb +0 -16
- data/test/scout/indiferent_hash/test_options.rb +0 -46
- data/test/scout/log/test_progress.rb +0 -108
- data/test/scout/misc/test_digest.rb +0 -30
- data/test/scout/misc/test_filesystem.rb +0 -30
- data/test/scout/misc/test_insist.rb +0 -13
- data/test/scout/misc/test_system.rb +0 -21
- data/test/scout/open/test_lock.rb +0 -52
- data/test/scout/open/test_remote.rb +0 -25
- data/test/scout/open/test_stream.rb +0 -676
- data/test/scout/open/test_util.rb +0 -73
- data/test/scout/path/test_find.rb +0 -119
- data/test/scout/path/test_util.rb +0 -22
- data/test/scout/persist/test_open.rb +0 -37
- data/test/scout/persist/test_path.rb +0 -37
- data/test/scout/persist/test_serialize.rb +0 -114
- data/test/scout/resource/test_path.rb +0 -46
- data/test/scout/resource/test_produce.rb +0 -92
- data/test/scout/resource/test_software.rb +0 -24
- data/test/scout/resource/test_util.rb +0 -36
- data/test/scout/simple_opt/test_doc.rb +0 -16
- data/test/scout/simple_opt/test_get.rb +0 -11
- data/test/scout/simple_opt/test_parse.rb +0 -10
- data/test/scout/simple_opt/test_setup.rb +0 -77
- data/test/scout/test_cmd.rb +0 -85
- data/test/scout/test_concurrent_stream.rb +0 -29
- data/test/scout/test_config.rb +0 -66
- data/test/scout/test_indiferent_hash.rb +0 -26
- data/test/scout/test_log.rb +0 -32
- data/test/scout/test_meta_extension.rb +0 -80
- data/test/scout/test_misc.rb +0 -6
- data/test/scout/test_named_array.rb +0 -43
- data/test/scout/test_open.rb +0 -146
- data/test/scout/test_path.rb +0 -54
- data/test/scout/test_persist.rb +0 -186
- data/test/scout/test_resource.rb +0 -26
- data/test/scout/test_tmpfile.rb +0 -53
- /data/test/scout/{log/test_color.rb → test_offsite.rb} +0 -0
data/test/scout/test_persist.rb
DELETED
@@ -1,186 +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
|
-
class TestPersist < Test::Unit::TestCase
|
5
|
-
def test_string
|
6
|
-
TmpFile.with_file do |tmpfile|
|
7
|
-
Path.setup(tmpfile)
|
8
|
-
obj = "TEST"
|
9
|
-
type = :string
|
10
|
-
refute tmpdir.persist.glob("*").any?
|
11
|
-
assert_equal obj, Persist.persist(tmpfile, type, :dir => tmpdir.persist){ obj }
|
12
|
-
assert tmpdir.persist.glob("*").any?
|
13
|
-
assert_equal obj, Persist.persist(tmpfile, type, :dir => tmpdir.persist){ raise "Error" }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_float_array
|
18
|
-
TmpFile.with_file do |tmpfile|
|
19
|
-
Path.setup(tmpfile)
|
20
|
-
obj = [1.2,2.2]
|
21
|
-
type = :float_array
|
22
|
-
refute tmpdir.persist.glob("*").any?
|
23
|
-
assert_equal obj, Persist.persist(tmpfile, type, :dir => tmpdir.persist){ obj }
|
24
|
-
assert tmpdir.persist.glob("*").any?
|
25
|
-
assert_equal obj, Persist.persist(tmpfile, type, :dir => tmpdir.persist){ raise "Error" }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_string_update
|
30
|
-
TmpFile.with_file do |tmpfile|
|
31
|
-
Path.setup(tmpfile)
|
32
|
-
obj = "TEST"
|
33
|
-
type = :string
|
34
|
-
refute tmpdir.persist.glob("*").any?
|
35
|
-
assert_equal obj, Persist.persist(tmpfile, type, :dir => tmpdir.persist){ obj }
|
36
|
-
assert tmpdir.persist.glob("*").any?
|
37
|
-
assert_raises ScoutException do
|
38
|
-
Persist.persist(tmpfile, type, :dir => tmpdir.persist, :update => true){ raise ScoutException }
|
39
|
-
end
|
40
|
-
assert_raises ScoutException do
|
41
|
-
Persist.persist(tmpfile, type, :persist_dir => tmpdir.persist, :persist_update => true){ raise ScoutException }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_stream
|
47
|
-
TmpFile.with_file do |tmpfile|
|
48
|
-
Path.setup(tmpfile)
|
49
|
-
obj = "TEST\nTEST"
|
50
|
-
stream = StringIO.new obj
|
51
|
-
stream.rewind
|
52
|
-
res = Persist.persist(tmpfile, :string, :dir => tmpdir.persist){ stream }
|
53
|
-
assert IO === res
|
54
|
-
assert_equal obj, res.read
|
55
|
-
assert_equal obj, Persist.persist(tmpfile, :string, :dir => tmpdir.persist){ raise ScoutException }
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_stream_multiple
|
60
|
-
TmpFile.with_file do |tmpfile|
|
61
|
-
Path.setup(tmpfile)
|
62
|
-
obj = "TEST\nTEST"
|
63
|
-
stream = StringIO.new obj
|
64
|
-
stream.rewind
|
65
|
-
res1 = Persist.persist(tmpfile, :string, :dir => tmpdir.persist, :tee_copies => 2){ stream }
|
66
|
-
res2 = res1.next
|
67
|
-
assert IO === res1
|
68
|
-
assert_equal obj, res1.read
|
69
|
-
assert_equal obj, res2.read
|
70
|
-
assert_equal obj, Persist.persist(tmpfile, :string, :dir => tmpdir.persist){ raise ScoutException }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_update_time
|
75
|
-
TmpFile.with_file do |dir|
|
76
|
-
Path.setup(dir)
|
77
|
-
obj = "TEST"
|
78
|
-
type = :string
|
79
|
-
|
80
|
-
Open.write(dir.file, "TEST")
|
81
|
-
assert_equal "TEST", Persist.persist(dir.cache, type, :dir => tmpdir.persist){ Open.read(dir.file) }
|
82
|
-
Open.rm(dir.file)
|
83
|
-
assert_equal "TEST", Persist.persist(dir.cache, type, :dir => tmpdir.persist){ Open.read(dir.file) }
|
84
|
-
|
85
|
-
sleep 1
|
86
|
-
Open.write(dir.file2, "TEST2")
|
87
|
-
assert_equal "TEST", Persist.persist(dir.cache, type, :dir => tmpdir.persist){ Open.read(dir.file2) }
|
88
|
-
assert_equal "TEST2", Persist.persist(dir.cache, type, :dir => tmpdir.persist, :update => dir.file2){ Open.read(dir.file2) }
|
89
|
-
|
90
|
-
sleep 1
|
91
|
-
Open.write(dir.file3, "TEST3")
|
92
|
-
sleep 1
|
93
|
-
Open.touch tmpdir.persist.glob("*").first
|
94
|
-
assert_equal "TEST2", Persist.persist(dir.cache, type, :dir => tmpdir.persist, :update => dir.file3){ Open.read(dir.file3) }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_concurrent
|
99
|
-
num = 10
|
100
|
-
|
101
|
-
s = 0.01
|
102
|
-
10.times do
|
103
|
-
TmpFile.with_file do |file|
|
104
|
-
output1 = file + '.output1'
|
105
|
-
output2 = file + '.output2'
|
106
|
-
pid1 = Process.fork do
|
107
|
-
Open.purge_pipes
|
108
|
-
sleep rand/10.0
|
109
|
-
io = Persist.persist("test", :string, :path => file) do
|
110
|
-
Open.open_pipe do |sin|
|
111
|
-
num.times do |i|
|
112
|
-
sin.puts "line-#{i}-#{Process.pid}"
|
113
|
-
sleep s
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
if IO === io
|
119
|
-
Open.consume_stream(io, false)
|
120
|
-
else
|
121
|
-
Open.write(output1, io)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
pid2 = Process.fork do
|
125
|
-
Open.purge_pipes
|
126
|
-
sleep rand/10.0
|
127
|
-
io = Persist.persist("test", :string, :path => file) do
|
128
|
-
Open.open_pipe do |sin|
|
129
|
-
num.times do |i|
|
130
|
-
sin.puts "line-#{i}-#{Process.pid}"
|
131
|
-
sleep s
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
if IO === io
|
136
|
-
Open.consume_stream(io, false)
|
137
|
-
else
|
138
|
-
Open.write(output2, io)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
Process.waitpid pid1
|
142
|
-
Process.waitpid pid2
|
143
|
-
|
144
|
-
assert File.exist?(output1) || File.exist?(output2)
|
145
|
-
[pid1, pid2].zip([output2, output1]).each do |pid, found|
|
146
|
-
next unless File.exist?(found)
|
147
|
-
assert Open.read(found).include? "-#{pid}\n"
|
148
|
-
end
|
149
|
-
[pid1, pid2].zip([output1, output2]).each do |pid, found|
|
150
|
-
next unless File.exist?(found)
|
151
|
-
refute Open.read(found).include? "-#{pid}\n"
|
152
|
-
end
|
153
|
-
Open.rm file
|
154
|
-
Open.rm output1
|
155
|
-
Open.rm output2
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_path_prefix
|
161
|
-
Persist.persist('foo', :tsv, :prefix => "TSV") do |filename|
|
162
|
-
assert File.basename(filename).start_with? "TSV"
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
def __test_speed
|
167
|
-
times = 100_000
|
168
|
-
TmpFile.with_file do |tmpfile|
|
169
|
-
sout = Persist.persist(tmpfile, :string, :path => tmpfile) do
|
170
|
-
Open.open_pipe do |sin|
|
171
|
-
times.times do |i|
|
172
|
-
sin.puts "line-#{i}"
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
Log::ProgressBar.with_bar do |bar|
|
178
|
-
while l = sout.gets
|
179
|
-
bar.tick
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
end
|
186
|
-
|
data/test/scout/test_resource.rb
DELETED
@@ -1,26 +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
|
-
class TestResourceUnit < Test::Unit::TestCase
|
5
|
-
module TestResource
|
6
|
-
extend Resource
|
7
|
-
|
8
|
-
self.subdir = Path.setup('tmp/test-resource')
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
def test_root
|
13
|
-
|
14
|
-
p = TestResource.root.some_file
|
15
|
-
assert p.find(:user).include?(ENV["HOME"])
|
16
|
-
end
|
17
|
-
|
18
|
-
def __test_identify
|
19
|
-
assert_equal 'etc/', Rbbt.identify(File.join(ENV["HOME"], '.rbbt/etc/'))
|
20
|
-
assert_equal 'share/databases/', Rbbt.identify('/usr/local/share/rbbt/databases/')
|
21
|
-
assert_equal 'share/databases/DATABASE', Rbbt.identify('/usr/local/share/rbbt/databases/DATABASE')
|
22
|
-
assert_equal 'share/databases/DATABASE/FILE', Rbbt.identify('/usr/local/share/rbbt/databases/DATABASE/FILE')
|
23
|
-
assert_equal 'share/databases/DATABASE/FILE', Rbbt.identify(File.join(ENV["HOME"], '.rbbt/share/databases/DATABASE/FILE'))
|
24
|
-
assert_equal 'share/databases/DATABASE/FILE', Rbbt.identify('/usr/local/share/rbbt/databases/DATABASE/FILE')
|
25
|
-
end
|
26
|
-
end
|
data/test/scout/test_tmpfile.rb
DELETED
@@ -1,53 +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
|
-
class TestTmpFile < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def test_tmp_file
|
7
|
-
assert(TmpFile.tmp_file("test") =~ /(tmpfiles|tmp)\/test\d+$/)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_do_tmp_file
|
11
|
-
content = "Hello World!"
|
12
|
-
TmpFile.with_file(content) do |file|
|
13
|
-
assert_equal content, File.open(file).read
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_do_tmp_file_io
|
18
|
-
content = "Hello World!"
|
19
|
-
TmpFile.with_file(content) do |file1|
|
20
|
-
File.open(file1) do |io|
|
21
|
-
TmpFile.with_file(io) do |file|
|
22
|
-
assert_equal content, File.open(file).read
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_extension
|
29
|
-
TmpFile.with_file(nil, true, :extension => 'txt') do |file|
|
30
|
-
assert file =~ /\.txt$/
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_tmpdir
|
35
|
-
TmpFile.with_file(nil, true, :tmpdir => TmpFile.user_tmp("TMPDIR")) do |file|
|
36
|
-
assert file =~ /TMPDIR/
|
37
|
-
end
|
38
|
-
|
39
|
-
TmpFile.tmpdir = TmpFile.user_tmp("TMPDIR")
|
40
|
-
|
41
|
-
TmpFile.with_file do |file|
|
42
|
-
assert file =~ /TMPDIR/
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_in_dir
|
47
|
-
TmpFile.in_dir do |dir|
|
48
|
-
assert_equal_path dir, FileUtils.pwd
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
File without changes
|