rbbt-util 5.34.11 → 5.34.13
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/lib/rbbt/annotations/annotated_array.rb +2 -2
- data/lib/rbbt/annotations/util.rb +39 -19
- data/lib/rbbt/entity.rb +15 -10
- data/lib/rbbt/hpc/batch.rb +27 -3
- data/lib/rbbt/persist/tsv/adapter.rb +7 -2
- data/lib/rbbt/persist/tsv/tokyocabinet/marshal.rb +22 -0
- data/lib/rbbt/persist/tsv/tokyocabinet.rb +2 -0
- data/lib/rbbt/persist.rb +6 -0
- data/lib/rbbt/tsv/manipulate.rb +8 -7
- data/lib/rbbt/tsv/marshal.rb +17 -0
- data/lib/rbbt/tsv/util.rb +0 -10
- data/lib/rbbt/tsv.rb +1 -0
- data/lib/rbbt/util/concurrency/processes/socket.rb +5 -1
- data/lib/rbbt/util/misc/development.rb +11 -0
- data/lib/rbbt/util/misc/objects.rb +5 -4
- data/lib/rbbt/util/python/util.rb +2 -1
- data/share/rbbt_commands/hpc/clean +1 -1
- data/share/rbbt_commands/hpc/orchestrate +3 -1
- data/share/rbbt_commands/hpc/task +3 -1
- data/share/rbbt_commands/lsf/clean +1 -1
- data/share/rbbt_commands/lsf/orchestrate +3 -1
- data/share/rbbt_commands/lsf/task +3 -1
- data/share/rbbt_commands/slurm/clean +1 -1
- data/share/rbbt_commands/slurm/orchestrate +3 -1
- data/share/rbbt_commands/slurm/task +3 -1
- data/test/rbbt/annotations/test_util.rb +21 -2
- data/test/rbbt/tsv/test_marshal.rb +24 -0
- data/test/rbbt/tsv/test_util.rb +0 -16
- data/test/rbbt/util/misc/test_development.rb +11 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9481e1e7a7e7341b95824a48c314d2316a7283e356ea916b424edb2f15886616
|
|
4
|
+
data.tar.gz: 5012fb19a8cb88d1e9764a2b6ab049e203c38bc2daf758e112c8e256dca68565
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e72b2d6f831128ace58d54e62fdad1f180acdd74d9c73304cc315760dd66c7705b733d024b62794c165a2ea00cdbf6b1d67569f1b40a8e19822424a1638ecd1f
|
|
7
|
+
data.tar.gz: f8ffee23f77ac7024a06b50d7b48ba6db900080fa06e78d44e61dd4274b4843d6fd203644a5c9be0b730e1728a3b0550e32fc503401744737dcc2bed7401ce8d
|
|
@@ -61,8 +61,8 @@ module AnnotatedArray
|
|
|
61
61
|
|
|
62
62
|
value = annotate(value)
|
|
63
63
|
|
|
64
|
-
value.container = self
|
|
65
|
-
value.container_index = pos
|
|
64
|
+
value.container = self if value.respond_to?(:container)
|
|
65
|
+
value.container_index = pos if value.respond_to?(:container_index)
|
|
66
66
|
|
|
67
67
|
pos += 1
|
|
68
68
|
|
|
@@ -217,46 +217,66 @@ module Annotated
|
|
|
217
217
|
end
|
|
218
218
|
end
|
|
219
219
|
|
|
220
|
-
def marshal_dump
|
|
221
|
-
Annotated.purge(self).to_sym.to_s
|
|
222
|
-
end
|
|
223
|
-
|
|
224
220
|
def self.to_hash(e)
|
|
225
221
|
hash = {}
|
|
226
|
-
if Array === e &&
|
|
222
|
+
if Array === e && AnnotatedArray === e
|
|
227
223
|
hash[:literal] = Annotated.purge(e)
|
|
228
224
|
hash[:info] = e.info
|
|
229
225
|
elsif Array === e
|
|
230
226
|
hash = e.collect do |_e|
|
|
231
227
|
_hash = {}
|
|
232
|
-
_hash[:literal] = _e
|
|
233
|
-
_hash[:info] = _e.info
|
|
228
|
+
_hash[:literal] = _e.dup
|
|
229
|
+
_hash[:info] = _e.info if _e.respond_to?(:info)
|
|
234
230
|
_hash
|
|
235
231
|
end
|
|
236
232
|
else
|
|
237
|
-
hash[:literal] = e
|
|
233
|
+
hash[:literal] = e.dup
|
|
238
234
|
hash[:info] = e.info
|
|
239
235
|
end
|
|
240
236
|
hash
|
|
241
237
|
end
|
|
242
238
|
|
|
243
239
|
def self.load_hash(hash)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
240
|
+
if Array === hash
|
|
241
|
+
hash.collect{|h| load_hash(h) }
|
|
242
|
+
else
|
|
243
|
+
literal = hash[:literal]
|
|
244
|
+
info = hash[:info]
|
|
245
|
+
info[:annotation_types].each do |type|
|
|
246
|
+
type = Kernel.const_get(type) if String === type
|
|
247
|
+
type.setup(literal, info)
|
|
248
|
+
end
|
|
249
|
+
literal
|
|
249
250
|
end
|
|
250
|
-
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def marshal_dump
|
|
254
|
+
Annotated.to_hash(self)
|
|
251
255
|
end
|
|
252
256
|
end
|
|
253
257
|
|
|
254
258
|
class String
|
|
255
|
-
def marshal_load(
|
|
256
|
-
|
|
259
|
+
def marshal_load(hash)
|
|
260
|
+
if Hash === hash
|
|
261
|
+
e = Annotated.load_hash(hash)
|
|
262
|
+
self.replace e
|
|
263
|
+
e.annotate(self)
|
|
264
|
+
self
|
|
265
|
+
else
|
|
266
|
+
self.replace hash
|
|
267
|
+
end
|
|
257
268
|
end
|
|
258
269
|
end
|
|
259
270
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
271
|
+
class Array
|
|
272
|
+
def marshal_load(hash)
|
|
273
|
+
if Hash === hash
|
|
274
|
+
e = Annotated.load_hash(hash)
|
|
275
|
+
self.replace e
|
|
276
|
+
e.annotate(self)
|
|
277
|
+
self
|
|
278
|
+
else
|
|
279
|
+
self.replace hash
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
end
|
data/lib/rbbt/entity.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Entity
|
|
|
5
5
|
|
|
6
6
|
UNPERSISTED_PREFIX = "entity_unpersisted_property_"
|
|
7
7
|
|
|
8
|
-
class MultipleEntity <
|
|
8
|
+
class MultipleEntity < TryAgain; end
|
|
9
9
|
|
|
10
10
|
class DontPersist < Exception
|
|
11
11
|
attr_accessor :payload
|
|
@@ -120,10 +120,6 @@ module Entity
|
|
|
120
120
|
coder.scalar = clean_annotations
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
-
def marshal_dump
|
|
124
|
-
clean_annotations
|
|
125
|
-
end
|
|
126
|
-
|
|
127
123
|
def consolidate
|
|
128
124
|
self.inject(nil){|acc,e|
|
|
129
125
|
if acc.nil?
|
|
@@ -203,9 +199,11 @@ module Entity
|
|
|
203
199
|
end
|
|
204
200
|
|
|
205
201
|
define_method name do |*args|
|
|
202
|
+
|
|
206
203
|
if self.instance_variable_get("@multiple_result_" + name.to_s)
|
|
207
204
|
return self.instance_variable_get("@multiple_result_" + name.to_s)
|
|
208
205
|
end
|
|
206
|
+
|
|
209
207
|
obj = if Array === self
|
|
210
208
|
self
|
|
211
209
|
elsif self.respond_to?(:container) && Array === self.container
|
|
@@ -217,7 +215,8 @@ module Entity
|
|
|
217
215
|
missing = []
|
|
218
216
|
obj.each do |e|
|
|
219
217
|
begin
|
|
220
|
-
e.send(multi_name)
|
|
218
|
+
res = e.send(multi_name)
|
|
219
|
+
e.instance_variable_set("@multiple_result_" + name.to_s, res)
|
|
221
220
|
rescue MultipleEntity
|
|
222
221
|
missing << e
|
|
223
222
|
end
|
|
@@ -227,20 +226,26 @@ module Entity
|
|
|
227
226
|
case res
|
|
228
227
|
when Array
|
|
229
228
|
missing.zip(res).each do |o,res|
|
|
230
|
-
raise "Multiple function #{name} result nil for element #{o}" if res.nil?
|
|
229
|
+
raise "Multiple function '#{name}' result 'nil' for element '#{o}'" if res.nil?
|
|
231
230
|
o.instance_variable_set("@multiple_result_" + name.to_s, res)
|
|
231
|
+
o.send(multi_name)
|
|
232
232
|
end
|
|
233
233
|
when Hash
|
|
234
234
|
res.each do |o,res|
|
|
235
|
-
raise "Multiple function #{name} result nil for element #{o}" if res.nil?
|
|
235
|
+
raise "Multiple function '#{name}' result 'nil' for element '#{o}'" if res.nil?
|
|
236
236
|
o.instance_variable_set("@multiple_result_" + name.to_s, res)
|
|
237
|
+
o.send(multi_name)
|
|
237
238
|
end
|
|
238
239
|
end
|
|
239
240
|
|
|
240
241
|
if Array === self
|
|
241
|
-
self.collect{|o| o.send(multi_name)}
|
|
242
|
+
res = self.collect{|o| o.send(multi_name)}
|
|
243
|
+
self.instance_variable_set("@multiple_result_" + name.to_s, res)
|
|
244
|
+
res
|
|
242
245
|
else
|
|
243
|
-
self.send(multi_name)
|
|
246
|
+
res = self.send(multi_name)
|
|
247
|
+
self.instance_variable_set("@multiple_result_" + name.to_s, res)
|
|
248
|
+
res
|
|
244
249
|
end
|
|
245
250
|
end
|
|
246
251
|
|
data/lib/rbbt/hpc/batch.rb
CHANGED
|
@@ -51,9 +51,15 @@ module HPC
|
|
|
51
51
|
|
|
52
52
|
group, user, user_group, scratch_group_dir, projects_group_dir = options.values_at :group, :user, :user_group, :scratch_group_dir, :projects_group_dir
|
|
53
53
|
|
|
54
|
-
singularity_img, singularity_opt_dir, singularity_ruby_inline = options.values_at :singularity_img, :singularity_opt_dir, :singularity_ruby_inline
|
|
54
|
+
singularity_img, singularity_opt_dir, singularity_ruby_inline, singularity_mounts = options.values_at :singularity_img, :singularity_opt_dir, :singularity_ruby_inline, :singularity_mounts
|
|
55
|
+
|
|
56
|
+
singularity_cmd = %(singularity exec -e -B "#{File.expand_path singularity_opt_dir}":/singularity_opt/ -B "#{File.expand_path singularity_ruby_inline}":"/.singularity_ruby_inline":rw )
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
if singularity_mounts
|
|
59
|
+
singularity_mounts.split(",").each do |mount|
|
|
60
|
+
singularity_cmd += "-B #{ mount } "
|
|
61
|
+
end
|
|
62
|
+
end
|
|
57
63
|
|
|
58
64
|
if contain && options[:hardened]
|
|
59
65
|
singularity_cmd << %( -C -H "#{contain}" \
|
|
@@ -150,6 +156,7 @@ EOF
|
|
|
150
156
|
:mem_per_cpu,
|
|
151
157
|
:gres,
|
|
152
158
|
:lua_modules,
|
|
159
|
+
:conda,
|
|
153
160
|
:contraints,
|
|
154
161
|
:licenses,
|
|
155
162
|
:batch_dir,
|
|
@@ -167,6 +174,7 @@ EOF
|
|
|
167
174
|
:purge_deps,
|
|
168
175
|
:singularity,
|
|
169
176
|
:singularity_img,
|
|
177
|
+
:singularity_mounts,
|
|
170
178
|
:singularity_opt_dir,
|
|
171
179
|
:singularity_ruby_inline
|
|
172
180
|
]
|
|
@@ -188,6 +196,7 @@ EOF
|
|
|
188
196
|
:env_cmd,
|
|
189
197
|
:user_group,
|
|
190
198
|
:singularity_img,
|
|
199
|
+
:singularity_mounts,
|
|
191
200
|
:singularity_opt_dir,
|
|
192
201
|
:singularity_ruby_inline,
|
|
193
202
|
:singularity
|
|
@@ -284,6 +293,20 @@ EOF
|
|
|
284
293
|
str
|
|
285
294
|
end
|
|
286
295
|
|
|
296
|
+
def load_conda(env = nil)
|
|
297
|
+
return "" if env.nil? || env.empty?
|
|
298
|
+
|
|
299
|
+
<<-EOF
|
|
300
|
+
if ! type conda | grep function &> /dev/null; then
|
|
301
|
+
if [ ! -z $CONDA_EXE ]; then
|
|
302
|
+
source "$(dirname $(dirname $CONDA_EXE))/etc/profile.d/conda.sh" &> /dev/null
|
|
303
|
+
fi
|
|
304
|
+
fi
|
|
305
|
+
conda activate #{ env }
|
|
306
|
+
EOF
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
|
|
287
310
|
def batch_system_variables
|
|
288
311
|
<<-EOF
|
|
289
312
|
let MAX_MEMORY="$(grep MemTotal /proc/meminfo|grep -o "[[:digit:]]*") / 1024"
|
|
@@ -292,6 +315,7 @@ let MAX_MEMORY="$(grep MemTotal /proc/meminfo|grep -o "[[:digit:]]*") / 1024"
|
|
|
292
315
|
|
|
293
316
|
def prepare_environment(options = {})
|
|
294
317
|
modules = options[:lua_modules]
|
|
318
|
+
conda = options[:conda]
|
|
295
319
|
|
|
296
320
|
prepare_environment = ""
|
|
297
321
|
|
|
@@ -382,7 +406,7 @@ echo "user_scratch: #{scratch_group_dir}/#{user}/{PKGDIR}/{TOPLEVEL}/{SUBPATH}"
|
|
|
382
406
|
end
|
|
383
407
|
end
|
|
384
408
|
|
|
385
|
-
batch_system_variables + load_modules(modules) + "\n" + functions + "\n" + prepare_environment
|
|
409
|
+
batch_system_variables + load_modules(modules) + "\n" + load_conda(conda) + "\n" + functions + "\n" + prepare_environment
|
|
386
410
|
end
|
|
387
411
|
|
|
388
412
|
def execute(options)
|
|
@@ -193,8 +193,12 @@ module Persist
|
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
def range(*args)
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
begin
|
|
197
|
+
self.read_lock do
|
|
198
|
+
super(*args)
|
|
199
|
+
end
|
|
200
|
+
rescue
|
|
201
|
+
[]
|
|
198
202
|
end
|
|
199
203
|
end
|
|
200
204
|
|
|
@@ -266,5 +270,6 @@ module Persist
|
|
|
266
270
|
end
|
|
267
271
|
end
|
|
268
272
|
end
|
|
273
|
+
|
|
269
274
|
end
|
|
270
275
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Persist
|
|
2
|
+
module TCAdapter
|
|
3
|
+
def marshal_dump
|
|
4
|
+
[persistence_path, tokyocabinet_class]
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class TokyoCabinet::BDB
|
|
10
|
+
def marshal_load(values)
|
|
11
|
+
persistence_path, tokyocabinet_class = values
|
|
12
|
+
Persist::TCAdapter.open persistence_path, false, tokyocabinet_class
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class TokyoCabinet::HDB
|
|
17
|
+
def marshal_load(values)
|
|
18
|
+
persistence_path, tokyocabinet_class = values
|
|
19
|
+
Persist::TCAdapter.open persistence_path, false, tokyocabinet_class
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
data/lib/rbbt/persist.rb
CHANGED
|
@@ -359,6 +359,12 @@ module Persist
|
|
|
359
359
|
Log.exception $!
|
|
360
360
|
sleep 1 + rand(2)
|
|
361
361
|
retry
|
|
362
|
+
rescue TryAgain
|
|
363
|
+
begin
|
|
364
|
+
Open.rm path
|
|
365
|
+
rescue
|
|
366
|
+
end if Open.exists? path
|
|
367
|
+
raise $!
|
|
362
368
|
rescue Exception
|
|
363
369
|
Log.medium "Error in persist: #{path}#{Open.exists?(path) ? Log.color(:red, " Erasing") : ""}"
|
|
364
370
|
|
data/lib/rbbt/tsv/manipulate.rb
CHANGED
|
@@ -369,13 +369,14 @@ module TSV
|
|
|
369
369
|
def select(method = nil, invert = false, &block)
|
|
370
370
|
new = TSV.setup({}, :key_field => key_field, :fields => fields, :type => type, :filename => filename, :identifiers => identifiers)
|
|
371
371
|
|
|
372
|
-
new
|
|
373
|
-
new.
|
|
374
|
-
new.
|
|
375
|
-
new.
|
|
376
|
-
new.
|
|
377
|
-
new.
|
|
378
|
-
new.
|
|
372
|
+
self.annotate(new)
|
|
373
|
+
#new.key_field = key_field
|
|
374
|
+
#new.fields = fields.dup unless fields.nil?
|
|
375
|
+
#new.type = type
|
|
376
|
+
#new.filename = filename
|
|
377
|
+
#new.namespace = namespace
|
|
378
|
+
#new.entity_options = entity_options
|
|
379
|
+
#new.entity_templates = entity_templates
|
|
379
380
|
|
|
380
381
|
case
|
|
381
382
|
when (method.nil? and block_given?)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module TSV
|
|
2
|
+
def marshal_dump
|
|
3
|
+
if defined?(Persist::TCAdapter) && Persist::TCAdapter === self
|
|
4
|
+
super
|
|
5
|
+
else
|
|
6
|
+
[info, to_hash]
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class Hash
|
|
12
|
+
def marshal_load(array)
|
|
13
|
+
info, to_hash = array
|
|
14
|
+
self.merge! to_hash
|
|
15
|
+
TSV.setup(self)
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/rbbt/tsv/util.rb
CHANGED
|
@@ -388,9 +388,6 @@ module TSV
|
|
|
388
388
|
new
|
|
389
389
|
end
|
|
390
390
|
|
|
391
|
-
def marshal_dump
|
|
392
|
-
[info, to_hash]
|
|
393
|
-
end
|
|
394
391
|
|
|
395
392
|
def to_onehot(boolean = false)
|
|
396
393
|
all_values = values.flatten.uniq.collect{|v| v.to_s}.sort
|
|
@@ -405,10 +402,3 @@ module TSV
|
|
|
405
402
|
end
|
|
406
403
|
end
|
|
407
404
|
|
|
408
|
-
class Hash
|
|
409
|
-
def marshal_load(array)
|
|
410
|
-
info, to_hash = array
|
|
411
|
-
self.merge! to_hash
|
|
412
|
-
TSV.setup(self)
|
|
413
|
-
end
|
|
414
|
-
end
|
data/lib/rbbt/tsv.rb
CHANGED
|
@@ -29,6 +29,10 @@ class RbbtProcessQueue
|
|
|
29
29
|
|
|
30
30
|
def dump(obj, stream)
|
|
31
31
|
case obj
|
|
32
|
+
when Annotated
|
|
33
|
+
payload = @serializer.dump(obj)
|
|
34
|
+
size_head = [payload.bytesize,"S"].pack 'La'
|
|
35
|
+
str = size_head << payload
|
|
32
36
|
when String
|
|
33
37
|
payload = obj
|
|
34
38
|
size_head = [payload.bytesize,"C"].pack 'La'
|
|
@@ -90,7 +94,7 @@ class RbbtProcessQueue
|
|
|
90
94
|
def push(obj)
|
|
91
95
|
RbbtSemaphore.synchronize(@write_sem) do
|
|
92
96
|
multiple = MultipleResult === obj
|
|
93
|
-
obj = Annotated.purge(obj)
|
|
97
|
+
#obj = Annotated.purge(obj)
|
|
94
98
|
obj.extend MultipleResult if multiple
|
|
95
99
|
self.dump(obj, @swrite)
|
|
96
100
|
end
|
|
@@ -413,4 +413,15 @@ def self.add_libdir(dir=nil)
|
|
|
413
413
|
CMD.cmd("ssh '#{server}' 'shopt -s expand_aliases; bash -l -c \"ruby\"' ", :in => script, :log => true).read
|
|
414
414
|
end
|
|
415
415
|
|
|
416
|
+
def self.timeout_insist(time, msg = nil, &block)
|
|
417
|
+
Misc.insist do
|
|
418
|
+
begin
|
|
419
|
+
Timeout.timeout(time, TryAgain, msg, &block)
|
|
420
|
+
rescue TryAgain
|
|
421
|
+
Log.low "Timeout detected after #{time} seconds"
|
|
422
|
+
raise $!
|
|
423
|
+
end
|
|
424
|
+
end
|
|
425
|
+
end
|
|
426
|
+
|
|
416
427
|
end
|
|
@@ -27,10 +27,11 @@ module Misc
|
|
|
27
27
|
params.merge!(:format => _format) unless _format.nil? or (params.include?(:format) and not ((f = params[:format]).nil? or (String === f and f.empty?)))
|
|
28
28
|
|
|
29
29
|
mod = Entity === field ? field : Entity.formats[field]
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
|
|
31
|
+
entity = entity.dup
|
|
32
|
+
entity = (entity.frozen? and not entity.nil?) ? entity.dup : ((Array === entity and dup_array) ? entity.collect{|e| e.nil? ? e : e.dup} : entity)
|
|
33
|
+
|
|
34
|
+
entity = mod.setup(entity, params)
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
entity
|
|
@@ -19,8 +19,9 @@ module RbbtPython
|
|
|
19
19
|
|
|
20
20
|
def self.df2tsv(tuple, options = {})
|
|
21
21
|
options = Misc.add_defaults options, :type => :list
|
|
22
|
+
IndiferentHash.setup options
|
|
22
23
|
tsv = TSV.setup({}, options)
|
|
23
|
-
tsv.key_field = tuple.columns.name
|
|
24
|
+
tsv.key_field = options[:key_field] || tuple.columns.name
|
|
24
25
|
tsv.fields = py2ruby_a(tuple.columns.values)
|
|
25
26
|
keys = tuple.index.values
|
|
26
27
|
PyCall.len(tuple.index).times do |i|
|
|
@@ -138,7 +138,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
|
138
138
|
fcadep = File.join(dir, 'canfail_dependencies.list')
|
|
139
139
|
cadeps = Open.read(fcadep).split("\n") if File.exist?(fcadep)
|
|
140
140
|
|
|
141
|
-
aborted = error = true if aborted.nil? && error.nil?
|
|
141
|
+
aborted = error = true if ! done && aborted.nil? && error.nil?
|
|
142
142
|
#if done || error || aborted || running || queued || jobid || search
|
|
143
143
|
# select = false
|
|
144
144
|
# select = true if done && exit_status && exit_status.to_i == 0
|
|
@@ -13,6 +13,7 @@ $slurm_options = SOPT.get <<EOF
|
|
|
13
13
|
--drbbt* Use development version of rbbt
|
|
14
14
|
-sing--singularity Use Singularity
|
|
15
15
|
-si--singularity_img* Singularity image to use
|
|
16
|
+
-sm--singularity_mounts* Singularity image to use
|
|
16
17
|
-ug--user_group* Use alternative user group for group project directory
|
|
17
18
|
-c--contain* Contain in directory (using Singularity)
|
|
18
19
|
-s--sync* Contain in directory and sync jobs
|
|
@@ -36,8 +37,9 @@ $slurm_options = SOPT.get <<EOF
|
|
|
36
37
|
-cons--constraint* SLURM constraint
|
|
37
38
|
-W--workflows* Additional workflows
|
|
38
39
|
-rmb--remove_batch_basedir Remove the SLURM working directory (command, STDIN, exit status, ...)
|
|
39
|
-
-lmod--lua_modules* Lua Modules to load
|
|
40
40
|
-bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
|
|
41
|
+
-lmod--lua_modules* Lua Modules to load
|
|
42
|
+
-co--conda* Conda environment to use
|
|
41
43
|
-OR--orchestration_rules* Orchestration rules
|
|
42
44
|
EOF
|
|
43
45
|
|
|
@@ -12,6 +12,7 @@ $slurm_options = SOPT.get <<EOF
|
|
|
12
12
|
--drbbt* Use development version of rbbt
|
|
13
13
|
-sing--singularity Use Singularity
|
|
14
14
|
-si--singularity_img* Singularity image to use
|
|
15
|
+
-sm--singularity_mounts* Singularity image to use
|
|
15
16
|
-ug--user_group* Use alternative user group for group project directory
|
|
16
17
|
-c--contain* Contain in directory (using Singularity)
|
|
17
18
|
-s--sync* Contain in directory and sync jobs
|
|
@@ -35,8 +36,9 @@ $slurm_options = SOPT.get <<EOF
|
|
|
35
36
|
-cons--constraint* SLURM constraint
|
|
36
37
|
-W--workflows* Additional workflows
|
|
37
38
|
-rmb--remove_batch_dir Remove the batch working directory (command, STDIN, exit status, ...)
|
|
38
|
-
-lmod--lua_modules* Lua Modules to load
|
|
39
39
|
-bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
|
|
40
|
+
-lmod--lua_modules* Lua Modules to load
|
|
41
|
+
-co--conda* Conda environment to use
|
|
40
42
|
EOF
|
|
41
43
|
|
|
42
44
|
batch_system = $slurm_options.delete :batch_system
|
|
@@ -138,7 +138,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
|
138
138
|
fcadep = File.join(dir, 'canfail_dependencies.list')
|
|
139
139
|
cadeps = Open.read(fcadep).split("\n") if File.exist?(fcadep)
|
|
140
140
|
|
|
141
|
-
aborted = error = true if aborted.nil? && error.nil?
|
|
141
|
+
aborted = error = true if ! done && aborted.nil? && error.nil?
|
|
142
142
|
#if done || error || aborted || running || queued || jobid || search
|
|
143
143
|
# select = false
|
|
144
144
|
# select = true if done && exit_status && exit_status.to_i == 0
|
|
@@ -13,6 +13,7 @@ $slurm_options = SOPT.get <<EOF
|
|
|
13
13
|
--drbbt* Use development version of rbbt
|
|
14
14
|
-sing--singularity Use Singularity
|
|
15
15
|
-si--singularity_img* Singularity image to use
|
|
16
|
+
-sm--singularity_mounts* Singularity image to use
|
|
16
17
|
-ug--user_group* Use alternative user group for group project directory
|
|
17
18
|
-c--contain* Contain in directory (using Singularity)
|
|
18
19
|
-s--sync* Contain in directory and sync jobs
|
|
@@ -36,8 +37,9 @@ $slurm_options = SOPT.get <<EOF
|
|
|
36
37
|
-cons--constraint* SLURM constraint
|
|
37
38
|
-W--workflows* Additional workflows
|
|
38
39
|
-rmb--remove_batch_basedir Remove the SLURM working directory (command, STDIN, exit status, ...)
|
|
39
|
-
-lmod--lua_modules* Lua Modules to load
|
|
40
40
|
-bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
|
|
41
|
+
-lmod--lua_modules* Lua Modules to load
|
|
42
|
+
-co--conda* Conda environment to use
|
|
41
43
|
-OR--orchestration_rules* Orchestration rules
|
|
42
44
|
EOF
|
|
43
45
|
|
|
@@ -12,6 +12,7 @@ $slurm_options = SOPT.get <<EOF
|
|
|
12
12
|
--drbbt* Use development version of rbbt
|
|
13
13
|
-sing--singularity Use Singularity
|
|
14
14
|
-si--singularity_img* Singularity image to use
|
|
15
|
+
-sm--singularity_mounts* Singularity image to use
|
|
15
16
|
-ug--user_group* Use alternative user group for group project directory
|
|
16
17
|
-c--contain* Contain in directory (using Singularity)
|
|
17
18
|
-s--sync* Contain in directory and sync jobs
|
|
@@ -35,8 +36,9 @@ $slurm_options = SOPT.get <<EOF
|
|
|
35
36
|
-cons--constraint* SLURM constraint
|
|
36
37
|
-W--workflows* Additional workflows
|
|
37
38
|
-rmb--remove_batch_dir Remove the batch working directory (command, STDIN, exit status, ...)
|
|
38
|
-
-lmod--lua_modules* Lua Modules to load
|
|
39
39
|
-bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
|
|
40
|
+
-lmod--lua_modules* Lua Modules to load
|
|
41
|
+
-co--conda* Conda environment to use
|
|
40
42
|
EOF
|
|
41
43
|
|
|
42
44
|
batch_system = $slurm_options.delete :batch_system
|
|
@@ -138,7 +138,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
|
138
138
|
fcadep = File.join(dir, 'canfail_dependencies.list')
|
|
139
139
|
cadeps = Open.read(fcadep).split("\n") if File.exist?(fcadep)
|
|
140
140
|
|
|
141
|
-
aborted = error = true if aborted.nil? && error.nil?
|
|
141
|
+
aborted = error = true if ! done && aborted.nil? && error.nil?
|
|
142
142
|
#if done || error || aborted || running || queued || jobid || search
|
|
143
143
|
# select = false
|
|
144
144
|
# select = true if done && exit_status && exit_status.to_i == 0
|
|
@@ -13,6 +13,7 @@ $slurm_options = SOPT.get <<EOF
|
|
|
13
13
|
--drbbt* Use development version of rbbt
|
|
14
14
|
-sing--singularity Use Singularity
|
|
15
15
|
-si--singularity_img* Singularity image to use
|
|
16
|
+
-sm--singularity_mounts* Singularity image to use
|
|
16
17
|
-ug--user_group* Use alternative user group for group project directory
|
|
17
18
|
-c--contain* Contain in directory (using Singularity)
|
|
18
19
|
-s--sync* Contain in directory and sync jobs
|
|
@@ -36,8 +37,9 @@ $slurm_options = SOPT.get <<EOF
|
|
|
36
37
|
-cons--constraint* SLURM constraint
|
|
37
38
|
-W--workflows* Additional workflows
|
|
38
39
|
-rmb--remove_batch_basedir Remove the SLURM working directory (command, STDIN, exit status, ...)
|
|
39
|
-
-lmod--lua_modules* Lua Modules to load
|
|
40
40
|
-bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
|
|
41
|
+
-lmod--lua_modules* Lua Modules to load
|
|
42
|
+
-co--conda* Conda environment to use
|
|
41
43
|
-OR--orchestration_rules* Orchestration rules
|
|
42
44
|
EOF
|
|
43
45
|
|
|
@@ -12,6 +12,7 @@ $slurm_options = SOPT.get <<EOF
|
|
|
12
12
|
--drbbt* Use development version of rbbt
|
|
13
13
|
-sing--singularity Use Singularity
|
|
14
14
|
-si--singularity_img* Singularity image to use
|
|
15
|
+
-sm--singularity_mounts* Singularity image to use
|
|
15
16
|
-ug--user_group* Use alternative user group for group project directory
|
|
16
17
|
-c--contain* Contain in directory (using Singularity)
|
|
17
18
|
-s--sync* Contain in directory and sync jobs
|
|
@@ -35,8 +36,9 @@ $slurm_options = SOPT.get <<EOF
|
|
|
35
36
|
-cons--constraint* SLURM constraint
|
|
36
37
|
-W--workflows* Additional workflows
|
|
37
38
|
-rmb--remove_batch_dir Remove the batch working directory (command, STDIN, exit status, ...)
|
|
38
|
-
-lmod--lua_modules* Lua Modules to load
|
|
39
39
|
-bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
|
|
40
|
+
-lmod--lua_modules* Lua Modules to load
|
|
41
|
+
-co--conda* Conda environment to use
|
|
40
42
|
EOF
|
|
41
43
|
|
|
42
44
|
batch_system = $slurm_options.delete :batch_system
|
|
@@ -9,9 +9,19 @@ end
|
|
|
9
9
|
class TestAnnotation < Test::Unit::TestCase
|
|
10
10
|
def test_marshal
|
|
11
11
|
a = "STRING"
|
|
12
|
-
a.
|
|
12
|
+
a = TestEntityString.setup(a)
|
|
13
13
|
|
|
14
|
-
assert !(Annotated === Marshal.load(Marshal.dump(a)))
|
|
14
|
+
#assert !(Annotated === Marshal.load(Marshal.dump(a)))
|
|
15
|
+
assert_equal a, Marshal.load(Marshal.dump(a))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_marshal_array
|
|
19
|
+
a = ["STRING"]
|
|
20
|
+
TestEntityString.setup(a)
|
|
21
|
+
|
|
22
|
+
#assert !(Annotated === Marshal.load(Marshal.dump(a)))
|
|
23
|
+
assert Annotated === a
|
|
24
|
+
assert Annotated === a.first
|
|
15
25
|
assert_equal a, Marshal.load(Marshal.dump(a))
|
|
16
26
|
end
|
|
17
27
|
|
|
@@ -20,5 +30,14 @@ class TestAnnotation < Test::Unit::TestCase
|
|
|
20
30
|
assert_equal "TEST", Annotated.to_hash(e)[:literal]
|
|
21
31
|
assert_equal 10, Annotated.to_hash(e)[:info][:code]
|
|
22
32
|
end
|
|
33
|
+
|
|
34
|
+
def test_traverse_cpus
|
|
35
|
+
strings = (1..10).to_a.collect{|n| n.to_s }
|
|
36
|
+
res = TSV.traverse strings, :cpus => 2, :into => [] do |s|
|
|
37
|
+
TestEntityString.setup(s, :code => s.to_i)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
assert TestEntityString === res.first
|
|
41
|
+
end
|
|
23
42
|
end
|
|
24
43
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
|
2
|
+
require 'rbbt/tsv'
|
|
3
|
+
require 'rbbt/tsv/marshal'
|
|
4
|
+
require 'rbbt/util/tmpfile'
|
|
5
|
+
require 'test/unit'
|
|
6
|
+
|
|
7
|
+
class TestTSVUtil < Test::Unit::TestCase
|
|
8
|
+
|
|
9
|
+
def test_marshal
|
|
10
|
+
content =<<-EOF
|
|
11
|
+
#Id ValueA ValueB OtherID
|
|
12
|
+
row1 a|aa|aaa b Id1|Id2
|
|
13
|
+
row2 A B Id3
|
|
14
|
+
EOF
|
|
15
|
+
|
|
16
|
+
TmpFile.with_file(content) do |filename|
|
|
17
|
+
tsv = TSV.open(filename, :sep => /\s+/)
|
|
18
|
+
|
|
19
|
+
assert TSV === Marshal.load(Marshal.dump(tsv))
|
|
20
|
+
assert_equal tsv.to_hash, Marshal.load(Marshal.dump(tsv)).to_hash
|
|
21
|
+
assert_equal({1 => 1}, Marshal.load(Marshal.dump({1 => 1})))
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/test/rbbt/tsv/test_util.rb
CHANGED
|
@@ -21,22 +21,6 @@ row2 A B Id3
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def test_marshal
|
|
25
|
-
content =<<-EOF
|
|
26
|
-
#Id ValueA ValueB OtherID
|
|
27
|
-
row1 a|aa|aaa b Id1|Id2
|
|
28
|
-
row2 A B Id3
|
|
29
|
-
EOF
|
|
30
|
-
|
|
31
|
-
TmpFile.with_file(content) do |filename|
|
|
32
|
-
tsv = TSV.open(filename, :sep => /\s+/)
|
|
33
|
-
|
|
34
|
-
assert TSV === Marshal.load(Marshal.dump(tsv))
|
|
35
|
-
assert_equal tsv.to_hash, Marshal.load(Marshal.dump(tsv)).to_hash
|
|
36
|
-
assert_equal({1 => 1}, Marshal.load(Marshal.dump({1 => 1})))
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
24
|
def test_replicates
|
|
41
25
|
content =<<-EOF
|
|
42
26
|
#Id ValueA ValueB OtherID
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbbt-util
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.34.
|
|
4
|
+
version: 5.34.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miguel Vazquez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-09-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -255,6 +255,7 @@ files:
|
|
|
255
255
|
- lib/rbbt/persist/tsv/packed_index.rb
|
|
256
256
|
- lib/rbbt/persist/tsv/sharder.rb
|
|
257
257
|
- lib/rbbt/persist/tsv/tokyocabinet.rb
|
|
258
|
+
- lib/rbbt/persist/tsv/tokyocabinet/marshal.rb
|
|
258
259
|
- lib/rbbt/resource.rb
|
|
259
260
|
- lib/rbbt/resource/path.rb
|
|
260
261
|
- lib/rbbt/resource/rake.rb
|
|
@@ -272,6 +273,7 @@ files:
|
|
|
272
273
|
- lib/rbbt/tsv/filter.rb
|
|
273
274
|
- lib/rbbt/tsv/index.rb
|
|
274
275
|
- lib/rbbt/tsv/manipulate.rb
|
|
276
|
+
- lib/rbbt/tsv/marshal.rb
|
|
275
277
|
- lib/rbbt/tsv/matrix.rb
|
|
276
278
|
- lib/rbbt/tsv/melt.rb
|
|
277
279
|
- lib/rbbt/tsv/parallel.rb
|
|
@@ -536,6 +538,7 @@ files:
|
|
|
536
538
|
- test/rbbt/tsv/test_filter.rb
|
|
537
539
|
- test/rbbt/tsv/test_index.rb
|
|
538
540
|
- test/rbbt/tsv/test_manipulate.rb
|
|
541
|
+
- test/rbbt/tsv/test_marshal.rb
|
|
539
542
|
- test/rbbt/tsv/test_matrix.rb
|
|
540
543
|
- test/rbbt/tsv/test_parallel.rb
|
|
541
544
|
- test/rbbt/tsv/test_parser.rb
|
|
@@ -667,6 +670,7 @@ test_files:
|
|
|
667
670
|
- test/rbbt/tsv/test_change_id.rb
|
|
668
671
|
- test/rbbt/tsv/test_attach.rb
|
|
669
672
|
- test/rbbt/tsv/test_filter.rb
|
|
673
|
+
- test/rbbt/tsv/test_marshal.rb
|
|
670
674
|
- test/rbbt/tsv/test_parser.rb
|
|
671
675
|
- test/rbbt/tsv/test_csv.rb
|
|
672
676
|
- test/rbbt/tsv/test_accessor.rb
|