rbbt-util 5.34.27 → 5.35.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40a3d86f01180255239e05fc23309b2c798eb94ee4c213ab8699f7954c1f5346
4
- data.tar.gz: 3357e23002f032213a6b4c01ef046527092c8e4bf9ebce96dfc714176c3cb239
3
+ metadata.gz: 5efc019e19e967e30d83a08aa3ed45debe5036dac45f644ec0c7195100112e08
4
+ data.tar.gz: 1b7f34c9cb59d5936762531df4e004728071a90f4fcf3a4dce009e58071d7ffa
5
5
  SHA512:
6
- metadata.gz: 8454ec0e14dac9fbdb5fa00a2219248b5037c890289fb5b013d69d6dac63e869b5160620d1ac744392546bf58dc8acfb1afba5c9172f366ddae01fc6cc008810
7
- data.tar.gz: c85e5b6defde582d6af2c08281dd659bd8f71ae9867d4258d2c96c9824b3d0fe7020472fc6ccec3e66f4f70228bdc3dea425756abd510ded61a7f59420b78b98
6
+ metadata.gz: e0282a5eb3e8ec139b2cfc60face60d9bbd83d3597291df4e37fe9b8c4b2bca78a5fac23eb0c2ed4948d7cc61005c0625d992faaa67e265cd12443ee509f3037
7
+ data.tar.gz: a1e058254ad80b23409bb8f4618f14949089d6fbb355228fbf7abf82919d55a4ee86f47cdb1684014079a00f65831a5ea1900e63808fe21e863de3c67e121e86
@@ -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
@@ -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
- rules = Misc.load_yaml(options[:orchestration_rules])
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
@@ -90,6 +90,7 @@ module Resource
90
90
 
91
91
  lock_filename = nil # it seems like this was locked already.
92
92
 
93
+ Log.low "Downloading #{path} from #{url} file server"
93
94
  Misc.lock lock_filename do
94
95
  begin
95
96
  uri = URI(url)
@@ -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? source_key
139
- v = other[source_key][pos]
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 other.type == :double
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
@@ -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 : ":NA") } * ", ") <<
45
+ (tsv.fields.collect{|f| R.ruby2R(@options[f] ? @options[f].to_s : "NA") } * ", ") <<
46
46
  ")"
47
47
  end
48
48
 
@@ -47,6 +47,8 @@ module R
47
47
  else
48
48
  "'character'"
49
49
  end
50
+ when Time
51
+ "'Date'"
50
52
  when Symbol
51
53
  "'factor'"
52
54
  else
data/lib/rbbt/util/R.rb CHANGED
@@ -131,7 +131,7 @@ source(interactive.script.file)
131
131
  "Inf"
132
132
  when nil
133
133
  "NULL"
134
- when "NA"
134
+ when ":NA"
135
135
  "NA"
136
136
  when TSV
137
137
  "matrix(#{R.ruby2R object.values},dimnames=list(#{R.ruby2R object.keys}, #{R.ruby2R object.fields}))"
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 "Command [#{pid}] #{cmd} failed with error status #{status.exitstatus}.\n#{err}"
249
+ raise ProcessFailed.new pid, "#{cmd} failed with error status #{status.exitstatus}.\n#{err}"
248
250
  else
249
- raise ProcessFailed.new "Command [#{pid}] #{cmd} failed with error status #{status.exitstatus}"
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 log
85
- raise ProcessFailed.new "Error joining process #{t.pid} in #{self.filename || self.inspect}. Last log line: #{log}" if ! (t.value.success? || no_fail)
86
- else
87
- raise ProcessFailed.new "Error joining process #{t.pid} in #{self.filename || self.inspect}" if ! (t.value.success? || no_fail)
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
- if log
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.ssh_run(server, script = nil)
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
- def initialize(pid = Process.pid)
14
+ attr_accessor :pid, :msg
15
+ def initialize(pid = Process.pid, msg = nil)
9
16
  @pid = pid
10
- @msg = "Process #{@pid} failed"
11
- super(@msg)
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.include?('.files/')
279
+ return false unless path =~ /\.files(?:\/|$)/
280
280
  parts = path.split("/")
281
281
  job = parts.select{|p| p =~ /\.files$/}.first
282
282
  if job
@@ -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
- values = {}
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
- values[input] = value
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
- values[input] = %w(F false FALSE no).include?(value)? false : true
37
+ @@current_options[input] = %w(F false FALSE no).include?(value)? false : true
35
38
  end
36
39
  end
37
40
 
38
- IndiferentHash.setup values
39
- GOT_OPTIONS.merge! values
41
+ IndiferentHash.setup @@current_options
42
+ GOT_OPTIONS.merge! @@current_options
40
43
 
41
- values
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 = 'default' if task.nil?
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
- JSON.parse(Misc.ssh_run(server, script))
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.produce
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
- job.produce
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.inputs.to_hash
216
+ inputs = job.recursive_inputs.to_hash
217
+
194
218
  job.dependencies.each do |dep|
195
- dep.produce if options[:produce_dependencies]
196
- next unless dep.done?
219
+ dep.produce
220
+ end if options[:produce_dependencies]
197
221
 
198
- Step.migrate(dep.path, search_path, :target => server)
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.dependencies.collect{|dep| [dep.workflow.to_s, dep.task_name.to_s] * "#" << "=" << Rbbt.identify(dep.path)}
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 = RemoteWorkflow::SSH.run_job(File.join(base_url, task.to_s), @input_id, @base_name)
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
 
@@ -266,6 +266,8 @@ class RemoteStep < Step
266
266
  end
267
267
  end
268
268
 
269
+ raise "Error in remote step" if self.error?
270
+
269
271
  self
270
272
  end
271
273
 
@@ -201,6 +201,7 @@ class Step
201
201
 
202
202
  def self.save_inputs(inputs, input_types, dir)
203
203
  inputs.each do |name,value|
204
+ next if value.nil?
204
205
  type = input_types[name]
205
206
  type = type.to_s if type
206
207
 
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
- remote_workflow_tasks = Misc.load_yaml(filename)
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 & rmdir "$OPT_BUILD_DIR" & exit -1 ) ) 2> /dev/null
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/`ls $OPT_BUILD_DIR |head -n 1`
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)
@@ -42,7 +42,6 @@ if ! Misc.filename?(playbook_file)
42
42
  playbook_file = Ansible.playbook recipe, task, options
43
43
  end
44
44
 
45
-
46
45
  if dry_run
47
46
  if Hash === playbook_file
48
47
  ppp playbook_file.to_yaml
@@ -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
- ARGV.concat ['--detach']
79
- ARGV.concat ["-W", $slurm_options[:workflows]] if $slurm_options[:workflows]
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, SOPT::GOT_OPTIONS.merge($slurm_options))
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
- ARGV.concat ["-W", $slurm_options[:workflows]] if $slurm_options[:workflows]
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
- ARGV.concat ['--detach']
79
- ARGV.concat ["-W", $slurm_options[:workflows]] if $slurm_options[:workflows]
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, SOPT::GOT_OPTIONS.merge($slurm_options))
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
- ARGV.concat ["-W", $slurm_options[:workflows]] if $slurm_options[:workflows]
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
- ARGV.concat ['--detach']
79
- ARGV.concat ["-W", $slurm_options[:workflows]] if $slurm_options[:workflows]
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, SOPT::GOT_OPTIONS.merge($slurm_options))
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
- ARGV.concat ["-W", $slurm_options[:workflows]] if $slurm_options[:workflows]
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
- res.join if res.running?
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
@@ -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 _test_batch_options
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 _test_template
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 _test_template_singularity
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 _test_template_contain
42
+ def test_template_contain
43
43
  job = Sample.job(:mutect2, "small", :reference => "hg38")
44
44
 
45
45
  TmpFile.with_file do |batch_dir|
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.27
4
+ version: 5.35.1
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-12-15 00:00:00.000000000 Z
11
+ date: 2023-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake