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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +3 -3
  3. data/Rakefile +1 -2
  4. data/VERSION +1 -1
  5. data/lib/scout/offsite/exceptions.rb +9 -0
  6. data/lib/scout/offsite/ssh.rb +1 -0
  7. data/lib/scout/semaphore.rb +2 -0
  8. data/lib/scout/tsv/open.rb +1 -1
  9. data/lib/scout/tsv/parser.rb +1 -1
  10. data/lib/scout/tsv/persist/adapter.rb +2 -2
  11. data/lib/scout/tsv/persist.rb +1 -0
  12. data/lib/scout/tsv.rb +1 -1
  13. data/lib/scout/work_queue/exceptions.rb +18 -0
  14. data/lib/scout/work_queue.rb +1 -0
  15. data/lib/scout/workflow/definition.rb +1 -1
  16. data/lib/scout/workflow/step/config.rb +1 -1
  17. data/lib/scout/workflow/step.rb +2 -2
  18. data/lib/scout/workflow/task/inputs.rb +1 -1
  19. data/lib/scout/workflow/task.rb +2 -2
  20. data/lib/scout/workflow.rb +2 -2
  21. data/lib/scout-gear.rb +1 -10
  22. data/scout-gear.gemspec +8 -98
  23. data/test/scout/workflow/task/test_inputs.rb +0 -4
  24. metadata +7 -110
  25. data/lib/scout/cmd.rb +0 -347
  26. data/lib/scout/concurrent_stream.rb +0 -284
  27. data/lib/scout/config.rb +0 -168
  28. data/lib/scout/exceptions.rb +0 -151
  29. data/lib/scout/indiferent_hash/case_insensitive.rb +0 -30
  30. data/lib/scout/indiferent_hash/options.rb +0 -115
  31. data/lib/scout/indiferent_hash.rb +0 -96
  32. data/lib/scout/log/color.rb +0 -224
  33. data/lib/scout/log/color_class.rb +0 -269
  34. data/lib/scout/log/fingerprint.rb +0 -69
  35. data/lib/scout/log/progress/report.rb +0 -244
  36. data/lib/scout/log/progress/util.rb +0 -173
  37. data/lib/scout/log/progress.rb +0 -106
  38. data/lib/scout/log/trap.rb +0 -107
  39. data/lib/scout/log.rb +0 -441
  40. data/lib/scout/meta_extension.rb +0 -100
  41. data/lib/scout/misc/digest.rb +0 -63
  42. data/lib/scout/misc/filesystem.rb +0 -25
  43. data/lib/scout/misc/format.rb +0 -255
  44. data/lib/scout/misc/helper.rb +0 -31
  45. data/lib/scout/misc/insist.rb +0 -56
  46. data/lib/scout/misc/monitor.rb +0 -66
  47. data/lib/scout/misc/system.rb +0 -73
  48. data/lib/scout/misc.rb +0 -10
  49. data/lib/scout/named_array.rb +0 -138
  50. data/lib/scout/open/lock/lockfile.rb +0 -587
  51. data/lib/scout/open/lock.rb +0 -68
  52. data/lib/scout/open/remote.rb +0 -135
  53. data/lib/scout/open/stream.rb +0 -491
  54. data/lib/scout/open/util.rb +0 -244
  55. data/lib/scout/open.rb +0 -170
  56. data/lib/scout/path/find.rb +0 -204
  57. data/lib/scout/path/tmpfile.rb +0 -8
  58. data/lib/scout/path/util.rb +0 -127
  59. data/lib/scout/path.rb +0 -51
  60. data/lib/scout/persist/open.rb +0 -17
  61. data/lib/scout/persist/path.rb +0 -15
  62. data/lib/scout/persist/serialize.rb +0 -157
  63. data/lib/scout/persist.rb +0 -104
  64. data/lib/scout/resource/open.rb +0 -8
  65. data/lib/scout/resource/path.rb +0 -80
  66. data/lib/scout/resource/produce/rake.rb +0 -69
  67. data/lib/scout/resource/produce.rb +0 -151
  68. data/lib/scout/resource/scout.rb +0 -3
  69. data/lib/scout/resource/software.rb +0 -178
  70. data/lib/scout/resource/util.rb +0 -59
  71. data/lib/scout/resource.rb +0 -41
  72. data/lib/scout/simple_opt/accessor.rb +0 -54
  73. data/lib/scout/simple_opt/doc.rb +0 -126
  74. data/lib/scout/simple_opt/get.rb +0 -57
  75. data/lib/scout/simple_opt/parse.rb +0 -67
  76. data/lib/scout/simple_opt/setup.rb +0 -26
  77. data/lib/scout/simple_opt.rb +0 -5
  78. data/lib/scout/tmpfile.rb +0 -129
  79. data/test/scout/indiferent_hash/test_case_insensitive.rb +0 -16
  80. data/test/scout/indiferent_hash/test_options.rb +0 -46
  81. data/test/scout/log/test_progress.rb +0 -108
  82. data/test/scout/misc/test_digest.rb +0 -30
  83. data/test/scout/misc/test_filesystem.rb +0 -30
  84. data/test/scout/misc/test_insist.rb +0 -13
  85. data/test/scout/misc/test_system.rb +0 -21
  86. data/test/scout/open/test_lock.rb +0 -52
  87. data/test/scout/open/test_remote.rb +0 -25
  88. data/test/scout/open/test_stream.rb +0 -676
  89. data/test/scout/open/test_util.rb +0 -73
  90. data/test/scout/path/test_find.rb +0 -119
  91. data/test/scout/path/test_util.rb +0 -22
  92. data/test/scout/persist/test_open.rb +0 -37
  93. data/test/scout/persist/test_path.rb +0 -37
  94. data/test/scout/persist/test_serialize.rb +0 -114
  95. data/test/scout/resource/test_path.rb +0 -46
  96. data/test/scout/resource/test_produce.rb +0 -92
  97. data/test/scout/resource/test_software.rb +0 -24
  98. data/test/scout/resource/test_util.rb +0 -36
  99. data/test/scout/simple_opt/test_doc.rb +0 -16
  100. data/test/scout/simple_opt/test_get.rb +0 -11
  101. data/test/scout/simple_opt/test_parse.rb +0 -10
  102. data/test/scout/simple_opt/test_setup.rb +0 -77
  103. data/test/scout/test_cmd.rb +0 -85
  104. data/test/scout/test_concurrent_stream.rb +0 -29
  105. data/test/scout/test_config.rb +0 -66
  106. data/test/scout/test_indiferent_hash.rb +0 -26
  107. data/test/scout/test_log.rb +0 -32
  108. data/test/scout/test_meta_extension.rb +0 -80
  109. data/test/scout/test_misc.rb +0 -6
  110. data/test/scout/test_named_array.rb +0 -43
  111. data/test/scout/test_open.rb +0 -146
  112. data/test/scout/test_path.rb +0 -54
  113. data/test/scout/test_persist.rb +0 -186
  114. data/test/scout/test_resource.rb +0 -26
  115. data/test/scout/test_tmpfile.rb +0 -53
  116. /data/test/scout/{log/test_color.rb → test_offsite.rb} +0 -0
@@ -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
-
@@ -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
@@ -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