rbbt-util 5.44.1 → 6.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rbbt +67 -90
- data/etc/app.d/base.rb +2 -2
- data/etc/app.d/semaphores.rb +3 -3
- data/lib/rbbt/annotations/annotated_array.rb +207 -207
- data/lib/rbbt/annotations/refactor.rb +27 -0
- data/lib/rbbt/annotations/util.rb +282 -282
- data/lib/rbbt/annotations.rb +343 -320
- data/lib/rbbt/association/database.rb +200 -225
- data/lib/rbbt/association/index.rb +294 -291
- data/lib/rbbt/association/item.rb +227 -227
- data/lib/rbbt/association/open.rb +35 -34
- data/lib/rbbt/association/util.rb +0 -169
- data/lib/rbbt/association.rb +2 -4
- data/lib/rbbt/entity/identifiers.rb +119 -118
- data/lib/rbbt/entity/refactor.rb +12 -0
- data/lib/rbbt/entity.rb +319 -315
- data/lib/rbbt/hpc/batch.rb +72 -53
- data/lib/rbbt/hpc/lsf.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/batches.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/chains.rb +25 -5
- data/lib/rbbt/hpc/orchestrate/rules.rb +2 -2
- data/lib/rbbt/hpc/orchestrate.rb +19 -13
- data/lib/rbbt/hpc/slurm.rb +18 -18
- data/lib/rbbt/knowledge_base/entity.rb +13 -5
- data/lib/rbbt/knowledge_base/query.rb +2 -2
- data/lib/rbbt/knowledge_base/registry.rb +32 -31
- data/lib/rbbt/knowledge_base/traverse.rb +1 -1
- data/lib/rbbt/knowledge_base.rb +1 -1
- data/lib/rbbt/monitor.rb +36 -25
- data/lib/rbbt/persist/refactor.rb +166 -0
- data/lib/rbbt/persist/tsv/tokyocabinet.rb +105 -105
- data/lib/rbbt/persist/tsv.rb +187 -185
- data/lib/rbbt/persist.rb +556 -551
- data/lib/rbbt/refactor.rb +20 -0
- data/lib/rbbt/resource/path/refactor.rb +178 -0
- data/lib/rbbt/resource/path.rb +317 -497
- data/lib/rbbt/resource/util.rb +0 -48
- data/lib/rbbt/resource.rb +3 -390
- data/lib/rbbt/tsv/accessor.rb +2 -838
- data/lib/rbbt/tsv/attach.rb +303 -299
- data/lib/rbbt/tsv/change_id.rb +244 -245
- data/lib/rbbt/tsv/csv.rb +87 -85
- data/lib/rbbt/tsv/dumper.rb +2 -100
- data/lib/rbbt/tsv/excel.rb +26 -24
- data/lib/rbbt/tsv/field_index.rb +4 -1
- data/lib/rbbt/tsv/filter.rb +3 -2
- data/lib/rbbt/tsv/index.rb +2 -284
- data/lib/rbbt/tsv/manipulate.rb +750 -747
- data/lib/rbbt/tsv/marshal.rb +3 -3
- data/lib/rbbt/tsv/matrix.rb +2 -2
- data/lib/rbbt/tsv/parallel/through.rb +2 -1
- data/lib/rbbt/tsv/parallel/traverse.rb +783 -781
- data/lib/rbbt/tsv/parser.rb +678 -678
- data/lib/rbbt/tsv/refactor.rb +195 -0
- data/lib/rbbt/tsv/stream.rb +253 -251
- data/lib/rbbt/tsv/util.rb +420 -420
- data/lib/rbbt/tsv.rb +210 -208
- data/lib/rbbt/util/R/eval.rb +4 -4
- data/lib/rbbt/util/R/plot.rb +62 -166
- data/lib/rbbt/util/R.rb +21 -18
- data/lib/rbbt/util/cmd.rb +2 -318
- data/lib/rbbt/util/color.rb +269 -269
- data/lib/rbbt/util/colorize.rb +89 -89
- data/lib/rbbt/util/concurrency/processes/refactor.rb +22 -0
- data/lib/rbbt/util/concurrency/processes/worker.rb +2 -2
- data/lib/rbbt/util/concurrency/processes.rb +389 -386
- data/lib/rbbt/util/config.rb +169 -167
- data/lib/rbbt/util/iruby.rb +20 -0
- data/lib/rbbt/util/log/progress/report.rb +241 -241
- data/lib/rbbt/util/log/progress/util.rb +99 -99
- data/lib/rbbt/util/log/progress.rb +102 -102
- data/lib/rbbt/util/log/refactor.rb +49 -0
- data/lib/rbbt/util/log.rb +486 -532
- data/lib/rbbt/util/migrate.rb +1 -1
- data/lib/rbbt/util/misc/concurrent_stream.rb +248 -246
- data/lib/rbbt/util/misc/development.rb +12 -11
- data/lib/rbbt/util/misc/exceptions.rb +117 -112
- data/lib/rbbt/util/misc/format.rb +2 -230
- data/lib/rbbt/util/misc/indiferent_hash.rb +2 -107
- data/lib/rbbt/util/misc/inspect.rb +2 -476
- data/lib/rbbt/util/misc/lock.rb +109 -106
- data/lib/rbbt/util/misc/omics.rb +9 -1
- data/lib/rbbt/util/misc/pipes.rb +765 -793
- data/lib/rbbt/util/misc/refactor.rb +20 -0
- data/lib/rbbt/util/misc/ssw.rb +27 -17
- data/lib/rbbt/util/misc/system.rb +0 -15
- data/lib/rbbt/util/misc.rb +39 -20
- data/lib/rbbt/util/named_array/refactor.rb +4 -0
- data/lib/rbbt/util/named_array.rb +3 -220
- data/lib/rbbt/util/open/refactor.rb +7 -0
- data/lib/rbbt/util/open.rb +3 -857
- data/lib/rbbt/util/procpath.rb +6 -6
- data/lib/rbbt/util/python/paths.rb +27 -0
- data/lib/rbbt/util/python/run.rb +115 -0
- data/lib/rbbt/util/python/script.rb +110 -0
- data/lib/rbbt/util/python/util.rb +3 -3
- data/lib/rbbt/util/python.rb +22 -81
- data/lib/rbbt/util/semaphore.rb +152 -148
- data/lib/rbbt/util/simpleopt.rb +9 -8
- data/lib/rbbt/util/ssh/refactor.rb +19 -0
- data/lib/rbbt/util/ssh.rb +122 -118
- data/lib/rbbt/util/tar.rb +117 -115
- data/lib/rbbt/util/tmpfile.rb +69 -67
- data/lib/rbbt/util/version.rb +2 -0
- data/lib/rbbt/workflow/refactor/entity.rb +11 -0
- data/lib/rbbt/workflow/refactor/export.rb +66 -0
- data/lib/rbbt/workflow/refactor/inputs.rb +24 -0
- data/lib/rbbt/workflow/refactor/recursive.rb +64 -0
- data/lib/rbbt/workflow/refactor/task_info.rb +65 -0
- data/lib/rbbt/workflow/refactor.rb +153 -0
- data/lib/rbbt/workflow/remote_workflow/driver/ssh.rb +55 -32
- data/lib/rbbt/workflow/remote_workflow/remote_step/rest.rb +3 -1
- data/lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb +14 -5
- data/lib/rbbt/workflow/remote_workflow/remote_step.rb +19 -7
- data/lib/rbbt/workflow/remote_workflow.rb +6 -1
- data/lib/rbbt/workflow/step/run.rb +766 -766
- data/lib/rbbt/workflow/step/save_load_inputs.rb +254 -254
- data/lib/rbbt/workflow/step.rb +2 -362
- data/lib/rbbt/workflow/task.rb +118 -118
- data/lib/rbbt/workflow/usage.rb +289 -287
- data/lib/rbbt/workflow/util/archive.rb +6 -5
- data/lib/rbbt/workflow/util/data.rb +1 -1
- data/lib/rbbt/workflow/util/orchestrator.rb +249 -246
- data/lib/rbbt/workflow/util/trace.rb +79 -44
- data/lib/rbbt/workflow.rb +4 -882
- data/lib/rbbt-util.rb +21 -13
- data/lib/rbbt.rb +16 -3
- data/python/rbbt/__init__.py +19 -1
- data/share/Rlib/plot.R +37 -37
- data/share/Rlib/svg.R +22 -5
- data/share/install/software/lib/install_helpers +1 -1
- data/share/rbbt_commands/hpc/list +2 -3
- data/share/rbbt_commands/hpc/orchestrate +4 -4
- data/share/rbbt_commands/hpc/tail +2 -0
- data/share/rbbt_commands/hpc/task +10 -7
- data/share/rbbt_commands/lsf/list +2 -3
- data/share/rbbt_commands/lsf/orchestrate +4 -4
- data/share/rbbt_commands/lsf/tail +2 -0
- data/share/rbbt_commands/lsf/task +10 -7
- data/share/rbbt_commands/migrate +1 -1
- data/share/rbbt_commands/pbs/list +2 -3
- data/share/rbbt_commands/pbs/orchestrate +4 -4
- data/share/rbbt_commands/pbs/tail +2 -0
- data/share/rbbt_commands/pbs/task +10 -7
- data/share/rbbt_commands/resource/produce +8 -1
- data/share/rbbt_commands/slurm/list +2 -3
- data/share/rbbt_commands/slurm/orchestrate +4 -4
- data/share/rbbt_commands/slurm/tail +2 -0
- data/share/rbbt_commands/slurm/task +10 -7
- data/share/rbbt_commands/system/clean +5 -5
- data/share/rbbt_commands/system/status +5 -5
- data/share/rbbt_commands/tsv/get +2 -3
- data/share/rbbt_commands/tsv/info +10 -13
- data/share/rbbt_commands/tsv/keys +18 -14
- data/share/rbbt_commands/tsv/slice +2 -2
- data/share/rbbt_commands/tsv/transpose +6 -2
- data/share/rbbt_commands/workflow/info +20 -24
- data/share/rbbt_commands/workflow/list +1 -1
- data/share/rbbt_commands/workflow/prov +20 -13
- data/share/rbbt_commands/workflow/server +11 -1
- data/share/rbbt_commands/workflow/task +76 -71
- data/share/rbbt_commands/workflow/write_info +26 -9
- data/share/software/opt/ssw/ssw.c +861 -0
- data/share/software/opt/ssw/ssw.h +130 -0
- data/share/workflow_config.ru +3 -3
- metadata +40 -2
data/lib/rbbt-util.rb
CHANGED
@@ -1,18 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
4
|
-
Open.
|
1
|
+
require_relative 'rbbt'
|
2
|
+
require_relative 'rbbt/util/misc'
|
3
|
+
require 'scout/open'
|
4
|
+
Open.remote_cache_dir = Rbbt.var.cache["open-remote"].find :user
|
5
5
|
|
6
|
-
require '
|
7
|
-
Persist.cachedir = Rbbt.var.cache.persistence
|
6
|
+
require 'scout/path'
|
8
7
|
|
9
|
-
require '
|
10
|
-
|
8
|
+
require 'set'
|
9
|
+
require 'scout/persist'
|
11
10
|
|
12
|
-
require '
|
13
|
-
TmpFile.tmpdir = Rbbt.tmp.find :user
|
11
|
+
require 'scout/resource'
|
14
12
|
|
15
|
-
|
16
|
-
|
13
|
+
require_relative 'rbbt/util/filecache'
|
14
|
+
|
15
|
+
require_relative 'rbbt/util/tmpfile'
|
16
|
+
|
17
|
+
require_relative 'rbbt/util/cmd'
|
18
|
+
require_relative 'rbbt/tsv'
|
19
|
+
|
20
|
+
require_relative 'rbbt/workflow'
|
21
|
+
|
22
|
+
Persist.cache_dir = Rbbt.var.cache.persistence
|
23
|
+
FileCache.cachedir = Rbbt.var.cache.filecache.find :user
|
24
|
+
TmpFile.tmpdir = Rbbt.tmp.find :user
|
25
|
+
Resource.default_resource = Rbbt
|
17
26
|
|
18
|
-
require 'rbbt/util/config'
|
data/lib/rbbt.rb
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.unshift File.join(__dir__)
|
2
|
+
$LOAD_PATH.unshift File.join(__dir__, '../../lib')
|
3
|
+
|
4
|
+
require 'scout/path'
|
5
|
+
require 'scout/resource'
|
6
|
+
Path.add_path :rbbt_util, File.join(Path.caller_lib_dir(__FILE__), "{TOPLEVEL}/{SUBPATH}")
|
2
7
|
module Rbbt
|
3
8
|
extend Resource
|
4
|
-
|
9
|
+
|
10
|
+
self.pkgdir = 'rbbt'
|
5
11
|
end
|
12
|
+
Path.default_pkgdir = Rbbt
|
13
|
+
Resource.set_software_env Rbbt.software
|
14
|
+
|
15
|
+
require_relative 'rbbt/util/version'
|
16
|
+
require 'scout/log'
|
17
|
+
require_relative 'rbbt/refactor'
|
6
18
|
|
7
|
-
require '
|
19
|
+
require 'scout/config'
|
20
|
+
Rbbt::Config = Scout::Config
|
data/python/rbbt/__init__.py
CHANGED
@@ -3,7 +3,7 @@ import sys
|
|
3
3
|
import os
|
4
4
|
import subprocess
|
5
5
|
|
6
|
-
def
|
6
|
+
def cmd(cmd = None):
|
7
7
|
if cmd is None:
|
8
8
|
print("Rbbt")
|
9
9
|
else:
|
@@ -52,6 +52,15 @@ def log_tsv(tsv):
|
|
52
52
|
print(tsv)
|
53
53
|
print(tsv.keys())
|
54
54
|
|
55
|
+
def benchmark():
|
56
|
+
import time
|
57
|
+
tic: float = time.perf_counter()
|
58
|
+
try:
|
59
|
+
yield
|
60
|
+
finally:
|
61
|
+
toc: float = time.perf_counter()
|
62
|
+
print(f"Computation time = {1000*(toc - tic):.3f}ms")
|
63
|
+
|
55
64
|
def tsv_preamble(line, comment_char="#"):
|
56
65
|
import re
|
57
66
|
header = dict()
|
@@ -127,3 +136,12 @@ def tsv_pandas(filename, sep="\t", comment_char="#", index_col=0, **kwargs):
|
|
127
136
|
def tsv(*args, **kwargs):
|
128
137
|
return tsv_pandas(*args, **kwargs)
|
129
138
|
|
139
|
+
def save_tsv(filename, df, key=None):
|
140
|
+
if (key == None):
|
141
|
+
key = df.index.name
|
142
|
+
if (key == None):
|
143
|
+
key = "Key"
|
144
|
+
key = "#" + key
|
145
|
+
df.to_csv(filename, sep="\t", index_label=key)
|
146
|
+
|
147
|
+
|
data/share/Rlib/plot.R
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
rbbt.require('ggplot2')
|
2
2
|
|
3
|
-
geom_entity <- function (real.geom = NULL, mapping = NULL, data = NULL, stat = "identity",
|
4
|
-
position = "identity", ...) {
|
5
|
-
rg <- real.geom(mapping = mapping, data = data, stat = stat,
|
6
|
-
position = position, ...)
|
7
|
-
|
8
|
-
rg$geom <-
|
9
|
-
draw <- function(., data, ...) {
|
10
|
-
grobs <- list()
|
11
|
-
|
12
|
-
for (i in 1:nrow(data)) {
|
13
|
-
grob <- .super$draw(., data[i,], ...)
|
14
|
-
if (is.null(data$entity.type))
|
15
|
-
grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity)
|
16
|
-
else
|
17
|
-
grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity, `data-entity-type`=data[i,]$entity.type)
|
18
|
-
}
|
19
|
-
|
20
|
-
ggplot2:::ggname("geom_entity", gTree(children = do.call("gList", grobs)))
|
21
|
-
}
|
22
|
-
|
23
|
-
draw_groups <- function(., data, ...) {
|
24
|
-
grobs <- list()
|
25
|
-
|
26
|
-
for (i in 1:nrow(data)) {
|
27
|
-
grob <- .super$draw_groups(., data[i,], ...)
|
28
|
-
if (is.null(data$entity.type))
|
29
|
-
grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity)
|
30
|
-
else
|
31
|
-
grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity, `data-entity-type`=data[i,]$entity.type)
|
32
|
-
}
|
33
|
-
|
34
|
-
ggplot2:::ggname("geom_entity", gTree(children = do.call("gList", grobs)))
|
35
|
-
}
|
36
|
-
})
|
37
|
-
|
38
|
-
rg
|
39
|
-
}
|
3
|
+
#geom_entity <- function (real.geom = NULL, mapping = NULL, data = NULL, stat = "identity",
|
4
|
+
# position = "identity", ...) {
|
5
|
+
# rg <- real.geom(mapping = mapping, data = data, stat = stat,
|
6
|
+
# position = position, ...)
|
7
|
+
#
|
8
|
+
# rg$geom <- ggproto(rg$geom, {
|
9
|
+
# draw <- function(., data, ...) {
|
10
|
+
# grobs <- list()
|
11
|
+
#
|
12
|
+
# for (i in 1:nrow(data)) {
|
13
|
+
# grob <- .super$draw(., data[i,], ...)
|
14
|
+
# if (is.null(data$entity.type))
|
15
|
+
# grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity)
|
16
|
+
# else
|
17
|
+
# grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity, `data-entity-type`=data[i,]$entity.type)
|
18
|
+
# }
|
19
|
+
#
|
20
|
+
# ggplot2:::ggname("geom_entity", gTree(children = do.call("gList", grobs)))
|
21
|
+
# }
|
22
|
+
#
|
23
|
+
# draw_groups <- function(., data, ...) {
|
24
|
+
# grobs <- list()
|
25
|
+
#
|
26
|
+
# for (i in 1:nrow(data)) {
|
27
|
+
# grob <- .super$draw_groups(., data[i,], ...)
|
28
|
+
# if (is.null(data$entity.type))
|
29
|
+
# grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity)
|
30
|
+
# else
|
31
|
+
# grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity, `data-entity-type`=data[i,]$entity.type)
|
32
|
+
# }
|
33
|
+
#
|
34
|
+
# ggplot2:::ggname("geom_entity", gTree(children = do.call("gList", grobs)))
|
35
|
+
# }
|
36
|
+
# })
|
37
|
+
#
|
38
|
+
# rg
|
39
|
+
#}
|
40
40
|
|
41
41
|
rbbt.ggplot2.rotate_x_labels <- function(){ theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1)) }
|
42
42
|
|
data/share/Rlib/svg.R
CHANGED
@@ -9,12 +9,17 @@ rbbt.require('Cairo')
|
|
9
9
|
|
10
10
|
# Modified from http://aaronecay.com/blog/2014/02/tooltips-in-ggplot/
|
11
11
|
|
12
|
-
rbbt.SVG.extract <- function(plot, size=NULL, prefix=NULL, ...){
|
12
|
+
rbbt.SVG.extract <- function(plot, size=NULL, prefix=NULL, entity.geom='geom_point', data=NULL, ...){
|
13
|
+
|
14
|
+
if (is.null(data)) data = plot$data;
|
13
15
|
|
14
16
|
if (is.null(prefix)) prefix = rbbt.random_string();
|
17
|
+
|
18
|
+
if (!endsWith(prefix, '.'))
|
19
|
+
prefix = paste(prefix, ".", sep="")
|
20
|
+
|
15
21
|
if (is.null(size)){
|
16
22
|
print(plot, type='cairo');
|
17
|
-
mysvg <- grid.export(prefix=prefix, ...)
|
18
23
|
}else{
|
19
24
|
base.size = 10 * (7/size)
|
20
25
|
resolution = 72 * (size/7)
|
@@ -25,11 +30,23 @@ rbbt.SVG.extract <- function(plot, size=NULL, prefix=NULL, ...){
|
|
25
30
|
|
26
31
|
if (is.null(plot$theme$text$size))
|
27
32
|
plot$theme$text$size = base.size
|
28
|
-
|
29
|
-
print(plot, type='cairo')
|
30
|
-
mysvg <- grid.export(res=resolution, prefix=prefix, ...)
|
33
|
+
print(plot, type='cairo');
|
31
34
|
}
|
32
35
|
|
36
|
+
grid.force()
|
37
|
+
|
38
|
+
if (!is.null(data[["Entity"]]))
|
39
|
+
grid.garnish(entity.geom, 'data-entity'= data[["Entity"]], group = FALSE, grep = TRUE, redraw = TRUE)
|
40
|
+
else
|
41
|
+
grid.garnish(entity.geom, 'data-entity'= rownames(data), group = FALSE, grep = TRUE, redraw = TRUE)
|
42
|
+
|
43
|
+
if (!is.null(data[["Entity type"]]))
|
44
|
+
grid.garnish(entity.geom, 'data-entity_type' = data[["Entity type"]], group = FALSE, grep = TRUE, redraw = TRUE)
|
45
|
+
else if (!is.null(attributes(data)$key.field))
|
46
|
+
grid.garnish(entity.geom, 'data-entity_type' = rep(attributes(data)$key.field, length(rownames(data))), group = FALSE, grep = TRUE, redraw = TRUE)
|
47
|
+
|
48
|
+
mysvg <- grid.export(prefix=prefix, strict = FALSE, ...)
|
49
|
+
|
33
50
|
xml <- saveXML(mysvg$svg)
|
34
51
|
xml
|
35
52
|
}
|
@@ -10,7 +10,7 @@ OPT_BUILD_DIR="$SOFTWARE_DIR/.build"; [ -d $OPT_BUILD_DIR ] || mkdir -p $OPT_BUI
|
|
10
10
|
|
11
11
|
mkdir -p "$OPT_BUILD_DIR"
|
12
12
|
|
13
|
-
if realpath --help | grep
|
13
|
+
if (command -v realpath && realpath --help | grep relative) > /dev/null; then
|
14
14
|
function relative_path(){
|
15
15
|
local basedir=$1
|
16
16
|
local path=$2
|
@@ -206,7 +206,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
206
206
|
require 'rbbt/workflow'
|
207
207
|
step_path = step_line.split(": ").last.strip
|
208
208
|
step = Step.new step_path
|
209
|
-
step.load_dependencies_from_info
|
210
209
|
has_bar = false
|
211
210
|
[step].reverse.each do |j|
|
212
211
|
next if j.done?
|
@@ -218,6 +217,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
218
217
|
prog_rep << [rep]
|
219
218
|
end
|
220
219
|
end
|
220
|
+
prog_rep = [Log.color(step.status, step.status)] if prog_rep.empty?
|
221
221
|
end
|
222
222
|
end
|
223
223
|
workflow, task, name = step_path.split("/")[-3..-1]
|
@@ -321,7 +321,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
321
321
|
if tail && File.exist?(File.join(dir, 'std.err'))
|
322
322
|
if exit_status && exit_status != 0
|
323
323
|
puts Log.color(:magenta, "First error or exception found: ")
|
324
|
-
puts CMD.cmd("grep -i
|
324
|
+
puts CMD.cmd("grep -i 'error\\|exception' #{File.join(dir, 'std.err')} -A #{tail.to_i} |head -n #{tail.to_i}", :no_fail => true).read
|
325
325
|
elsif exit_status
|
326
326
|
puts Log.color(:magenta, "Completed jobs: ")
|
327
327
|
puts CMD.cmd("grep -i -w 'Completed step' #{File.join(dir, 'std.err')} | grep -v 'Retrying dep.' | tail -n #{tail.to_i}", :no_fail => true).read
|
@@ -337,7 +337,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
337
337
|
require 'rbbt/workflow'
|
338
338
|
step_path = step_line.split(": ").last.strip
|
339
339
|
step = Step.new step_path
|
340
|
-
step.load_dependencies_from_info
|
341
340
|
has_bar = false
|
342
341
|
(step.rec_dependencies + [step]).reverse.each do |j|
|
343
342
|
next if j.done?
|
@@ -18,9 +18,9 @@ $slurm_options = SOPT.get <<EOF
|
|
18
18
|
-si--singularity_img* Singularity image to use
|
19
19
|
-sm--singularity_mounts* Singularity image to use
|
20
20
|
-ug--user_group* Use alternative user group for group project directory
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
--contain* Contain in directory (using Singularity)
|
22
|
+
--sync* Contain in directory and sync jobs
|
23
|
+
--exclusive Make exclusive use of the node
|
24
24
|
-hm--highmem Make use of highmem cores
|
25
25
|
-wc--wipe_container* Wipe the jobs from the contain directory
|
26
26
|
-pd--purge_deps Purge job dependencies
|
@@ -57,7 +57,7 @@ raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint
|
|
57
57
|
|
58
58
|
class Step
|
59
59
|
def join
|
60
|
-
HPC::BATCH_MODULE.wait_for_job(@batch_job_dir)
|
60
|
+
HPC::BATCH_MODULE.wait_for_job(@batch_job_dir) unless done?
|
61
61
|
end
|
62
62
|
|
63
63
|
def run(no_load = true)
|
@@ -9,7 +9,7 @@ require 'time'
|
|
9
9
|
|
10
10
|
rbbt_options = SOPT::GOT_OPTIONS
|
11
11
|
|
12
|
-
$
|
12
|
+
$batch_options = SOPT.get <<EOF
|
13
13
|
-dr--dry_run Print only the template
|
14
14
|
-cj--clean_job Clean job
|
15
15
|
--drbbt* Use development version of rbbt
|
@@ -17,9 +17,9 @@ $slurm_options = SOPT.get <<EOF
|
|
17
17
|
-si--singularity_img* Singularity image to use
|
18
18
|
-sm--singularity_mounts* Singularity image to use
|
19
19
|
-ug--user_group* Use alternative user group for group project directory
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
--contain* Contain in directory (using Singularity)
|
21
|
+
--sync* Contain in directory and sync jobs
|
22
|
+
--exclusive Make exclusive use of the node
|
23
23
|
-hm--highmem Make use of highmem cores
|
24
24
|
-wc--wipe_container* Wipe the jobs from the contain directory
|
25
25
|
-pd--purge_deps Purge job dependencies
|
@@ -45,11 +45,14 @@ $slurm_options = SOPT.get <<EOF
|
|
45
45
|
-OR--orchestration_rules* Orchestration rules
|
46
46
|
EOF
|
47
47
|
|
48
|
-
batch_system = $
|
48
|
+
batch_system = $batch_options.delete :batch_system
|
49
49
|
batch_system ||= 'auto'
|
50
|
+
$batch_options[:log] = rbbt_options[:log]
|
51
|
+
$batch_options[:config_keys] = rbbt_options[:config_keys]
|
50
52
|
|
51
53
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
52
54
|
|
55
|
+
|
53
56
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
54
57
|
|
55
58
|
class Step
|
@@ -60,7 +63,7 @@ class Step
|
|
60
63
|
else
|
61
64
|
begin
|
62
65
|
Log.debug "Issuing BATCH job for #{self.path}"
|
63
|
-
HPC::BATCH_MODULE.run_job(self, $
|
66
|
+
HPC::BATCH_MODULE.run_job(self, $batch_options)
|
64
67
|
rescue HPC::BATCH_DRY_RUN
|
65
68
|
end
|
66
69
|
end
|
@@ -70,7 +73,7 @@ end
|
|
70
73
|
module RemoteStep::SSH
|
71
74
|
|
72
75
|
def _run
|
73
|
-
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $
|
76
|
+
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $batch_options)
|
74
77
|
end
|
75
78
|
|
76
79
|
end
|
@@ -206,7 +206,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
206
206
|
require 'rbbt/workflow'
|
207
207
|
step_path = step_line.split(": ").last.strip
|
208
208
|
step = Step.new step_path
|
209
|
-
step.load_dependencies_from_info
|
210
209
|
has_bar = false
|
211
210
|
[step].reverse.each do |j|
|
212
211
|
next if j.done?
|
@@ -218,6 +217,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
218
217
|
prog_rep << [rep]
|
219
218
|
end
|
220
219
|
end
|
220
|
+
prog_rep = [Log.color(step.status, step.status)] if prog_rep.empty?
|
221
221
|
end
|
222
222
|
end
|
223
223
|
workflow, task, name = step_path.split("/")[-3..-1]
|
@@ -321,7 +321,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
321
321
|
if tail && File.exist?(File.join(dir, 'std.err'))
|
322
322
|
if exit_status && exit_status != 0
|
323
323
|
puts Log.color(:magenta, "First error or exception found: ")
|
324
|
-
puts CMD.cmd("grep -i
|
324
|
+
puts CMD.cmd("grep -i 'error\\|exception' #{File.join(dir, 'std.err')} -A #{tail.to_i} |head -n #{tail.to_i}", :no_fail => true).read
|
325
325
|
elsif exit_status
|
326
326
|
puts Log.color(:magenta, "Completed jobs: ")
|
327
327
|
puts CMD.cmd("grep -i -w 'Completed step' #{File.join(dir, 'std.err')} | grep -v 'Retrying dep.' | tail -n #{tail.to_i}", :no_fail => true).read
|
@@ -337,7 +337,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
337
337
|
require 'rbbt/workflow'
|
338
338
|
step_path = step_line.split(": ").last.strip
|
339
339
|
step = Step.new step_path
|
340
|
-
step.load_dependencies_from_info
|
341
340
|
has_bar = false
|
342
341
|
(step.rec_dependencies + [step]).reverse.each do |j|
|
343
342
|
next if j.done?
|
@@ -18,9 +18,9 @@ $slurm_options = SOPT.get <<EOF
|
|
18
18
|
-si--singularity_img* Singularity image to use
|
19
19
|
-sm--singularity_mounts* Singularity image to use
|
20
20
|
-ug--user_group* Use alternative user group for group project directory
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
--contain* Contain in directory (using Singularity)
|
22
|
+
--sync* Contain in directory and sync jobs
|
23
|
+
--exclusive Make exclusive use of the node
|
24
24
|
-hm--highmem Make use of highmem cores
|
25
25
|
-wc--wipe_container* Wipe the jobs from the contain directory
|
26
26
|
-pd--purge_deps Purge job dependencies
|
@@ -57,7 +57,7 @@ raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint
|
|
57
57
|
|
58
58
|
class Step
|
59
59
|
def join
|
60
|
-
HPC::BATCH_MODULE.wait_for_job(@batch_job_dir)
|
60
|
+
HPC::BATCH_MODULE.wait_for_job(@batch_job_dir) unless done?
|
61
61
|
end
|
62
62
|
|
63
63
|
def run(no_load = true)
|
@@ -9,7 +9,7 @@ require 'time'
|
|
9
9
|
|
10
10
|
rbbt_options = SOPT::GOT_OPTIONS
|
11
11
|
|
12
|
-
$
|
12
|
+
$batch_options = SOPT.get <<EOF
|
13
13
|
-dr--dry_run Print only the template
|
14
14
|
-cj--clean_job Clean job
|
15
15
|
--drbbt* Use development version of rbbt
|
@@ -17,9 +17,9 @@ $slurm_options = SOPT.get <<EOF
|
|
17
17
|
-si--singularity_img* Singularity image to use
|
18
18
|
-sm--singularity_mounts* Singularity image to use
|
19
19
|
-ug--user_group* Use alternative user group for group project directory
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
--contain* Contain in directory (using Singularity)
|
21
|
+
--sync* Contain in directory and sync jobs
|
22
|
+
--exclusive Make exclusive use of the node
|
23
23
|
-hm--highmem Make use of highmem cores
|
24
24
|
-wc--wipe_container* Wipe the jobs from the contain directory
|
25
25
|
-pd--purge_deps Purge job dependencies
|
@@ -45,11 +45,14 @@ $slurm_options = SOPT.get <<EOF
|
|
45
45
|
-OR--orchestration_rules* Orchestration rules
|
46
46
|
EOF
|
47
47
|
|
48
|
-
batch_system = $
|
48
|
+
batch_system = $batch_options.delete :batch_system
|
49
49
|
batch_system ||= 'auto'
|
50
|
+
$batch_options[:log] = rbbt_options[:log]
|
51
|
+
$batch_options[:config_keys] = rbbt_options[:config_keys]
|
50
52
|
|
51
53
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
52
54
|
|
55
|
+
|
53
56
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
54
57
|
|
55
58
|
class Step
|
@@ -60,7 +63,7 @@ class Step
|
|
60
63
|
else
|
61
64
|
begin
|
62
65
|
Log.debug "Issuing BATCH job for #{self.path}"
|
63
|
-
HPC::BATCH_MODULE.run_job(self, $
|
66
|
+
HPC::BATCH_MODULE.run_job(self, $batch_options)
|
64
67
|
rescue HPC::BATCH_DRY_RUN
|
65
68
|
end
|
66
69
|
end
|
@@ -70,7 +73,7 @@ end
|
|
70
73
|
module RemoteStep::SSH
|
71
74
|
|
72
75
|
def _run
|
73
|
-
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $
|
76
|
+
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $batch_options)
|
74
77
|
end
|
75
78
|
|
76
79
|
end
|
data/share/rbbt_commands/migrate
CHANGED
@@ -206,7 +206,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
206
206
|
require 'rbbt/workflow'
|
207
207
|
step_path = step_line.split(": ").last.strip
|
208
208
|
step = Step.new step_path
|
209
|
-
step.load_dependencies_from_info
|
210
209
|
has_bar = false
|
211
210
|
[step].reverse.each do |j|
|
212
211
|
next if j.done?
|
@@ -218,6 +217,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
218
217
|
prog_rep << [rep]
|
219
218
|
end
|
220
219
|
end
|
220
|
+
prog_rep = [Log.color(step.status, step.status)] if prog_rep.empty?
|
221
221
|
end
|
222
222
|
end
|
223
223
|
workflow, task, name = step_path.split("/")[-3..-1]
|
@@ -321,7 +321,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
321
321
|
if tail && File.exist?(File.join(dir, 'std.err'))
|
322
322
|
if exit_status && exit_status != 0
|
323
323
|
puts Log.color(:magenta, "First error or exception found: ")
|
324
|
-
puts CMD.cmd("grep -i
|
324
|
+
puts CMD.cmd("grep -i 'error\\|exception' #{File.join(dir, 'std.err')} -A #{tail.to_i} |head -n #{tail.to_i}", :no_fail => true).read
|
325
325
|
elsif exit_status
|
326
326
|
puts Log.color(:magenta, "Completed jobs: ")
|
327
327
|
puts CMD.cmd("grep -i -w 'Completed step' #{File.join(dir, 'std.err')} | grep -v 'Retrying dep.' | tail -n #{tail.to_i}", :no_fail => true).read
|
@@ -337,7 +337,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
337
337
|
require 'rbbt/workflow'
|
338
338
|
step_path = step_line.split(": ").last.strip
|
339
339
|
step = Step.new step_path
|
340
|
-
step.load_dependencies_from_info
|
341
340
|
has_bar = false
|
342
341
|
(step.rec_dependencies + [step]).reverse.each do |j|
|
343
342
|
next if j.done?
|
@@ -18,9 +18,9 @@ $slurm_options = SOPT.get <<EOF
|
|
18
18
|
-si--singularity_img* Singularity image to use
|
19
19
|
-sm--singularity_mounts* Singularity image to use
|
20
20
|
-ug--user_group* Use alternative user group for group project directory
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
--contain* Contain in directory (using Singularity)
|
22
|
+
--sync* Contain in directory and sync jobs
|
23
|
+
--exclusive Make exclusive use of the node
|
24
24
|
-hm--highmem Make use of highmem cores
|
25
25
|
-wc--wipe_container* Wipe the jobs from the contain directory
|
26
26
|
-pd--purge_deps Purge job dependencies
|
@@ -57,7 +57,7 @@ raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint
|
|
57
57
|
|
58
58
|
class Step
|
59
59
|
def join
|
60
|
-
HPC::BATCH_MODULE.wait_for_job(@batch_job_dir)
|
60
|
+
HPC::BATCH_MODULE.wait_for_job(@batch_job_dir) unless done?
|
61
61
|
end
|
62
62
|
|
63
63
|
def run(no_load = true)
|
@@ -9,7 +9,7 @@ require 'time'
|
|
9
9
|
|
10
10
|
rbbt_options = SOPT::GOT_OPTIONS
|
11
11
|
|
12
|
-
$
|
12
|
+
$batch_options = SOPT.get <<EOF
|
13
13
|
-dr--dry_run Print only the template
|
14
14
|
-cj--clean_job Clean job
|
15
15
|
--drbbt* Use development version of rbbt
|
@@ -17,9 +17,9 @@ $slurm_options = SOPT.get <<EOF
|
|
17
17
|
-si--singularity_img* Singularity image to use
|
18
18
|
-sm--singularity_mounts* Singularity image to use
|
19
19
|
-ug--user_group* Use alternative user group for group project directory
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
--contain* Contain in directory (using Singularity)
|
21
|
+
--sync* Contain in directory and sync jobs
|
22
|
+
--exclusive Make exclusive use of the node
|
23
23
|
-hm--highmem Make use of highmem cores
|
24
24
|
-wc--wipe_container* Wipe the jobs from the contain directory
|
25
25
|
-pd--purge_deps Purge job dependencies
|
@@ -45,11 +45,14 @@ $slurm_options = SOPT.get <<EOF
|
|
45
45
|
-OR--orchestration_rules* Orchestration rules
|
46
46
|
EOF
|
47
47
|
|
48
|
-
batch_system = $
|
48
|
+
batch_system = $batch_options.delete :batch_system
|
49
49
|
batch_system ||= 'auto'
|
50
|
+
$batch_options[:log] = rbbt_options[:log]
|
51
|
+
$batch_options[:config_keys] = rbbt_options[:config_keys]
|
50
52
|
|
51
53
|
HPC::BATCH_MODULE = HPC.batch_system batch_system
|
52
54
|
|
55
|
+
|
53
56
|
raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?
|
54
57
|
|
55
58
|
class Step
|
@@ -60,7 +63,7 @@ class Step
|
|
60
63
|
else
|
61
64
|
begin
|
62
65
|
Log.debug "Issuing BATCH job for #{self.path}"
|
63
|
-
HPC::BATCH_MODULE.run_job(self, $
|
66
|
+
HPC::BATCH_MODULE.run_job(self, $batch_options)
|
64
67
|
rescue HPC::BATCH_DRY_RUN
|
65
68
|
end
|
66
69
|
end
|
@@ -70,7 +73,7 @@ end
|
|
70
73
|
module RemoteStep::SSH
|
71
74
|
|
72
75
|
def _run
|
73
|
-
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $
|
76
|
+
RemoteWorkflow::SSH.run_slurm_job(File.join(base_url, task.to_s), @input_id, @base_name, $batch_options)
|
74
77
|
end
|
75
78
|
|
76
79
|
end
|
@@ -206,7 +206,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
206
206
|
require 'rbbt/workflow'
|
207
207
|
step_path = step_line.split(": ").last.strip
|
208
208
|
step = Step.new step_path
|
209
|
-
step.load_dependencies_from_info
|
210
209
|
has_bar = false
|
211
210
|
[step].reverse.each do |j|
|
212
211
|
next if j.done?
|
@@ -218,6 +217,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
218
217
|
prog_rep << [rep]
|
219
218
|
end
|
220
219
|
end
|
220
|
+
prog_rep = [Log.color(step.status, step.status)] if prog_rep.empty?
|
221
221
|
end
|
222
222
|
end
|
223
223
|
workflow, task, name = step_path.split("/")[-3..-1]
|
@@ -321,7 +321,7 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
321
321
|
if tail && File.exist?(File.join(dir, 'std.err'))
|
322
322
|
if exit_status && exit_status != 0
|
323
323
|
puts Log.color(:magenta, "First error or exception found: ")
|
324
|
-
puts CMD.cmd("grep -i
|
324
|
+
puts CMD.cmd("grep -i 'error\\|exception' #{File.join(dir, 'std.err')} -A #{tail.to_i} |head -n #{tail.to_i}", :no_fail => true).read
|
325
325
|
elsif exit_status
|
326
326
|
puts Log.color(:magenta, "Completed jobs: ")
|
327
327
|
puts CMD.cmd("grep -i -w 'Completed step' #{File.join(dir, 'std.err')} | grep -v 'Retrying dep.' | tail -n #{tail.to_i}", :no_fail => true).read
|
@@ -337,7 +337,6 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
|
|
337
337
|
require 'rbbt/workflow'
|
338
338
|
step_path = step_line.split(": ").last.strip
|
339
339
|
step = Step.new step_path
|
340
|
-
step.load_dependencies_from_info
|
341
340
|
has_bar = false
|
342
341
|
(step.rec_dependencies + [step]).reverse.each do |j|
|
343
342
|
next if j.done?
|