rbbt-util 5.34.27 → 5.35.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/hpc/batch.rb +3 -3
- data/lib/rbbt/hpc/orchestrate.rb +10 -2
- data/lib/rbbt/resource.rb +1 -0
- data/lib/rbbt/tsv/attach/util.rb +8 -4
- data/lib/rbbt/util/R/model.rb +1 -1
- data/lib/rbbt/util/R/plot.rb +2 -0
- data/lib/rbbt/util/R.rb +1 -1
- data/lib/rbbt/util/cmd.rb +5 -3
- data/lib/rbbt/util/misc/concurrent_stream.rb +12 -11
- data/lib/rbbt/util/misc/development.rb +3 -2
- data/lib/rbbt/util/misc/exceptions.rb +26 -3
- data/lib/rbbt/util/misc/inspect.rb +1 -1
- data/lib/rbbt/util/python/util.rb +19 -0
- data/lib/rbbt/util/python.rb +80 -10
- data/lib/rbbt/util/simpleopt/get.rb +9 -6
- data/lib/rbbt/workflow/integration/ansible.rb +1 -1
- data/lib/rbbt/workflow/remote_workflow/driver/ssh.rb +34 -9
- data/lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb +7 -2
- data/lib/rbbt/workflow/remote_workflow/remote_step.rb +2 -0
- data/lib/rbbt/workflow/step/save_load_inputs.rb +1 -0
- data/lib/rbbt/workflow.rb +2 -1
- data/share/install/software/lib/install_helpers +3 -2
- data/share/rbbt_commands/ansible +0 -1
- data/share/rbbt_commands/hpc/orchestrate +15 -3
- data/share/rbbt_commands/hpc/task +13 -2
- data/share/rbbt_commands/lsf/orchestrate +15 -3
- data/share/rbbt_commands/lsf/task +13 -2
- data/share/rbbt_commands/slurm/orchestrate +15 -3
- data/share/rbbt_commands/slurm/task +13 -2
- data/share/rbbt_commands/workflow/task +3 -2
- data/test/rbbt/hpc/test_batch.rb +4 -4
- data/test/rbbt/util/python/test_util.rb +8 -0
- data/test/rbbt/util/test_python.rb +50 -0
- metadata +87 -87
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fc87aa89e132735c535df80f34cfd0f31fb44475d55d08fb194ee50e045f884
|
4
|
+
data.tar.gz: e1c380d68af04bd683a3a06e675b6e8744497869d95ac96620e7864f05e8aeb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd65fb3be5c880288fa1718d6a2327d1e799f7c9b415785cdcb5f1cd9d18d02664347e6dc16dde2a78d727ab86ab292d272fc2a608ea7a9a1eb7c0e88f213131
|
7
|
+
data.tar.gz: 603ca603814e8405dcc88ed0a499ddb92658d2831887d8c8110ba60737a83317ee7d68e00a3b51a48734a6bb90f2539d654169b07a8609a60fe02351d8426394
|
data/lib/rbbt/hpc/batch.rb
CHANGED
@@ -378,17 +378,17 @@ function batch_sync_contain_dir(){
|
|
378
378
|
prepare_environment +=<<-EOF
|
379
379
|
# Load singularity modules
|
380
380
|
command -v singularity &> /dev/null || module load singularity
|
381
|
-
mkdir -p "#{singularity_opt_dir}"
|
381
|
+
mkdir -p "#{File.expand_path singularity_opt_dir}"
|
382
382
|
EOF
|
383
383
|
|
384
384
|
if contain && options[:hardened]
|
385
385
|
|
386
386
|
prepare_environment +=<<-EOF
|
387
387
|
# Prepare container for singularity
|
388
|
-
mkdir -p "#{contain}/.rbbt/etc/
|
388
|
+
mkdir -p "#{contain}"/.rbbt/etc/
|
389
389
|
|
390
390
|
for dir in .ruby_inline git home; do
|
391
|
-
mkdir -p "#{contain}/$dir
|
391
|
+
mkdir -p "#{contain}"/$dir
|
392
392
|
done
|
393
393
|
|
394
394
|
for tmpd in persist_locks produce_locks R_sockets sensiblewrite sensiblewrite_locks step_info_locks tsv_open_locks; do
|
data/lib/rbbt/hpc/orchestrate.rb
CHANGED
@@ -36,8 +36,16 @@ module HPC
|
|
36
36
|
Log.high "Prepare for exec"
|
37
37
|
prepare_for_execution(job)
|
38
38
|
|
39
|
-
if options[:orchestration_rules]
|
40
|
-
|
39
|
+
if orchestration_rules_file = options[:orchestration_rules]
|
40
|
+
if Open.exists?(orchestration_rules_file)
|
41
|
+
rules = Misc.load_yaml(orchestration_rules_file)
|
42
|
+
elsif Rbbt.etc.slurm(orchestration_rules_file).exists?
|
43
|
+
rules = Misc.load_yaml(Rbbt.etc.slurm(orchestration_rules_file))
|
44
|
+
elsif Rbbt.etc.slurm(orchestration_rules_file + '.yaml').exists?
|
45
|
+
rules = Misc.load_yaml(Rbbt.etc.slurm(orchestration_rules_file + '.yaml'))
|
46
|
+
else
|
47
|
+
raise "Orchestration rules file not found: #{options[:orchestration_rules]}"
|
48
|
+
end
|
41
49
|
elsif Rbbt.etc.slurm["default.yaml"].exists?
|
42
50
|
rules = Misc.load_yaml(Rbbt.etc.slurm["default.yaml"])
|
43
51
|
else
|
data/lib/rbbt/resource.rb
CHANGED
data/lib/rbbt/tsv/attach/util.rb
CHANGED
@@ -105,7 +105,7 @@ module TSV
|
|
105
105
|
if other.include? source_key
|
106
106
|
v = case other.type
|
107
107
|
when :flat
|
108
|
-
other[source_key]
|
108
|
+
other[source_key]
|
109
109
|
when :single
|
110
110
|
[other[source_key]]
|
111
111
|
when :double
|
@@ -135,8 +135,12 @@ module TSV
|
|
135
135
|
if pos == :key
|
136
136
|
source_key
|
137
137
|
else
|
138
|
-
if other.include?
|
139
|
-
|
138
|
+
if other.include?(source_key)
|
139
|
+
if other.type == :single
|
140
|
+
v = other[source_key]
|
141
|
+
else
|
142
|
+
v = other[source_key][pos]
|
143
|
+
end
|
140
144
|
Array === v ? v.first : v
|
141
145
|
else
|
142
146
|
nil
|
@@ -192,7 +196,7 @@ module TSV
|
|
192
196
|
end
|
193
197
|
end
|
194
198
|
new_values.collect!{|v| v.nil? ? [[]] : [v]} if type == :double and not other.type == :double
|
195
|
-
new_values.collect!{|v| v.nil? ? nil : (other.type == :single ? v : v.first)} if not type == :double and
|
199
|
+
new_values.collect!{|v| v.nil? ? nil : (other.type == :single ? v : v.first)} if not type == :double and other.type == :double
|
196
200
|
new_values.flatten! if type == :flat
|
197
201
|
all_new_values << new_values
|
198
202
|
end
|
data/lib/rbbt/util/R/model.rb
CHANGED
@@ -42,7 +42,7 @@ module R
|
|
42
42
|
def colClasses(tsv)
|
43
43
|
return nil unless TSV === tsv
|
44
44
|
"c('character', " <<
|
45
|
-
(tsv.fields.collect{|f| R.ruby2R(@options[f] ? @options[f].to_s : "
|
45
|
+
(tsv.fields.collect{|f| R.ruby2R(@options[f] ? @options[f].to_s : "NA") } * ", ") <<
|
46
46
|
")"
|
47
47
|
end
|
48
48
|
|
data/lib/rbbt/util/R/plot.rb
CHANGED
data/lib/rbbt/util/R.rb
CHANGED
data/lib/rbbt/util/cmd.rb
CHANGED
@@ -112,6 +112,7 @@ module CMD
|
|
112
112
|
no_wait = options.delete(:no_wait)
|
113
113
|
xvfb = options.delete(:xvfb)
|
114
114
|
bar = options.delete(:progress_bar)
|
115
|
+
save_stderr = options.delete(:save_stderr)
|
115
116
|
|
116
117
|
dont_close_in = options.delete(:dont_close_in)
|
117
118
|
|
@@ -154,7 +155,7 @@ module CMD
|
|
154
155
|
Open3.popen3(ENV, cmd)
|
155
156
|
rescue
|
156
157
|
Log.warn $!.message
|
157
|
-
raise ProcessFailed, cmd unless no_fail
|
158
|
+
raise ProcessFailed, nil, cmd unless no_fail
|
158
159
|
return
|
159
160
|
end
|
160
161
|
pid = wait_thr.pid
|
@@ -198,6 +199,7 @@ module CMD
|
|
198
199
|
while line = serr.gets
|
199
200
|
bar.process(line) if bar
|
200
201
|
sout.log = line
|
202
|
+
sout.std_err << line if save_stderr
|
201
203
|
Log.log "STDERR [#{pid}]: " + line, stderr if log
|
202
204
|
end
|
203
205
|
serr.close
|
@@ -244,9 +246,9 @@ module CMD
|
|
244
246
|
status = wait_thr.value
|
245
247
|
if not status.success? and not no_fail
|
246
248
|
if !err.empty?
|
247
|
-
raise ProcessFailed.new
|
249
|
+
raise ProcessFailed.new pid, "#{cmd} failed with error status #{status.exitstatus}.\n#{err}"
|
248
250
|
else
|
249
|
-
raise ProcessFailed.new
|
251
|
+
raise ProcessFailed.new pid, "#{cmd} failed with error status #{status.exitstatus}"
|
250
252
|
end
|
251
253
|
else
|
252
254
|
Log.log err, stderr if Integer === stderr and log
|
@@ -7,7 +7,7 @@ module AbortedStream
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module ConcurrentStream
|
10
|
-
attr_accessor :threads, :pids, :callback, :abort_callback, :filename, :joined, :aborted, :autojoin, :lockfile, :no_fail, :pair, :thread, :stream_exception, :log
|
10
|
+
attr_accessor :threads, :pids, :callback, :abort_callback, :filename, :joined, :aborted, :autojoin, :lockfile, :no_fail, :pair, :thread, :stream_exception, :log, :std_err
|
11
11
|
|
12
12
|
def self.setup(stream, options = {}, &block)
|
13
13
|
|
@@ -20,6 +20,7 @@ module ConcurrentStream
|
|
20
20
|
stream.pids.concat(Array === pids ? pids : [pids]) unless pids.nil? or pids.empty?
|
21
21
|
stream.autojoin = autojoin unless autojoin.nil?
|
22
22
|
stream.no_fail = no_fail unless no_fail.nil?
|
23
|
+
stream.std_err = ""
|
23
24
|
|
24
25
|
stream.pair = pair unless pair.nil?
|
25
26
|
|
@@ -81,12 +82,16 @@ module ConcurrentStream
|
|
81
82
|
begin
|
82
83
|
t.join
|
83
84
|
if Process::Status === t.value
|
84
|
-
if
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
if ! (t.value.success? || no_fail)
|
86
|
+
|
87
|
+
if log
|
88
|
+
msg = "Error joining #{self.filename || self.inspect}. Last log line: #{log}"
|
89
|
+
else
|
90
|
+
msg = "Error joining #{self.filename || self.inspect}"
|
91
|
+
end
|
92
|
+
|
93
|
+
raise ConcurrentStreamProcessFailed.new t.pid, msg, self
|
88
94
|
end
|
89
|
-
raise ProcessFailed.new "Error joining process #{t.pid} in #{self.filename || self.inspect}. Last log line: #{log}" if ! (t.value.success? || no_fail)
|
90
95
|
end
|
91
96
|
rescue Exception
|
92
97
|
if no_fail
|
@@ -106,11 +111,7 @@ module ConcurrentStream
|
|
106
111
|
@pids.each do |pid|
|
107
112
|
begin
|
108
113
|
Process.waitpid(pid, Process::WUNTRACED)
|
109
|
-
|
110
|
-
stream_raise_exception ProcessFailed.new "Error joining process #{pid} in #{self.filename || self.inspect}. Last log line: #{log}" unless $?.success? or no_fail
|
111
|
-
else
|
112
|
-
stream_raise_exception ProcessFailed.new "Error joining process #{pid} in #{self.filename || self.inspect}" unless $?.success? or no_fail
|
113
|
-
end
|
114
|
+
stream_raise_exception ConcurrentStreamProcessFailed.new(pid, "Error in waitpid", self) unless $?.success? or no_fail
|
114
115
|
rescue Errno::ECHILD
|
115
116
|
end
|
116
117
|
end
|
@@ -420,7 +420,8 @@ def self.add_libdir(dir=nil)
|
|
420
420
|
def self.ssh_run(server, script = nil)
|
421
421
|
Log.debug "Run ssh script in #{server}:\n#{script}"
|
422
422
|
|
423
|
-
CMD.cmd("ssh '#{server}' 'shopt -s expand_aliases; bash -l -c \"ruby\"' ", :in => script, :log => true).read
|
423
|
+
#CMD.cmd("ssh '#{server}' 'shopt -s expand_aliases; bash -l -c \"ruby\"' ", :in => script, :log => true).read
|
424
|
+
CMD.cmd("ssh '#{server}' ruby", :in => script, :log => true).read
|
424
425
|
end
|
425
426
|
|
426
427
|
def self.ssh_connection(server, reset = false)
|
@@ -437,7 +438,7 @@ def self.add_libdir(dir=nil)
|
|
437
438
|
end
|
438
439
|
end
|
439
440
|
|
440
|
-
def self.
|
441
|
+
def self.ssh_run_alt(server, script = nil)
|
441
442
|
Log.debug "Run ssh script in #{server}:\n#{script}"
|
442
443
|
|
443
444
|
write, master, pid = ssh_connection(server)
|
@@ -1,16 +1,39 @@
|
|
1
1
|
class RbbtException < StandardError; end
|
2
2
|
class ParameterException < RbbtException; end
|
3
3
|
|
4
|
+
class MissingParameterException < ParameterException
|
5
|
+
def initialize(parameter)
|
6
|
+
super("Missing parameter '#{parameter}'")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
4
10
|
class FieldNotFoundError < StandardError;end
|
5
11
|
class ClosedStream < StandardError; end
|
6
12
|
|
7
13
|
class ProcessFailed < StandardError;
|
8
|
-
|
14
|
+
attr_accessor :pid, :msg
|
15
|
+
def initialize(pid = Process.pid, msg = nil)
|
9
16
|
@pid = pid
|
10
|
-
@msg =
|
11
|
-
|
17
|
+
@msg = msg
|
18
|
+
if @pid
|
19
|
+
if @msg
|
20
|
+
message = "Process #{@pid} failed - #{@msg}"
|
21
|
+
else
|
22
|
+
message = "Process #{@pid} failed"
|
23
|
+
end
|
24
|
+
else
|
25
|
+
message = "Failed to run #{@msg}"
|
26
|
+
end
|
27
|
+
super(message)
|
12
28
|
end
|
29
|
+
end
|
13
30
|
|
31
|
+
class ConcurrentStreamProcessFailed < ProcessFailed
|
32
|
+
attr_accessor :concurrent_stream
|
33
|
+
def initialize(pid = Process.pid, msg = nil, concurrent_stream = nil)
|
34
|
+
super(pid, msg)
|
35
|
+
@concurrent_stream = concurrent_stream
|
36
|
+
end
|
14
37
|
end
|
15
38
|
|
16
39
|
class Aborted < StandardError; end
|
@@ -276,7 +276,7 @@ module Misc
|
|
276
276
|
|
277
277
|
def self.step_file?(path)
|
278
278
|
return true if defined?(Step) && Step === path.resource
|
279
|
-
return false unless path
|
279
|
+
return false unless path =~ /\.files(?:\/|$)/
|
280
280
|
parts = path.split("/")
|
281
281
|
job = parts.select{|p| p =~ /\.files$/}.first
|
282
282
|
if job
|
@@ -31,4 +31,23 @@ module RbbtPython
|
|
31
31
|
tsv
|
32
32
|
end
|
33
33
|
|
34
|
+
def self.list2ruby(list)
|
35
|
+
return list unless PyCall::List === list
|
36
|
+
list.collect do |e|
|
37
|
+
list2ruby(e)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.numpy2ruby(numpy)
|
42
|
+
list2ruby(numpy.tolist)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.obj2hash(obj)
|
46
|
+
hash = {}
|
47
|
+
RbbtPython.iterate obj.keys do |k|
|
48
|
+
hash[k] = obj[k]
|
49
|
+
end
|
50
|
+
hash
|
51
|
+
end
|
52
|
+
|
34
53
|
end
|
data/lib/rbbt/util/python.rb
CHANGED
@@ -5,6 +5,16 @@ require 'rbbt/util/python/util'
|
|
5
5
|
module RbbtPython
|
6
6
|
extend PyCall::Import
|
7
7
|
|
8
|
+
class RbbtPythonException < StandardError; end
|
9
|
+
|
10
|
+
class Binding
|
11
|
+
include PyCall::Import
|
12
|
+
|
13
|
+
def run(*args, &block)
|
14
|
+
instance_exec(*args, &block)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
8
18
|
def self.script(text, options = {})
|
9
19
|
Log.debug "Running python script:\n#{text.dup}"
|
10
20
|
text = StringIO.new text unless IO === text
|
@@ -12,8 +22,13 @@ module RbbtPython
|
|
12
22
|
end
|
13
23
|
|
14
24
|
def self.add_path(path)
|
15
|
-
|
16
|
-
|
25
|
+
begin
|
26
|
+
self.run 'sys' do
|
27
|
+
sys.path.append path
|
28
|
+
end
|
29
|
+
rescue
|
30
|
+
raise RbbtPythonException,
|
31
|
+
"Could not add path #{Misc.fingerprint path} to python sys: " + $!.message
|
17
32
|
end
|
18
33
|
end
|
19
34
|
|
@@ -26,19 +41,64 @@ module RbbtPython
|
|
26
41
|
end
|
27
42
|
|
28
43
|
def self.init_rbbt
|
29
|
-
if ! defined?(@@
|
44
|
+
if ! defined?(@@__init_rbbt_python) || ! @@__init_rbbt_python
|
30
45
|
Log.debug "Loading python 'rbbt' module into pycall RbbtPython module"
|
31
46
|
RbbtPython.add_paths(Rbbt.python.find_all)
|
32
47
|
RbbtPython.pyimport("rbbt")
|
33
|
-
@@
|
48
|
+
@@__init_rbbt_python = true
|
34
49
|
end
|
35
50
|
end
|
36
51
|
|
52
|
+
def self.import_method(module_name, method_name, as = nil)
|
53
|
+
RbbtPython.pyfrom module_name, import: method_name
|
54
|
+
RbbtPython.method(method_name)
|
55
|
+
end
|
56
|
+
|
37
57
|
def self.exec(script)
|
38
58
|
PyCall.exec(script)
|
39
59
|
end
|
40
60
|
|
41
|
-
def self.
|
61
|
+
def self.iterate_index(elem, options = {})
|
62
|
+
iii :interate_index
|
63
|
+
bar = options[:bar]
|
64
|
+
|
65
|
+
len = PyCall.len(elem)
|
66
|
+
case bar
|
67
|
+
when TrueClass
|
68
|
+
bar = Log::ProgressBar.new nil, :desc => "RbbtPython iterate"
|
69
|
+
when String
|
70
|
+
bar = Log::ProgressBar.new nil, :desc => bar
|
71
|
+
end
|
72
|
+
|
73
|
+
len.times do |i|
|
74
|
+
begin
|
75
|
+
yield elem[i]
|
76
|
+
bar.tick if bar
|
77
|
+
rescue PyCall::PyError
|
78
|
+
if $!.type.to_s == "<class 'StopIteration'>"
|
79
|
+
break
|
80
|
+
else
|
81
|
+
raise $!
|
82
|
+
end
|
83
|
+
rescue
|
84
|
+
bar.error if bar
|
85
|
+
raise $!
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
Log::ProgressBar.remove_bar bar if bar
|
90
|
+
nil
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.iterate(iterator, options = {}, &block)
|
94
|
+
if ! iterator.respond_to?(:__next__)
|
95
|
+
if iterator.respond_to?(:__iter__)
|
96
|
+
iterator = iterator.__iter__
|
97
|
+
else
|
98
|
+
return iterate_index(iterator, options, &block)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
42
102
|
bar = options[:bar]
|
43
103
|
|
44
104
|
case bar
|
@@ -50,7 +110,8 @@ module RbbtPython
|
|
50
110
|
|
51
111
|
while true
|
52
112
|
begin
|
53
|
-
|
113
|
+
elem = iterator.__next__
|
114
|
+
yield elem
|
54
115
|
bar.tick if bar
|
55
116
|
rescue PyCall::PyError
|
56
117
|
if $!.type.to_s == "<class 'StopIteration'>"
|
@@ -79,12 +140,12 @@ module RbbtPython
|
|
79
140
|
|
80
141
|
def self.run(mod = nil, imports = nil, &block)
|
81
142
|
if mod
|
82
|
-
if
|
83
|
-
pyfrom mod, :import => imports
|
84
|
-
elsif Hash === imports
|
143
|
+
if Hash === imports
|
85
144
|
pyimport mod, **imports
|
86
|
-
|
145
|
+
elsif imports.nil?
|
87
146
|
pyimport mod
|
147
|
+
else
|
148
|
+
pyfrom mod, :import => imports
|
88
149
|
end
|
89
150
|
end
|
90
151
|
|
@@ -124,4 +185,13 @@ module RbbtPython
|
|
124
185
|
module_eval(&block)
|
125
186
|
end
|
126
187
|
end
|
188
|
+
|
189
|
+
def self.new_binding
|
190
|
+
Binding.new
|
191
|
+
end
|
192
|
+
|
193
|
+
def self.binding_run(binding = nil, *args, &block)
|
194
|
+
binding = new_binding
|
195
|
+
binding.instance_exec *args, &block
|
196
|
+
end
|
127
197
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
module SOPT
|
2
2
|
GOT_OPTIONS= IndiferentHash.setup({})
|
3
|
+
def self.current_options=(options)
|
4
|
+
@@current_options = options
|
5
|
+
end
|
3
6
|
def self.consume(args = ARGV)
|
4
7
|
i = 0
|
5
|
-
|
8
|
+
@@current_options ||= {}
|
6
9
|
while i < args.length do
|
7
10
|
current = args[i]
|
8
11
|
break if current == "--"
|
@@ -25,20 +28,20 @@ module SOPT
|
|
25
28
|
|
26
29
|
if input_types[input] == :string
|
27
30
|
value = args.delete_at(i) if value.nil?
|
28
|
-
|
31
|
+
@@current_options[input] = value
|
29
32
|
else
|
30
33
|
if value.nil? and %w(F false FALSE no).include?(args[i])
|
31
34
|
Log.warn "Boolean values are best specified as #{current}=[true|false], not #{ current } [true|false]. Token '#{args[i]}' following '#{current}' automatically assigned as value"
|
32
35
|
value = args.delete_at(i)
|
33
36
|
end
|
34
|
-
|
37
|
+
@@current_options[input] = %w(F false FALSE no).include?(value)? false : true
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
38
|
-
IndiferentHash.setup
|
39
|
-
GOT_OPTIONS.merge!
|
41
|
+
IndiferentHash.setup @@current_options
|
42
|
+
GOT_OPTIONS.merge! @@current_options
|
40
43
|
|
41
|
-
|
44
|
+
@@current_options
|
42
45
|
end
|
43
46
|
|
44
47
|
def self.get(opt_str)
|
@@ -48,7 +48,7 @@ module Ansible
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.playbook(file, task = nil, options = {})
|
51
|
-
task =
|
51
|
+
task = task.to_sym if String === task
|
52
52
|
|
53
53
|
workflow = Workflow === file ? file : Workflow.require_workflow(file)
|
54
54
|
task = workflow.tasks.keys.last if workflow.tasks[task].nil?
|
@@ -85,7 +85,9 @@ job = wf.job(task, jobname, job_inputs)
|
|
85
85
|
STDOUT.write res.to_json
|
86
86
|
EOF
|
87
87
|
|
88
|
-
|
88
|
+
json = Misc.ssh_run(server, script)
|
89
|
+
Log.debug "JSON (#{ url }): #{json}"
|
90
|
+
JSON.parse(json)
|
89
91
|
end
|
90
92
|
|
91
93
|
def self.get_raw(url, params)
|
@@ -118,19 +120,40 @@ STDOUT.write job.path
|
|
118
120
|
script += job_script(input_id, jobname)
|
119
121
|
script +=<<-EOF
|
120
122
|
ENV["RBBT_UPDATE"]="#{(ENV["RBBT_UPDATE"] || false).to_s}"
|
121
|
-
job.
|
123
|
+
job.clean if job.error? and job.recoverable_error?
|
124
|
+
job.run unless job.done? || job.error?
|
122
125
|
STDOUT.write job.path
|
123
126
|
EOF
|
124
127
|
Misc.ssh_run(server, script)
|
125
128
|
end
|
126
129
|
|
127
|
-
def self.run_slurm_job(url, input_id, jobname = nil)
|
130
|
+
def self.run_slurm_job(url, input_id, jobname = nil, slurm_options = {})
|
128
131
|
server, path = parse_url(url)
|
129
132
|
|
130
133
|
script = path_script(path)
|
131
134
|
script += job_script(input_id, jobname)
|
132
135
|
script +=<<-EOF
|
133
|
-
|
136
|
+
require 'rbbt/hpc'
|
137
|
+
HPC::BATCH_MODULE = HPC.batch_system "SLURM"
|
138
|
+
slurm_options = JSON.parse(%q(#{slurm_options.to_json}))
|
139
|
+
job.clean if job.error? and job.recoverable_error?
|
140
|
+
HPC::BATCH_MODULE.run_job(job, slurm_options) unless job.done? || job.error?
|
141
|
+
STDOUT.write job.path
|
142
|
+
EOF
|
143
|
+
Misc.ssh_run(server, script)
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.orchestrate_slurm_job(url, input_id, jobname = nil, slurm_options = {})
|
147
|
+
server, path = parse_url(url)
|
148
|
+
|
149
|
+
script = path_script(path)
|
150
|
+
script += job_script(input_id, jobname)
|
151
|
+
script +=<<-EOF
|
152
|
+
require 'rbbt/hpc'
|
153
|
+
HPC::BATCH_MODULE = HPC.batch_system "SLURM"
|
154
|
+
slurm_options = JSON.parse(%q(#{slurm_options.to_json}))
|
155
|
+
job.clean if job.error? and job.recoverable_error?
|
156
|
+
HPC::BATCH_MODULE.orchestrate_job(job, slurm_options) unless job.done? || job.error?
|
134
157
|
STDOUT.write job.path
|
135
158
|
EOF
|
136
159
|
Misc.ssh_run(server, script)
|
@@ -190,18 +213,20 @@ job.clean
|
|
190
213
|
produce = true if migrate
|
191
214
|
|
192
215
|
workflow_name = job.workflow.to_s
|
193
|
-
inputs = job.
|
216
|
+
inputs = job.recursive_inputs.to_hash
|
217
|
+
|
194
218
|
job.dependencies.each do |dep|
|
195
|
-
dep.produce
|
196
|
-
|
219
|
+
dep.produce
|
220
|
+
end if options[:produce_dependencies]
|
197
221
|
|
198
|
-
|
222
|
+
job.rec_dependencies.each do |dep|
|
223
|
+
Step.migrate(dep.path, search_path, :target => server) if dep.done?
|
199
224
|
end
|
200
225
|
|
201
226
|
remote_workflow = RemoteWorkflow.new("ssh://#{server}:#{job.workflow.to_s}", "#{job.workflow.to_s}")
|
202
227
|
rjob = remote_workflow.job(job.task_name.to_s, job.clean_name, inputs)
|
203
228
|
|
204
|
-
override_dependencies = job.
|
229
|
+
override_dependencies = job.rec_dependencies.select{|dep| dep.done? }.collect{|dep| [dep.workflow.to_s, dep.task_name.to_s] * "#" << "=" << Rbbt.identify(dep.path)}
|
205
230
|
rjob.override_dependencies = override_dependencies
|
206
231
|
|
207
232
|
if options[:migrate]
|
@@ -50,15 +50,20 @@ class RemoteStep
|
|
50
50
|
"ssh://" + @server + ":" + ["var/jobs", self.workflow.to_s, task_name.to_s, @name] * "/"
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
def _run
|
55
|
+
RemoteWorkflow::SSH.run_job(File.join(base_url, task.to_s), @input_id, @base_name)
|
56
|
+
end
|
53
57
|
|
54
58
|
def produce(*args)
|
55
59
|
input_types = {}
|
56
60
|
init_job
|
57
|
-
@remote_path =
|
61
|
+
@remote_path = _run
|
58
62
|
@started = true
|
59
|
-
while ! done?
|
63
|
+
while ! (done? || error?)
|
60
64
|
sleep 1
|
61
65
|
end
|
66
|
+
raise self.get_exception if error?
|
62
67
|
self
|
63
68
|
end
|
64
69
|
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -520,6 +520,7 @@ module Workflow
|
|
520
520
|
end
|
521
521
|
|
522
522
|
def job(taskname, jobname = nil, inputs = {})
|
523
|
+
inputs, jobname = jobname, nil if Hash === jobname
|
523
524
|
begin
|
524
525
|
_job(taskname, jobname, inputs)
|
525
526
|
ensure
|
@@ -858,7 +859,7 @@ module Workflow
|
|
858
859
|
end
|
859
860
|
|
860
861
|
def self.load_relay_tasks(filename)
|
861
|
-
|
862
|
+
relay_workflow_tasks = Misc.load_yaml(filename)
|
862
863
|
Workflow.process_relay_tasks(relay_workflow_tasks)
|
863
864
|
end
|
864
865
|
end
|
@@ -85,7 +85,7 @@ uncompress_pkg(){
|
|
85
85
|
mkdir -p "$OPT_BUILD_DIR"
|
86
86
|
cd "$OPT_BUILD_DIR"
|
87
87
|
|
88
|
-
(tar xvfz $pkg || tar xvfJ $pkg || tar xvfj $pkg || unzip $pkg || (echo "Error decompressing" & cd &
|
88
|
+
(tar xvfz $pkg || tar xvfJ $pkg || tar xvfj $pkg || unzip $pkg || (echo "Error decompressing" & cd & exit -1 ) ) 2> /dev/null
|
89
89
|
|
90
90
|
cd "$old_pwd"
|
91
91
|
}
|
@@ -178,7 +178,7 @@ clean_build(){
|
|
178
178
|
}
|
179
179
|
|
180
180
|
build_dir(){
|
181
|
-
echo $OPT_BUILD_DIR
|
181
|
+
echo $OPT_BUILD_DIR/$(ls $OPT_BUILD_DIR |head -n 1)
|
182
182
|
}
|
183
183
|
|
184
184
|
compile(){
|
@@ -211,6 +211,7 @@ prepare_make(){
|
|
211
211
|
local extra="$@"
|
212
212
|
|
213
213
|
local old_pwd="`expand_path $(pwd)`"
|
214
|
+
|
214
215
|
cd "`build_dir`"
|
215
216
|
|
216
217
|
[ -f bootstrap ] && (./bootstrap || exit -1)
|
data/share/rbbt_commands/ansible
CHANGED
@@ -3,10 +3,13 @@
|
|
3
3
|
require 'rbbt/util/simpleopt'
|
4
4
|
require 'rbbt/workflow'
|
5
5
|
require 'rbbt/workflow/usage'
|
6
|
+
require 'rbbt/workflow/remote_workflow'
|
6
7
|
require 'rbbt/hpc'
|
7
8
|
require 'rbbt/hpc/orchestrate'
|
8
9
|
require 'time'
|
9
10
|
|
11
|
+
rbbt_options = SOPT::GOT_OPTIONS
|
12
|
+
|
10
13
|
$slurm_options = SOPT.get <<EOF
|
11
14
|
-dr--dry_run Print only the template
|
12
15
|
-cj--clean_job Clean job
|
@@ -46,6 +49,8 @@ EOF
|
|
46
49
|
batch_system = $slurm_options.delete :batch_system
|
47
50
|
batch_system ||= 'auto'
|
48
51
|
|
52
|
+
$slurm_options[:config_keys] = SOPT::GOT_OPTIONS[:config_keys]
|
53
|
+
|
49
54
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
50
55
|
|
51
56
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
@@ -61,7 +66,6 @@ class Step
|
|
61
66
|
else
|
62
67
|
begin
|
63
68
|
Log.debug "Issuing SLURM job for #{self.path}"
|
64
|
-
#@batch_job_id, @batch_job_dir = HPC::BATCH_MODULE.orchestrate_job(self, SOPT::GOT_OPTIONS.merge($slurm_options))
|
65
69
|
@batch_job_id, @batch_job_dir = HPC::BATCH_MODULE.orchestrate_job(self, $slurm_options)
|
66
70
|
if no_load
|
67
71
|
self
|
@@ -75,6 +79,14 @@ class Step
|
|
75
79
|
end
|
76
80
|
end
|
77
81
|
|
78
|
-
|
79
|
-
|
82
|
+
module RemoteStep::SSH
|
83
|
+
|
84
|
+
def _run
|
85
|
+
RemoteWorkflow::SSH.orchestrate_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $slurm_options)
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
SOPT.current_options = rbbt_options
|
91
|
+
|
80
92
|
load Rbbt.share.rbbt_commands.workflow.task.find
|
@@ -3,9 +3,12 @@
|
|
3
3
|
require 'rbbt/util/simpleopt'
|
4
4
|
require 'rbbt/workflow'
|
5
5
|
require 'rbbt/workflow/usage'
|
6
|
+
require 'rbbt/workflow/remote_workflow'
|
6
7
|
require 'rbbt/hpc'
|
7
8
|
require 'time'
|
8
9
|
|
10
|
+
rbbt_options = SOPT::GOT_OPTIONS
|
11
|
+
|
9
12
|
$slurm_options = SOPT.get <<EOF
|
10
13
|
-dr--dry_run Print only the template
|
11
14
|
-cj--clean_job Clean job
|
@@ -56,12 +59,20 @@ class Step
|
|
56
59
|
else
|
57
60
|
begin
|
58
61
|
Log.debug "Issuing SLURM job for #{self.path}"
|
59
|
-
HPC::BATCH_MODULE.run_job(self,
|
62
|
+
HPC::BATCH_MODULE.run_job(self, $slurm_options)
|
60
63
|
rescue HPC::SBATCH
|
61
64
|
end
|
62
65
|
end
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
66
|
-
|
69
|
+
module RemoteStep::SSH
|
70
|
+
|
71
|
+
def _run
|
72
|
+
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $slurm_options)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
SOPT.current_options = rbbt_options
|
67
78
|
load Rbbt.share.rbbt_commands.workflow.task.find
|
@@ -3,10 +3,13 @@
|
|
3
3
|
require 'rbbt/util/simpleopt'
|
4
4
|
require 'rbbt/workflow'
|
5
5
|
require 'rbbt/workflow/usage'
|
6
|
+
require 'rbbt/workflow/remote_workflow'
|
6
7
|
require 'rbbt/hpc'
|
7
8
|
require 'rbbt/hpc/orchestrate'
|
8
9
|
require 'time'
|
9
10
|
|
11
|
+
rbbt_options = SOPT::GOT_OPTIONS
|
12
|
+
|
10
13
|
$slurm_options = SOPT.get <<EOF
|
11
14
|
-dr--dry_run Print only the template
|
12
15
|
-cj--clean_job Clean job
|
@@ -46,6 +49,8 @@ EOF
|
|
46
49
|
batch_system = $slurm_options.delete :batch_system
|
47
50
|
batch_system ||= 'auto'
|
48
51
|
|
52
|
+
$slurm_options[:config_keys] = SOPT::GOT_OPTIONS[:config_keys]
|
53
|
+
|
49
54
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
50
55
|
|
51
56
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
@@ -61,7 +66,6 @@ class Step
|
|
61
66
|
else
|
62
67
|
begin
|
63
68
|
Log.debug "Issuing SLURM job for #{self.path}"
|
64
|
-
#@batch_job_id, @batch_job_dir = HPC::BATCH_MODULE.orchestrate_job(self, SOPT::GOT_OPTIONS.merge($slurm_options))
|
65
69
|
@batch_job_id, @batch_job_dir = HPC::BATCH_MODULE.orchestrate_job(self, $slurm_options)
|
66
70
|
if no_load
|
67
71
|
self
|
@@ -75,6 +79,14 @@ class Step
|
|
75
79
|
end
|
76
80
|
end
|
77
81
|
|
78
|
-
|
79
|
-
|
82
|
+
module RemoteStep::SSH
|
83
|
+
|
84
|
+
def _run
|
85
|
+
RemoteWorkflow::SSH.orchestrate_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $slurm_options)
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
SOPT.current_options = rbbt_options
|
91
|
+
|
80
92
|
load Rbbt.share.rbbt_commands.workflow.task.find
|
@@ -3,9 +3,12 @@
|
|
3
3
|
require 'rbbt/util/simpleopt'
|
4
4
|
require 'rbbt/workflow'
|
5
5
|
require 'rbbt/workflow/usage'
|
6
|
+
require 'rbbt/workflow/remote_workflow'
|
6
7
|
require 'rbbt/hpc'
|
7
8
|
require 'time'
|
8
9
|
|
10
|
+
rbbt_options = SOPT::GOT_OPTIONS
|
11
|
+
|
9
12
|
$slurm_options = SOPT.get <<EOF
|
10
13
|
-dr--dry_run Print only the template
|
11
14
|
-cj--clean_job Clean job
|
@@ -56,12 +59,20 @@ class Step
|
|
56
59
|
else
|
57
60
|
begin
|
58
61
|
Log.debug "Issuing SLURM job for #{self.path}"
|
59
|
-
HPC::BATCH_MODULE.run_job(self,
|
62
|
+
HPC::BATCH_MODULE.run_job(self, $slurm_options)
|
60
63
|
rescue HPC::SBATCH
|
61
64
|
end
|
62
65
|
end
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
66
|
-
|
69
|
+
module RemoteStep::SSH
|
70
|
+
|
71
|
+
def _run
|
72
|
+
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $slurm_options)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
SOPT.current_options = rbbt_options
|
67
78
|
load Rbbt.share.rbbt_commands.workflow.task.find
|
@@ -3,10 +3,13 @@
|
|
3
3
|
require 'rbbt/util/simpleopt'
|
4
4
|
require 'rbbt/workflow'
|
5
5
|
require 'rbbt/workflow/usage'
|
6
|
+
require 'rbbt/workflow/remote_workflow'
|
6
7
|
require 'rbbt/hpc'
|
7
8
|
require 'rbbt/hpc/orchestrate'
|
8
9
|
require 'time'
|
9
10
|
|
11
|
+
rbbt_options = SOPT::GOT_OPTIONS
|
12
|
+
|
10
13
|
$slurm_options = SOPT.get <<EOF
|
11
14
|
-dr--dry_run Print only the template
|
12
15
|
-cj--clean_job Clean job
|
@@ -46,6 +49,8 @@ EOF
|
|
46
49
|
batch_system = $slurm_options.delete :batch_system
|
47
50
|
batch_system ||= 'auto'
|
48
51
|
|
52
|
+
$slurm_options[:config_keys] = SOPT::GOT_OPTIONS[:config_keys]
|
53
|
+
|
49
54
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
50
55
|
|
51
56
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
@@ -61,7 +66,6 @@ class Step
|
|
61
66
|
else
|
62
67
|
begin
|
63
68
|
Log.debug "Issuing SLURM job for #{self.path}"
|
64
|
-
#@batch_job_id, @batch_job_dir = HPC::BATCH_MODULE.orchestrate_job(self, SOPT::GOT_OPTIONS.merge($slurm_options))
|
65
69
|
@batch_job_id, @batch_job_dir = HPC::BATCH_MODULE.orchestrate_job(self, $slurm_options)
|
66
70
|
if no_load
|
67
71
|
self
|
@@ -75,6 +79,14 @@ class Step
|
|
75
79
|
end
|
76
80
|
end
|
77
81
|
|
78
|
-
|
79
|
-
|
82
|
+
module RemoteStep::SSH
|
83
|
+
|
84
|
+
def _run
|
85
|
+
RemoteWorkflow::SSH.orchestrate_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $slurm_options)
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
SOPT.current_options = rbbt_options
|
91
|
+
|
80
92
|
load Rbbt.share.rbbt_commands.workflow.task.find
|
@@ -3,9 +3,12 @@
|
|
3
3
|
require 'rbbt/util/simpleopt'
|
4
4
|
require 'rbbt/workflow'
|
5
5
|
require 'rbbt/workflow/usage'
|
6
|
+
require 'rbbt/workflow/remote_workflow'
|
6
7
|
require 'rbbt/hpc'
|
7
8
|
require 'time'
|
8
9
|
|
10
|
+
rbbt_options = SOPT::GOT_OPTIONS
|
11
|
+
|
9
12
|
$slurm_options = SOPT.get <<EOF
|
10
13
|
-dr--dry_run Print only the template
|
11
14
|
-cj--clean_job Clean job
|
@@ -56,12 +59,20 @@ class Step
|
|
56
59
|
else
|
57
60
|
begin
|
58
61
|
Log.debug "Issuing SLURM job for #{self.path}"
|
59
|
-
HPC::BATCH_MODULE.run_job(self,
|
62
|
+
HPC::BATCH_MODULE.run_job(self, $slurm_options)
|
60
63
|
rescue HPC::SBATCH
|
61
64
|
end
|
62
65
|
end
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
66
|
-
|
69
|
+
module RemoteStep::SSH
|
70
|
+
|
71
|
+
def _run
|
72
|
+
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $slurm_options)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
SOPT.current_options = rbbt_options
|
67
78
|
load Rbbt.share.rbbt_commands.workflow.task.find
|
@@ -547,7 +547,8 @@ if job_file = options.delete(:job_file)
|
|
547
547
|
end
|
548
548
|
|
549
549
|
case res
|
550
|
-
when (defined?(WorkflowRemoteClient) and WorkflowRemoteClient::RemoteStep)
|
550
|
+
#when (defined?(WorkflowRemoteClient) and WorkflowRemoteClient::RemoteStep)
|
551
|
+
when (defined?(RemoteStep) and RemoteStep)
|
551
552
|
res = job.result
|
552
553
|
if res.respond_to? :gets
|
553
554
|
begin
|
@@ -598,7 +599,7 @@ when Step
|
|
598
599
|
elsif detach
|
599
600
|
exit! 0
|
600
601
|
else
|
601
|
-
|
602
|
+
res.join if res.running?
|
602
603
|
if %w(float integer string boolean).include?(res.result_type.to_s)
|
603
604
|
out.puts res.load
|
604
605
|
else
|
data/test/rbbt/hpc/test_batch.rb
CHANGED
@@ -6,7 +6,7 @@ Workflow.require_workflow "Sample"
|
|
6
6
|
Workflow.require_workflow "HTS"
|
7
7
|
class TestSLURM < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def
|
9
|
+
def test_batch_options
|
10
10
|
job = Sample.job(:mutect2, "small", :reference => "hg38")
|
11
11
|
|
12
12
|
TmpFile.with_file do |batch_dir|
|
@@ -17,7 +17,7 @@ class TestSLURM < Test::Unit::TestCase
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def test_template
|
21
21
|
job = Sample.job(:mutect2, "small", :reference => "hg38")
|
22
22
|
|
23
23
|
TmpFile.with_file do |batch_dir|
|
@@ -28,7 +28,7 @@ class TestSLURM < Test::Unit::TestCase
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def test_template_singularity
|
32
32
|
job = Sample.job(:mutect2, "small", :reference => "hg38")
|
33
33
|
|
34
34
|
TmpFile.with_file do |batch_dir|
|
@@ -39,7 +39,7 @@ class TestSLURM < Test::Unit::TestCase
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def test_template_contain
|
43
43
|
job = Sample.job(:mutect2, "small", :reference => "hg38")
|
44
44
|
|
45
45
|
TmpFile.with_file do |batch_dir|
|
@@ -13,5 +13,13 @@ class TestPythonUtil < Test::Unit::TestCase
|
|
13
13
|
assert_equal tsv, new_tsv
|
14
14
|
end
|
15
15
|
|
16
|
+
def test_numpy
|
17
|
+
ra = RbbtPython.run :numpy, :as => :np do
|
18
|
+
na = np.array([[[1,2,3], [4,5,6]]])
|
19
|
+
RbbtPython.numpy2ruby na
|
20
|
+
end
|
21
|
+
assert_equal 6, ra[0][1][2]
|
22
|
+
end
|
23
|
+
|
16
24
|
end
|
17
25
|
|
@@ -81,5 +81,55 @@ def python_print():
|
|
81
81
|
end
|
82
82
|
assert defined
|
83
83
|
end
|
84
|
+
|
85
|
+
def test_iterate
|
86
|
+
a2, b2 = nil, nil
|
87
|
+
RbbtPython.run :numpy, as: :np do
|
88
|
+
a = np.array([1,2])
|
89
|
+
a2 = RbbtPython.collect a do |e|
|
90
|
+
e * 2
|
91
|
+
end
|
92
|
+
b = PyCall.tuple([1,2])
|
93
|
+
b2 = RbbtPython.collect b do |e|
|
94
|
+
e * 2
|
95
|
+
end
|
96
|
+
end
|
97
|
+
assert_equal [2,4], a2
|
98
|
+
assert_equal [2,4], b2
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_lambda
|
102
|
+
l = PyCall.eval "lambda e: e + 2"
|
103
|
+
assert_equal 5, l.(3)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_binding
|
107
|
+
raised = false
|
108
|
+
RbbtPython.binding_run do
|
109
|
+
pyimport :torch
|
110
|
+
pyfrom :torch, import: ["nn"]
|
111
|
+
begin
|
112
|
+
torch
|
113
|
+
rescue
|
114
|
+
raised = true
|
115
|
+
end
|
116
|
+
end
|
117
|
+
assert ! raised
|
118
|
+
|
119
|
+
raised = false
|
120
|
+
RbbtPython.binding_run do
|
121
|
+
begin
|
122
|
+
torch
|
123
|
+
rescue
|
124
|
+
raised = true
|
125
|
+
end
|
126
|
+
end
|
127
|
+
assert raised
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_import_method
|
131
|
+
random = RbbtPython.import_method :torch, :rand, :random
|
132
|
+
assert random.call(1).numpy.to_f > 0
|
133
|
+
end
|
84
134
|
end
|
85
135
|
|
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.
|
4
|
+
version: 5.35.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -613,113 +613,113 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
613
613
|
- !ruby/object:Gem::Version
|
614
614
|
version: '0'
|
615
615
|
requirements: []
|
616
|
-
rubygems_version: 3.1.
|
616
|
+
rubygems_version: 3.1.2
|
617
617
|
signing_key:
|
618
618
|
specification_version: 4
|
619
619
|
summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)
|
620
620
|
test_files:
|
621
|
+
- test/test_helper.rb
|
622
|
+
- test/rbbt/entity/test_identifiers.rb
|
623
|
+
- test/rbbt/test_resource.rb
|
624
|
+
- test/rbbt/test_association.rb
|
625
|
+
- test/rbbt/hpc/test_orchestrate.rb
|
626
|
+
- test/rbbt/hpc/test_slurm.rb
|
627
|
+
- test/rbbt/hpc/orchestrate/test_batches.rb
|
628
|
+
- test/rbbt/hpc/orchestrate/test_rules.rb
|
629
|
+
- test/rbbt/hpc/orchestrate/test_chains.rb
|
630
|
+
- test/rbbt/hpc/test_batch.rb
|
631
|
+
- test/rbbt/persist/test_tsv.rb
|
632
|
+
- test/rbbt/persist/tsv/test_kyotocabinet.rb
|
633
|
+
- test/rbbt/persist/tsv/test_lmdb.rb
|
634
|
+
- test/rbbt/persist/tsv/test_tokyocabinet.rb
|
635
|
+
- test/rbbt/persist/tsv/test_cdb.rb
|
636
|
+
- test/rbbt/persist/tsv/test_leveldb.rb
|
637
|
+
- test/rbbt/persist/tsv/test_sharder.rb
|
638
|
+
- test/rbbt/test_packed_index.rb
|
621
639
|
- test/rbbt/test_entity.rb
|
640
|
+
- test/rbbt/test_fix_width_table.rb
|
622
641
|
- test/rbbt/workflow/test_remote_workflow.rb
|
642
|
+
- test/rbbt/workflow/test_doc.rb
|
643
|
+
- test/rbbt/workflow/step/test_save_load_inputs.rb
|
644
|
+
- test/rbbt/workflow/step/test_dependencies.rb
|
645
|
+
- test/rbbt/workflow/test_schedule.rb
|
623
646
|
- test/rbbt/workflow/util/test_archive.rb
|
624
647
|
- test/rbbt/workflow/util/test_orchestrator.rb
|
625
648
|
- test/rbbt/workflow/util/test_data.rb
|
626
|
-
- test/rbbt/workflow/test_doc.rb
|
627
|
-
- test/rbbt/workflow/test_schedule.rb
|
628
|
-
- test/rbbt/workflow/test_step.rb
|
629
|
-
- test/rbbt/workflow/step/test_dependencies.rb
|
630
|
-
- test/rbbt/workflow/step/test_save_load_inputs.rb
|
631
649
|
- test/rbbt/workflow/test_task.rb
|
632
|
-
- test/rbbt/
|
633
|
-
- test/rbbt/
|
650
|
+
- test/rbbt/workflow/test_step.rb
|
651
|
+
- test/rbbt/test_tsv.rb
|
652
|
+
- test/rbbt/test_annotations.rb
|
653
|
+
- test/rbbt/test_knowledge_base.rb
|
654
|
+
- test/rbbt/util/test_migrate.rb
|
655
|
+
- test/rbbt/util/test_simpleDSL.rb
|
656
|
+
- test/rbbt/util/concurrency/processes/test_socket.rb
|
657
|
+
- test/rbbt/util/concurrency/test_processes.rb
|
658
|
+
- test/rbbt/util/concurrency/test_threads.rb
|
659
|
+
- test/rbbt/util/test_filecache.rb
|
660
|
+
- test/rbbt/util/simpleopt/test_get.rb
|
661
|
+
- test/rbbt/util/simpleopt/test_parse.rb
|
662
|
+
- test/rbbt/util/simpleopt/test_setup.rb
|
663
|
+
- test/rbbt/util/test_misc.rb
|
664
|
+
- test/rbbt/util/test_excel2tsv.rb
|
665
|
+
- test/rbbt/util/test_semaphore.rb
|
634
666
|
- test/rbbt/util/test_procpath.rb
|
667
|
+
- test/rbbt/util/R/test_model.rb
|
668
|
+
- test/rbbt/util/R/test_eval.rb
|
669
|
+
- test/rbbt/util/R/test_plot.rb
|
670
|
+
- test/rbbt/util/test_open.rb
|
671
|
+
- test/rbbt/util/test_tmpfile.rb
|
672
|
+
- test/rbbt/util/test_cmd.rb
|
673
|
+
- test/rbbt/util/test_concurrency.rb
|
674
|
+
- test/rbbt/util/test_colorize.rb
|
675
|
+
- test/rbbt/util/test_config.rb
|
635
676
|
- test/rbbt/util/python/test_util.rb
|
636
|
-
- test/rbbt/util/
|
677
|
+
- test/rbbt/util/test_log.rb
|
678
|
+
- test/rbbt/util/test_simpleopt.rb
|
679
|
+
- test/rbbt/util/test_python.rb
|
680
|
+
- test/rbbt/util/test_chain_methods.rb
|
637
681
|
- test/rbbt/util/misc/test_omics.rb
|
638
|
-
- test/rbbt/util/misc/test_pipes.rb
|
639
|
-
- test/rbbt/util/misc/test_serialize.rb
|
640
|
-
- test/rbbt/util/misc/test_format.rb
|
641
|
-
- test/rbbt/util/misc/test_communication.rb
|
642
682
|
- test/rbbt/util/misc/test_lock.rb
|
643
683
|
- test/rbbt/util/misc/test_multipart_payload.rb
|
644
684
|
- test/rbbt/util/misc/test_bgzf.rb
|
645
|
-
- test/rbbt/util/
|
646
|
-
- test/rbbt/util/
|
647
|
-
- test/rbbt/util/
|
648
|
-
- test/rbbt/util/
|
649
|
-
- test/rbbt/util/
|
650
|
-
- test/rbbt/util/test_config.rb
|
651
|
-
- test/rbbt/util/test_log.rb
|
652
|
-
- test/rbbt/util/test_simpleDSL.rb
|
685
|
+
- test/rbbt/util/misc/test_development.rb
|
686
|
+
- test/rbbt/util/misc/test_serialize.rb
|
687
|
+
- test/rbbt/util/misc/test_format.rb
|
688
|
+
- test/rbbt/util/misc/test_communication.rb
|
689
|
+
- test/rbbt/util/misc/test_pipes.rb
|
653
690
|
- test/rbbt/util/log/test_progress.rb
|
654
|
-
- test/rbbt/util/test_tmpfile.rb
|
655
691
|
- test/rbbt/util/test_R.rb
|
656
|
-
- test/rbbt/
|
657
|
-
- test/rbbt/
|
658
|
-
- test/rbbt/
|
659
|
-
- test/rbbt/
|
660
|
-
- test/rbbt/
|
661
|
-
- test/rbbt/
|
662
|
-
- test/rbbt/
|
663
|
-
- test/rbbt/
|
664
|
-
- test/rbbt/
|
665
|
-
- test/rbbt/
|
666
|
-
- test/rbbt/
|
667
|
-
- test/rbbt/
|
668
|
-
- test/rbbt/
|
669
|
-
- test/rbbt/
|
670
|
-
- test/rbbt/
|
671
|
-
- test/rbbt/
|
672
|
-
- test/rbbt/
|
673
|
-
- test/rbbt/tsv/test_change_id.rb
|
674
|
-
- test/rbbt/tsv/test_attach.rb
|
675
|
-
- test/rbbt/tsv/test_filter.rb
|
676
|
-
- test/rbbt/tsv/test_marshal.rb
|
692
|
+
- test/rbbt/test_workflow.rb
|
693
|
+
- test/rbbt/knowledge_base/test_entity.rb
|
694
|
+
- test/rbbt/knowledge_base/test_enrichment.rb
|
695
|
+
- test/rbbt/knowledge_base/test_traverse.rb
|
696
|
+
- test/rbbt/knowledge_base/test_syndicate.rb
|
697
|
+
- test/rbbt/knowledge_base/test_registry.rb
|
698
|
+
- test/rbbt/knowledge_base/test_query.rb
|
699
|
+
- test/rbbt/association/test_item.rb
|
700
|
+
- test/rbbt/association/test_util.rb
|
701
|
+
- test/rbbt/association/test_open.rb
|
702
|
+
- test/rbbt/association/test_database.rb
|
703
|
+
- test/rbbt/association/test_index.rb
|
704
|
+
- test/rbbt/annotations/test_util.rb
|
705
|
+
- test/rbbt/test_monitor.rb
|
706
|
+
- test/rbbt/resource/test_path.rb
|
707
|
+
- test/rbbt/test_hpc.rb
|
708
|
+
- test/rbbt/test_persist.rb
|
677
709
|
- test/rbbt/tsv/test_parser.rb
|
678
710
|
- test/rbbt/tsv/test_csv.rb
|
679
|
-
- test/rbbt/tsv/
|
680
|
-
- test/rbbt/tsv/test_matrix.rb
|
711
|
+
- test/rbbt/tsv/test_manipulate.rb
|
681
712
|
- test/rbbt/tsv/test_field_index.rb
|
682
713
|
- test/rbbt/tsv/test_util.rb
|
683
|
-
- test/rbbt/tsv/
|
714
|
+
- test/rbbt/tsv/test_accessor.rb
|
715
|
+
- test/rbbt/tsv/test_filter.rb
|
716
|
+
- test/rbbt/tsv/test_stream.rb
|
684
717
|
- test/rbbt/tsv/test_parallel.rb
|
685
|
-
- test/rbbt/tsv/
|
718
|
+
- test/rbbt/tsv/test_marshal.rb
|
719
|
+
- test/rbbt/tsv/test_matrix.rb
|
720
|
+
- test/rbbt/tsv/test_attach.rb
|
686
721
|
- test/rbbt/tsv/test_excel.rb
|
687
|
-
- test/rbbt/tsv/
|
722
|
+
- test/rbbt/tsv/test_change_id.rb
|
723
|
+
- test/rbbt/tsv/test_index.rb
|
688
724
|
- test/rbbt/tsv/parallel/test_traverse.rb
|
689
|
-
- test/rbbt/tsv/
|
690
|
-
- test/rbbt/test_association.rb
|
691
|
-
- test/rbbt/hpc/test_batch.rb
|
692
|
-
- test/rbbt/hpc/orchestrate/test_chains.rb
|
693
|
-
- test/rbbt/hpc/orchestrate/test_rules.rb
|
694
|
-
- test/rbbt/hpc/orchestrate/test_batches.rb
|
695
|
-
- test/rbbt/hpc/test_slurm.rb
|
696
|
-
- test/rbbt/hpc/test_orchestrate.rb
|
697
|
-
- test/rbbt/association/test_database.rb
|
698
|
-
- test/rbbt/association/test_item.rb
|
699
|
-
- test/rbbt/association/test_open.rb
|
700
|
-
- test/rbbt/association/test_util.rb
|
701
|
-
- test/rbbt/association/test_index.rb
|
702
|
-
- test/rbbt/test_knowledge_base.rb
|
703
|
-
- test/rbbt/persist/tsv/test_kyotocabinet.rb
|
704
|
-
- test/rbbt/persist/tsv/test_cdb.rb
|
705
|
-
- test/rbbt/persist/tsv/test_lmdb.rb
|
706
|
-
- test/rbbt/persist/tsv/test_sharder.rb
|
707
|
-
- test/rbbt/persist/tsv/test_leveldb.rb
|
708
|
-
- test/rbbt/persist/tsv/test_tokyocabinet.rb
|
709
|
-
- test/rbbt/persist/test_tsv.rb
|
710
|
-
- test/rbbt/test_tsv.rb
|
711
|
-
- test/rbbt/test_annotations.rb
|
712
|
-
- test/rbbt/test_fix_width_table.rb
|
713
|
-
- test/rbbt/test_workflow.rb
|
714
|
-
- test/rbbt/entity/test_identifiers.rb
|
715
|
-
- test/rbbt/annotations/test_util.rb
|
716
|
-
- test/rbbt/test_hpc.rb
|
717
|
-
- test/rbbt/test_monitor.rb
|
718
|
-
- test/rbbt/test_persist.rb
|
719
|
-
- test/rbbt/knowledge_base/test_entity.rb
|
720
|
-
- test/rbbt/knowledge_base/test_registry.rb
|
721
|
-
- test/rbbt/knowledge_base/test_syndicate.rb
|
722
|
-
- test/rbbt/knowledge_base/test_query.rb
|
723
|
-
- test/rbbt/knowledge_base/test_enrichment.rb
|
724
|
-
- test/rbbt/knowledge_base/test_traverse.rb
|
725
|
-
- test/test_helper.rb
|
725
|
+
- test/rbbt/tsv/parallel/test_through.rb
|