rbbt-util 5.44.1 → 6.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/bin/rbbt +67 -90
- data/bin/rbbt_exec.rb +2 -2
- data/etc/app.d/base.rb +2 -2
- data/etc/app.d/semaphores.rb +3 -3
- data/lib/rbbt/annotations/annotated_array.rb +207 -207
- data/lib/rbbt/annotations/refactor.rb +27 -0
- data/lib/rbbt/annotations/util.rb +282 -282
- data/lib/rbbt/annotations.rb +343 -320
- data/lib/rbbt/association/database.rb +200 -225
- data/lib/rbbt/association/index.rb +294 -291
- data/lib/rbbt/association/item.rb +227 -227
- data/lib/rbbt/association/open.rb +35 -34
- data/lib/rbbt/association/util.rb +0 -169
- data/lib/rbbt/association.rb +2 -4
- data/lib/rbbt/entity/identifiers.rb +119 -118
- data/lib/rbbt/entity/refactor.rb +12 -0
- data/lib/rbbt/entity.rb +319 -315
- data/lib/rbbt/hpc/batch.rb +72 -53
- data/lib/rbbt/hpc/lsf.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/batches.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/chains.rb +25 -5
- data/lib/rbbt/hpc/orchestrate/rules.rb +2 -2
- data/lib/rbbt/hpc/orchestrate.rb +19 -13
- data/lib/rbbt/hpc/slurm.rb +18 -18
- data/lib/rbbt/knowledge_base/entity.rb +13 -5
- data/lib/rbbt/knowledge_base/query.rb +2 -2
- data/lib/rbbt/knowledge_base/registry.rb +32 -31
- data/lib/rbbt/knowledge_base/traverse.rb +1 -1
- data/lib/rbbt/knowledge_base.rb +1 -1
- data/lib/rbbt/monitor.rb +36 -25
- data/lib/rbbt/persist/refactor.rb +166 -0
- data/lib/rbbt/persist/tsv/tokyocabinet.rb +105 -105
- data/lib/rbbt/persist/tsv.rb +187 -185
- data/lib/rbbt/persist.rb +556 -551
- data/lib/rbbt/refactor.rb +20 -0
- data/lib/rbbt/resource/path/refactor.rb +178 -0
- data/lib/rbbt/resource/path.rb +317 -497
- data/lib/rbbt/resource/util.rb +0 -48
- data/lib/rbbt/resource.rb +3 -390
- data/lib/rbbt/tsv/accessor.rb +2 -838
- data/lib/rbbt/tsv/attach.rb +303 -299
- data/lib/rbbt/tsv/change_id.rb +244 -245
- data/lib/rbbt/tsv/csv.rb +87 -85
- data/lib/rbbt/tsv/dumper.rb +2 -100
- data/lib/rbbt/tsv/excel.rb +26 -24
- data/lib/rbbt/tsv/field_index.rb +4 -1
- data/lib/rbbt/tsv/filter.rb +3 -2
- data/lib/rbbt/tsv/index.rb +2 -284
- data/lib/rbbt/tsv/manipulate.rb +750 -747
- data/lib/rbbt/tsv/marshal.rb +3 -3
- data/lib/rbbt/tsv/matrix.rb +2 -2
- data/lib/rbbt/tsv/parallel/through.rb +2 -1
- data/lib/rbbt/tsv/parallel/traverse.rb +783 -781
- data/lib/rbbt/tsv/parser.rb +678 -678
- data/lib/rbbt/tsv/refactor.rb +195 -0
- data/lib/rbbt/tsv/stream.rb +253 -251
- data/lib/rbbt/tsv/util.rb +420 -420
- data/lib/rbbt/tsv.rb +210 -208
- data/lib/rbbt/util/R/eval.rb +4 -4
- data/lib/rbbt/util/R/plot.rb +62 -166
- data/lib/rbbt/util/R.rb +21 -18
- data/lib/rbbt/util/cmd.rb +2 -318
- data/lib/rbbt/util/color.rb +269 -269
- data/lib/rbbt/util/colorize.rb +89 -89
- data/lib/rbbt/util/concurrency/processes/refactor.rb +22 -0
- data/lib/rbbt/util/concurrency/processes/worker.rb +2 -2
- data/lib/rbbt/util/concurrency/processes.rb +389 -386
- data/lib/rbbt/util/config.rb +169 -167
- data/lib/rbbt/util/filecache.rb +1 -1
- data/lib/rbbt/util/iruby.rb +20 -0
- data/lib/rbbt/util/log/progress/report.rb +241 -241
- data/lib/rbbt/util/log/progress/util.rb +99 -99
- data/lib/rbbt/util/log/progress.rb +102 -102
- data/lib/rbbt/util/log/refactor.rb +49 -0
- data/lib/rbbt/util/log.rb +486 -532
- data/lib/rbbt/util/migrate.rb +2 -2
- data/lib/rbbt/util/misc/concurrent_stream.rb +248 -246
- data/lib/rbbt/util/misc/development.rb +12 -11
- data/lib/rbbt/util/misc/exceptions.rb +117 -112
- data/lib/rbbt/util/misc/format.rb +2 -230
- data/lib/rbbt/util/misc/indiferent_hash.rb +2 -107
- data/lib/rbbt/util/misc/inspect.rb +2 -476
- data/lib/rbbt/util/misc/lock.rb +109 -106
- data/lib/rbbt/util/misc/omics.rb +9 -1
- data/lib/rbbt/util/misc/pipes.rb +765 -793
- data/lib/rbbt/util/misc/refactor.rb +20 -0
- data/lib/rbbt/util/misc/ssw.rb +27 -17
- data/lib/rbbt/util/misc/system.rb +92 -105
- data/lib/rbbt/util/misc.rb +39 -20
- data/lib/rbbt/util/named_array/refactor.rb +4 -0
- data/lib/rbbt/util/named_array.rb +3 -220
- data/lib/rbbt/util/open/refactor.rb +7 -0
- data/lib/rbbt/util/open.rb +3 -857
- data/lib/rbbt/util/procpath.rb +6 -6
- data/lib/rbbt/util/python/paths.rb +27 -0
- data/lib/rbbt/util/python/run.rb +115 -0
- data/lib/rbbt/util/python/script.rb +110 -0
- data/lib/rbbt/util/python/util.rb +3 -3
- data/lib/rbbt/util/python.rb +22 -81
- data/lib/rbbt/util/semaphore.rb +152 -148
- data/lib/rbbt/util/simpleopt.rb +9 -8
- data/lib/rbbt/util/ssh/refactor.rb +19 -0
- data/lib/rbbt/util/ssh.rb +122 -118
- data/lib/rbbt/util/tar.rb +117 -115
- data/lib/rbbt/util/tmpfile.rb +69 -67
- data/lib/rbbt/util/version.rb +2 -0
- data/lib/rbbt/workflow/refactor/entity.rb +11 -0
- data/lib/rbbt/workflow/refactor/export.rb +66 -0
- data/lib/rbbt/workflow/refactor/inputs.rb +24 -0
- data/lib/rbbt/workflow/refactor/recursive.rb +64 -0
- data/lib/rbbt/workflow/refactor/task_info.rb +66 -0
- data/lib/rbbt/workflow/refactor.rb +150 -0
- data/lib/rbbt/workflow/remote_workflow/driver/rest.rb +1 -2
- data/lib/rbbt/workflow/remote_workflow/driver/ssh.rb +55 -32
- data/lib/rbbt/workflow/remote_workflow/remote_step/rest.rb +3 -1
- data/lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb +14 -5
- data/lib/rbbt/workflow/remote_workflow/remote_step.rb +19 -7
- data/lib/rbbt/workflow/remote_workflow.rb +6 -1
- data/lib/rbbt/workflow/step/run.rb +766 -766
- data/lib/rbbt/workflow/step/save_load_inputs.rb +254 -254
- data/lib/rbbt/workflow/step.rb +2 -362
- data/lib/rbbt/workflow/task.rb +118 -118
- data/lib/rbbt/workflow/usage.rb +289 -287
- data/lib/rbbt/workflow/util/archive.rb +6 -5
- data/lib/rbbt/workflow/util/data.rb +1 -1
- data/lib/rbbt/workflow/util/orchestrator.rb +249 -246
- data/lib/rbbt/workflow/util/trace.rb +79 -44
- data/lib/rbbt/workflow.rb +4 -882
- data/lib/rbbt-util.rb +21 -13
- data/lib/rbbt.rb +16 -3
- data/python/rbbt/__init__.py +96 -4
- data/python/rbbt/workflow/remote.py +104 -0
- data/python/rbbt/workflow.py +64 -0
- data/python/test.py +10 -0
- data/share/Rlib/plot.R +37 -37
- data/share/Rlib/svg.R +22 -5
- data/share/install/software/lib/install_helpers +1 -1
- data/share/rbbt_commands/hpc/list +2 -3
- data/share/rbbt_commands/hpc/orchestrate +4 -4
- data/share/rbbt_commands/hpc/tail +2 -0
- data/share/rbbt_commands/hpc/task +10 -7
- data/share/rbbt_commands/lsf/list +2 -3
- data/share/rbbt_commands/lsf/orchestrate +4 -4
- data/share/rbbt_commands/lsf/tail +2 -0
- data/share/rbbt_commands/lsf/task +10 -7
- data/share/rbbt_commands/migrate +1 -1
- data/share/rbbt_commands/pbs/list +2 -3
- data/share/rbbt_commands/pbs/orchestrate +4 -4
- data/share/rbbt_commands/pbs/tail +2 -0
- data/share/rbbt_commands/pbs/task +10 -7
- data/share/rbbt_commands/resource/produce +8 -1
- data/share/rbbt_commands/slurm/list +2 -3
- data/share/rbbt_commands/slurm/orchestrate +4 -4
- data/share/rbbt_commands/slurm/tail +2 -0
- data/share/rbbt_commands/slurm/task +10 -7
- data/share/rbbt_commands/system/clean +5 -5
- data/share/rbbt_commands/system/status +5 -5
- data/share/rbbt_commands/tsv/get +2 -3
- data/share/rbbt_commands/tsv/info +10 -13
- data/share/rbbt_commands/tsv/keys +18 -14
- data/share/rbbt_commands/tsv/slice +2 -2
- data/share/rbbt_commands/tsv/transpose +6 -2
- data/share/rbbt_commands/workflow/info +20 -24
- data/share/rbbt_commands/workflow/list +1 -1
- data/share/rbbt_commands/workflow/prov +20 -13
- data/share/rbbt_commands/workflow/retry +43 -0
- data/share/rbbt_commands/workflow/server +12 -2
- data/share/rbbt_commands/workflow/task +80 -73
- data/share/rbbt_commands/workflow/write_info +26 -9
- data/share/software/opt/ssw/ssw.c +861 -0
- data/share/software/opt/ssw/ssw.h +130 -0
- data/share/workflow_config.ru +3 -3
- metadata +45 -6
data/lib/rbbt/util/migrate.rb
CHANGED
@@ -6,7 +6,7 @@ module Rbbt
|
|
6
6
|
require 'rbbt-util'
|
7
7
|
path = "#{path}"
|
8
8
|
if Open.exists?(path)
|
9
|
-
path = #{resource.to_s}.identify(path)
|
9
|
+
path = Path.setup(#{resource.to_s}.identify(path))
|
10
10
|
else
|
11
11
|
path = Path.setup(path)
|
12
12
|
end
|
@@ -66,7 +66,7 @@ puts resource[path].find(search_path)
|
|
66
66
|
target += "/" unless target.end_with? '/'
|
67
67
|
end
|
68
68
|
|
69
|
-
next if source_path == target
|
69
|
+
next if source_path == target && ! (options[:source] || options[:target])
|
70
70
|
|
71
71
|
if options[:target]
|
72
72
|
CMD.cmd("ssh #{options[:target]} mkdir -p '#{File.dirname(target)}'")
|
@@ -1,246 +1,248 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
stream.
|
18
|
-
|
19
|
-
stream.threads
|
20
|
-
stream.pids
|
21
|
-
stream.
|
22
|
-
stream.
|
23
|
-
stream.
|
24
|
-
|
25
|
-
stream.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
stream.
|
55
|
-
|
56
|
-
stream.
|
57
|
-
|
58
|
-
stream
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
msg = "Error joining #{self.filename || self.inspect}"
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
Log.low "
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
@callback
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
@threads.
|
152
|
-
|
153
|
-
|
154
|
-
t
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
@
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
self.
|
244
|
-
|
245
|
-
|
246
|
-
end
|
1
|
+
require_relative '../../refactor'
|
2
|
+
Rbbt.require_instead 'scout/concurrent_stream'
|
3
|
+
#module AbortedStream
|
4
|
+
# attr_accessor :exception
|
5
|
+
# def self.setup(obj, exception = nil)
|
6
|
+
# obj.extend AbortedStream
|
7
|
+
# obj.exception = exception
|
8
|
+
# end
|
9
|
+
#end
|
10
|
+
#
|
11
|
+
#module ConcurrentStream
|
12
|
+
# attr_accessor :threads, :pids, :callback, :abort_callback, :filename, :joined, :aborted, :autojoin, :lockfile, :no_fail, :pair, :thread, :stream_exception, :log, :std_err
|
13
|
+
#
|
14
|
+
# def self.setup(stream, options = {}, &block)
|
15
|
+
#
|
16
|
+
# threads, pids, callback, abort_callback, filename, autojoin, lockfile, no_fail, pair = Misc.process_options options, :threads, :pids, :callback, :abort_callback, :filename, :autojoin, :lockfile, :no_fail, :pair
|
17
|
+
# stream.extend ConcurrentStream unless ConcurrentStream === stream
|
18
|
+
#
|
19
|
+
# stream.threads ||= []
|
20
|
+
# stream.pids ||= []
|
21
|
+
# stream.threads.concat(Array === threads ? threads : [threads]) unless threads.nil?
|
22
|
+
# stream.pids.concat(Array === pids ? pids : [pids]) unless pids.nil? or pids.empty?
|
23
|
+
# stream.autojoin = autojoin unless autojoin.nil?
|
24
|
+
# stream.no_fail = no_fail unless no_fail.nil?
|
25
|
+
# stream.std_err = ""
|
26
|
+
#
|
27
|
+
# stream.pair = pair unless pair.nil?
|
28
|
+
#
|
29
|
+
# callback = block if block_given?
|
30
|
+
# if callback
|
31
|
+
# if stream.callback
|
32
|
+
# old_callback = stream.callback
|
33
|
+
# stream.callback = Proc.new do
|
34
|
+
# old_callback.call
|
35
|
+
# callback.call
|
36
|
+
# end
|
37
|
+
# else
|
38
|
+
# stream.callback = callback
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# if abort_callback
|
43
|
+
# if stream.abort_callback
|
44
|
+
# old_abort_callback = stream.abort_callback
|
45
|
+
# stream.abort_callback = Proc.new do
|
46
|
+
# old_abort_callback.call
|
47
|
+
# abort_callback.call
|
48
|
+
# end
|
49
|
+
# else
|
50
|
+
# stream.abort_callback = abort_callback
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# stream.filename = filename unless filename.nil?
|
55
|
+
#
|
56
|
+
# stream.lockfile = lockfile unless lockfile.nil?
|
57
|
+
#
|
58
|
+
# stream.aborted = false
|
59
|
+
#
|
60
|
+
# stream
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# def annotate(stream)
|
64
|
+
# ConcurrentStream.setup(stream, :threads => threads, :pids => pids, :callback => callback, :abort_callback => abort_callback, :filename => filename, :autojoin => autojoin, :lockfile => lockfile)
|
65
|
+
# stream
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# def clear
|
69
|
+
# threads, pids, callback, abort_callback, joined = nil
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# def joined?
|
73
|
+
# @joined
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# def aborted?
|
77
|
+
# @aborted
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# def join_threads
|
81
|
+
# if @threads and @threads.any?
|
82
|
+
# @threads.each do |t|
|
83
|
+
# next if t == Thread.current
|
84
|
+
# begin
|
85
|
+
# t.join
|
86
|
+
# if Process::Status === t.value
|
87
|
+
# if ! (t.value.success? || no_fail)
|
88
|
+
#
|
89
|
+
# if log
|
90
|
+
# msg = "Error joining #{self.filename || self.inspect}. Last log line: #{log}"
|
91
|
+
# else
|
92
|
+
# msg = "Error joining #{self.filename || self.inspect}"
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# raise ConcurrentStreamProcessFailed.new t.pid, msg, self
|
96
|
+
# end
|
97
|
+
# end
|
98
|
+
# rescue Exception
|
99
|
+
# if no_fail
|
100
|
+
# Log.low "Not failing on exception joining thread in ConcurrenStream: #{filename}"
|
101
|
+
# else
|
102
|
+
# Log.low "Exception joining thread in ConcurrenStream: #{filename}"
|
103
|
+
# stream_raise_exception $!
|
104
|
+
# end
|
105
|
+
# end
|
106
|
+
# end
|
107
|
+
# end
|
108
|
+
# @threads = []
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
# def join_pids
|
112
|
+
# if @pids and @pids.any?
|
113
|
+
# @pids.each do |pid|
|
114
|
+
# begin
|
115
|
+
# Process.waitpid(pid, Process::WUNTRACED)
|
116
|
+
# stream_raise_exception ConcurrentStreamProcessFailed.new(pid, "Error in waitpid", self) unless $?.success? or no_fail
|
117
|
+
# rescue Errno::ECHILD
|
118
|
+
# end
|
119
|
+
# end
|
120
|
+
# @pids = []
|
121
|
+
# end
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# def join_callback
|
125
|
+
# if @callback and not joined?
|
126
|
+
# begin
|
127
|
+
# @callback.call
|
128
|
+
# ensure
|
129
|
+
# @callback = nil
|
130
|
+
# end
|
131
|
+
# end
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# def join
|
135
|
+
# begin
|
136
|
+
# join_threads
|
137
|
+
# join_pids
|
138
|
+
# join_callback
|
139
|
+
# close unless closed?
|
140
|
+
# ensure
|
141
|
+
# @joined = true
|
142
|
+
# lockfile.unlock if lockfile and lockfile.locked?
|
143
|
+
# raise stream_exception if stream_exception
|
144
|
+
# end
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# def abort_threads(exception = nil)
|
148
|
+
# return unless @threads and @threads.any?
|
149
|
+
# name = Thread.current.inspect
|
150
|
+
# name = filename if filename
|
151
|
+
# Log.low "Aborting threads (#{name}) #{@threads.collect{|t| t.inspect } * ", "}"
|
152
|
+
#
|
153
|
+
# @threads.each do |t|
|
154
|
+
# next if t == Thread.current
|
155
|
+
# Log.debug "Aborting thread (#{name}) #{t.inspect} with exception: #{exception}"
|
156
|
+
# t.raise((exception.nil? ? Aborted.new : exception))
|
157
|
+
# end
|
158
|
+
#
|
159
|
+
# @threads.each do |t|
|
160
|
+
# next if t == Thread.current
|
161
|
+
# if t.alive?
|
162
|
+
# sleep 1
|
163
|
+
# Log.low "Kill thread (#{name}) #{t.inspect}"
|
164
|
+
# t.kill
|
165
|
+
# end
|
166
|
+
# begin
|
167
|
+
# t.join unless t == Thread.current
|
168
|
+
# rescue Aborted
|
169
|
+
# rescue Exception
|
170
|
+
# Log.debug "Thread (#{name}) exception: #{$!.message}"
|
171
|
+
# end
|
172
|
+
# end
|
173
|
+
# end
|
174
|
+
#
|
175
|
+
# def abort_pids
|
176
|
+
# @pids.each do |pid|
|
177
|
+
# begin
|
178
|
+
# Log.low "Killing PID #{pid} in ConcurrentStream #{filename}"
|
179
|
+
# Process.kill :INT, pid
|
180
|
+
# rescue Errno::ESRCH
|
181
|
+
# end
|
182
|
+
# end if @pids
|
183
|
+
# @pids = []
|
184
|
+
# end
|
185
|
+
#
|
186
|
+
# def abort(exception = nil)
|
187
|
+
# if @aborted
|
188
|
+
# Log.medium "Already aborted stream #{Misc.fingerprint self} [#{@aborted}]"
|
189
|
+
# return
|
190
|
+
# else
|
191
|
+
# Log.medium "Aborting stream #{Misc.fingerprint self} [#{@aborted}]"
|
192
|
+
# end
|
193
|
+
# AbortedStream.setup(self, exception)
|
194
|
+
# @aborted = true
|
195
|
+
# begin
|
196
|
+
# close unless closed?
|
197
|
+
#
|
198
|
+
# @abort_callback.call exception if @abort_callback
|
199
|
+
#
|
200
|
+
# abort_threads(exception)
|
201
|
+
# abort_pids
|
202
|
+
#
|
203
|
+
# @callback = nil
|
204
|
+
# @abort_callback = nil
|
205
|
+
#
|
206
|
+
# @pair.abort exception if @pair
|
207
|
+
# ensure
|
208
|
+
# if lockfile and lockfile.locked?
|
209
|
+
# lockfile.unlock
|
210
|
+
# end
|
211
|
+
# end
|
212
|
+
# end
|
213
|
+
#
|
214
|
+
# def close(*args)
|
215
|
+
# if autojoin
|
216
|
+
# begin
|
217
|
+
# super(*args)
|
218
|
+
# rescue
|
219
|
+
# Log.exception $!
|
220
|
+
# self.abort
|
221
|
+
# self.join
|
222
|
+
# stream_raise_exception $!
|
223
|
+
# ensure
|
224
|
+
# self.join if self.closed? or self.eof?
|
225
|
+
# end
|
226
|
+
# else
|
227
|
+
# super(*args)
|
228
|
+
# end
|
229
|
+
# end
|
230
|
+
#
|
231
|
+
# def add_callback(&block)
|
232
|
+
# old_callback = callback
|
233
|
+
# @callback = Proc.new do
|
234
|
+
# old_callback.call if old_callback
|
235
|
+
# block.call
|
236
|
+
# end
|
237
|
+
# end
|
238
|
+
#
|
239
|
+
# def stream_raise_exception(exception)
|
240
|
+
# threads.each do |thread|
|
241
|
+
# thread.raise exception
|
242
|
+
# end
|
243
|
+
# self.stream_exception = exception
|
244
|
+
#
|
245
|
+
# self.abort
|
246
|
+
# end
|
247
|
+
#
|
248
|
+
#end
|
@@ -193,15 +193,15 @@ module Misc
|
|
193
193
|
insist(3, &block)
|
194
194
|
end
|
195
195
|
|
196
|
-
def self.chunk(array, num)
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
end
|
196
|
+
#def self.chunk(array, num)
|
197
|
+
# total = array.length
|
198
|
+
# current = 0
|
199
|
+
# while current < total
|
200
|
+
# last = current + num - 1
|
201
|
+
# yield array[current..last]
|
202
|
+
# current = last + 1
|
203
|
+
# end
|
204
|
+
#end
|
205
205
|
|
206
206
|
# Divides the array into +num+ chunks of the same size by placing one
|
207
207
|
# element in each chunk iteratively.
|
@@ -335,13 +335,14 @@ module Misc
|
|
335
335
|
end
|
336
336
|
|
337
337
|
|
338
|
+
cpus = 1 if cpus <= 0
|
338
339
|
options = Misc.add_defaults options, :respawn => true, :cpus => cpus
|
339
|
-
options = Misc.add_defaults options, :bar => "Bootstrap in #{ options[:cpus] } cpus: #{ Misc.fingerprint
|
340
|
+
options = Misc.add_defaults options, :bar => "Bootstrap in #{ options[:cpus] } cpus: #{ Misc.fingerprint Annotation.purge(elems) }"
|
340
341
|
respawn = options[:respawn] and options[:cpus] and options[:cpus].to_i > 1
|
341
342
|
|
342
343
|
index = (0..elems.length-1).to_a.collect{|v| v.to_s }
|
343
344
|
|
344
|
-
TSV.traverse index, options do |pos|
|
345
|
+
TSV.traverse index, **options do |pos|
|
345
346
|
if num == :current
|
346
347
|
$BOOTSTRAPPED_CURRENT ||= n
|
347
348
|
$BOOTSTRAPPED_CURRENT += 0
|