rbbt-util 5.26.93 → 5.26.97

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: 45fa23a77186b3e5f47cf3ccf754a4b2906329639ca1d188e2b9f347850abd27
4
- data.tar.gz: 49b4d7b48339260536aebbd8c9f35e59155bf253a7a63685683db54967ca5359
3
+ metadata.gz: 19e2d3760c86a3a14044b46b95d43380190332270ec3047e620c1235df0ebdf8
4
+ data.tar.gz: 929a4ff0a6fa72825b0e916e07ebd38f55d09dfd9bf4486cc069dd502d683033
5
5
  SHA512:
6
- metadata.gz: 37d1a5ac5167e6f4612413c86b03bb96babf71164c9c7433d14d841d3fee489ecc4abc6a613ea49f2580876cd78bd32e8a40e7437953efcbcf0e5464d1f11589
7
- data.tar.gz: db18ad88a2c5eae7b478eeebde69ea498ffd8f123b8e1113e4e7dc91a21ed7689147436ac690d5b5f4777bf7cd2efa1227250fa3a477ef76ebca88c8add80a8c
6
+ metadata.gz: 8afac300f9e35d72708e096c6ef878cf1573dac955ce5e85c1d9dd422c01fecbd78f9ea86ce19e65315b564cf1e510ddb5bb173be5f82d8003625d00b08ef949
7
+ data.tar.gz: a1021842c668f85c4a759263e40720c603875bbce8de2db8b26160e35de9056a3ab768101e047b4e2fc58222b1470593e84ac23a6e00ab713637183b10210264
data/lib/rbbt/hpc.rb CHANGED
@@ -33,15 +33,13 @@ module Marenostrum
33
33
  config_keys = options.delete :config_keys
34
34
 
35
35
  if contain_and_sync
36
- contain = "/scratch/tmp/rbbt-${USER}" if contain.nil?
36
+ contain = "/scratch/tmp/rbbt-#{ENV["USER"]}" if contain.nil?
37
37
  sync = "~/.rbbt/var/jobs" if sync.nil?
38
+ wipe_container = "post" if wipe_container.nil?
38
39
  end
39
40
 
40
41
  contain = File.expand_path(contain) if contain
41
42
 
42
- singularity = true if contain
43
-
44
-
45
43
  name = options[:name] ||= Misc.obj2digest({:options => options.collect{|k,v| [k,v]}.sort_by{|k,v| k.to_s }, :args => args})
46
44
  options.delete(:name)
47
45
  slurm_basedir = options[:slurm_basedir] ||= File.expand_path(File.join('~/rbbt-slurm', name)) if slurm_basedir.nil?
@@ -120,7 +118,17 @@ module load java
120
118
  let "MAX_MEMORY=$SLURM_MEM_PER_CPU * $SLURM_CPUS_ON_NODE"
121
119
  EOF
122
120
 
121
+
122
+ # RUN
123
+ run = ""
124
+ exec_cmd = %(env _JAVA_OPTIONS="-Xms1g -Xmx${MAX_MEMORY}m")
125
+
126
+
123
127
  if singularity
128
+ #{{{ SINGULARITY
129
+
130
+ singularity_exec = %(singularity exec -e -B $SINGULARITY_OPT_DIR:/singularity_opt/ -B /apps/)
131
+
124
132
  env +=<<-EOF
125
133
  module load intel/2018.1
126
134
  module load singularity
@@ -130,15 +138,14 @@ SINGULARITY_OPT_DIR="$PROJECTS_ROOT/singularity_opt/"
130
138
  SINGULARITY_RUBY_INLINE="$HOME/.singularity_ruby_inline"
131
139
  mkdir -p "$SINGULARITY_RUBY_INLINE"
132
140
  EOF
133
- end
134
141
 
135
- if contain
136
- user = ENV['USER'] || `whoami`.strip
137
- group = File.basename(File.dirname(ENV['HOME']))
138
- scratch_group_dir = File.join('/gpfs/scratch/', group)
139
- projects_group_dir = File.join('/gpfs/projects/', group)
142
+ if contain
143
+ user = ENV['USER'] || `whoami`.strip
144
+ group = File.basename(File.dirname(ENV['HOME']))
145
+ scratch_group_dir = File.join('/gpfs/scratch/', group)
146
+ projects_group_dir = File.join('/gpfs/projects/', group)
140
147
 
141
- env +=<<-EOF
148
+ env +=<<-EOF
142
149
 
143
150
  # Prepare container dir
144
151
  CONTAINER_DIR="#{contain}"
@@ -168,43 +175,36 @@ echo "$CONTAINER_DIR/projects/rbbt/workflows/" > $CONTAINER_DIR/.rbbt/etc/workfl
168
175
  [[ -a "$CONTAINER_DIR/scratch" ]] || ln -s '#{scratch_group_dir}' "$CONTAINER_DIR/scratch"
169
176
  EOF
170
177
 
171
- if inputs_dir
172
- env +=<<-EOF
178
+ if inputs_dir
179
+ env +=<<-EOF
173
180
 
174
181
  # Copy inputs
175
182
  [[ -d '#{inputs_dir}' ]] && cp -R '#{inputs_dir}' $CONTAINER_DIR/inputs
176
- EOF
177
- rbbt_cmd = rbbt_cmd.sub(inputs_dir, "#{contain}/inputs")
178
- end
183
+ EOF
184
+ rbbt_cmd = rbbt_cmd.sub(inputs_dir, "#{contain}/inputs")
185
+ end
179
186
 
180
- if copy_image
181
- env +=<<EOF
187
+ if copy_image
188
+ env +=<<EOF
182
189
 
183
190
  # Copy image
184
191
  rsync -avz "$SINGULARITY_IMG" "$CONTAINER_DIR/rbbt.singularity.img" 1>&2
185
192
  SINGULARITY_IMG="$CONTAINER_DIR/rbbt.singularity.img"
186
193
  EOF
187
- end
194
+ end
188
195
 
189
- if wipe_container == "pre" || wipe_container == "both"
190
- env +=<<-EOF
196
+ if wipe_container == "pre" || wipe_container == "both"
197
+ if singularity
198
+ env +=<<-EOF
191
199
 
192
200
  # Clean container pre
193
201
  singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rm -Rfv .rbbt/var/jobs &>> #{fsync}
194
202
  singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rbbt system clean -f &>> #{fsync}
195
203
  singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rm -Rfv tmp/ &>> #{fsync}
196
204
  EOF
205
+ end
206
+ end
197
207
  end
198
- end
199
-
200
- # RUN
201
- run = ""
202
-
203
-
204
- exec_cmd = %(env _JAVA_OPTIONS="-Xms1g -Xmx${MAX_MEMORY}m")
205
-
206
- if singularity
207
- singularity_exec = %(singularity exec -e -B $SINGULARITY_OPT_DIR:/singularity_opt/ -B /apps/)
208
208
 
209
209
  if contain
210
210
  singularity_exec << %( -C -H "$CONTAINER_DIR" \
@@ -222,7 +222,7 @@ EOF
222
222
  end
223
223
 
224
224
  if development
225
- exec_cmd += ' rbbt --dev=git'
225
+ exec_cmd += " rbbt --dev='#{development}'"
226
226
  else
227
227
  exec_cmd += ' rbbt'
228
228
  end
@@ -230,10 +230,14 @@ EOF
230
230
  exec_cmd = singularity_exec + " " + exec_cmd
231
231
  else
232
232
  if development
233
- exec_cmd << " " << %(~/git/rbbt-util/bin/rbbt --dev=~/git/)
233
+ exec_cmd << " " << %(~/git/rbbt-util/bin/rbbt --dev=#{development})
234
234
  else
235
235
  exec_cmd << " " << 'rbbt'
236
236
  end
237
+
238
+ if contain
239
+ rbbt_cmd << " " << %(--workdir_all='#{contain}')
240
+ end
237
241
  end
238
242
 
239
243
 
@@ -260,6 +264,10 @@ EOF
260
264
  if singularity
261
265
  coda +=<<-EOF
262
266
  singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rbbt system clean all -q &>> #{fsync}
267
+ EOF
268
+ else
269
+ coda +=<<-EOF
270
+ rbbt system clean all -q &>> #{fsync}
263
271
  EOF
264
272
  end
265
273
 
@@ -280,7 +288,13 @@ find '#{target}' -type l -ls | awk '$13 ~ /^#{target.gsub('/','\/')}/ { sub("#{s
280
288
  EOF
281
289
 
282
290
  if contain && (wipe_container == "post" || wipe_container == "both")
283
- coda +=<<-EOF
291
+ run =<<-EOF + run
292
+ if $(ls -A '#{contain}'); then
293
+ echo "ERROR: Container directory not empty, refusing to wipe. #{contain}"
294
+ fi
295
+ EOF
296
+ if singularity
297
+ coda +=<<-EOF
284
298
  singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rbbt system clean -f &>> #{fsync}
285
299
  singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rm -v /dev/shm/sem.*.{in,out,process} /dev/shm/sem.Session-PID.*.sem 2> /dev/null >> #{fsync}
286
300
  if [ $sync_es == '0' ]; then
@@ -291,6 +305,18 @@ else
291
305
  fi
292
306
  unset sync_es
293
307
  EOF
308
+ else
309
+ coda +=<<-EOF
310
+ #{exec_cmd} system clean
311
+ if [ $sync_es == '0' ]; then
312
+ rm -Rfv #{contain} &>> #{fsync}
313
+ else
314
+ echo "WARNING: Results could not sync correctly. Contain directory not purged"
315
+ fi
316
+ unset sync_es
317
+ EOF
318
+
319
+ end
294
320
  end
295
321
  end
296
322
  coda +=<<-EOF
data/lib/rbbt/util/cmd.rb CHANGED
@@ -6,8 +6,8 @@ require 'rbbt/util/misc/indiferent_hash'
6
6
  module CMD
7
7
 
8
8
  TOOLS = IndiferentHash.setup({})
9
- def self.tool(tool, claim = nil, test = nil, &block)
10
- TOOLS[tool] = [claim, test, block]
9
+ def self.tool(tool, claim = nil, test = nil, cmd = nil, &block)
10
+ TOOLS[tool] = [claim, test, block, cmd]
11
11
  end
12
12
 
13
13
  def self.get_tool(tool)
@@ -15,10 +15,10 @@ module CMD
15
15
 
16
16
  @@init_cmd_tool ||= IndiferentHash.setup({})
17
17
  if !@@init_cmd_tool[tool]
18
- claim, test, block = TOOLS[tool]
18
+ claim, test, block, cmd = TOOLS[tool]
19
19
  begin
20
20
  if test
21
- CMD.cmd(test)
21
+ CMD.cmd(test + " ")
22
22
  else
23
23
  CMD.cmd("#{tool} --help")
24
24
  end
@@ -30,6 +30,8 @@ module CMD
30
30
  end
31
31
  end
32
32
  @@init_cmd_tool[tool] = true
33
+
34
+ return cmd if cmd
33
35
  end
34
36
 
35
37
  tool.to_s
@@ -73,7 +73,7 @@ module Workflow
73
73
  set_info :result_type, dep.info[:result_type]
74
74
  forget = config :forget_dep_tasks, :forget_dep_tasks, :default => FORGET_DEP_TASKS
75
75
  if forget
76
- self.archive
76
+ self.archive_deps
77
77
  self.dependencies = self.dependencies - [dep]
78
78
  Open.rm_rf self.files_dir if Open.exist? self.files_dir
79
79
  FileUtils.cp_r dep.files_dir, self.files_dir if Open.exist? dep.files_dir
@@ -108,7 +108,7 @@ class Step
108
108
  @inputs || []
109
109
  end
110
110
 
111
- def archive
111
+ def archive_deps
112
112
  self.set_info :archived_info, archived_info
113
113
  self.set_info :archived_dependencies, info[:dependencies]
114
114
  end
@@ -301,7 +301,7 @@ saved_job_options = job_options
301
301
  workflow.workdir = Path.setup(File.expand_path(options.delete(:workdir))) if options[:workdir]
302
302
 
303
303
  if override_deps
304
- override_deps.split($array_separator).each do |part|
304
+ override_deps.split($array_separator || ",").each do |part|
305
305
  t_, value = part.split("=")
306
306
  job_options.merge!( t_ => value)
307
307
  end
@@ -218,6 +218,6 @@ if plot
218
218
  labs(x=NULL, y=NULL) +
219
219
  theme_gantt() + theme(axis.text.x=element_text(angle=45, hjust=1))
220
220
 
221
- rbbt.png_plot('#{plot}', 'timeline', width=#{width}, height=#{height}, pointsize=6)
221
+ rbbt.png_plot('#{plot}', 'plot(timeline)', width=#{width}, height=#{height}, pointsize=6)
222
222
  EOF
223
223
  end
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.26.93
4
+ version: 5.26.97
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake