batchtools icon indicating copy to clipboard operation
batchtools copied to clipboard

clusterFunctionsSlurm.R returns incorrect "batch.id"

Open Suppanut opened this issue 6 years ago • 1 comments

On a cluster that I'm using, sbatch prints multiple outputs. So, e.g., reg$status$batch.id always returns incorrect batch.id which further causes some difficulties (e.g., cannot distinguish running jobs and expired jobs).

To illustrate my issue, please see below my simple syntax taken from clusterFunctionsSlurm.R.

res = runOSCommand("sbatch", "~/test.slurm")
# > res
# $sys.cmd
# [1] "sbatch"

# $sys.args
# [1] "~/test.slurm"

# $exit.code
# [1] 0

# $output
# [1] "sbatch: This job will be charged to the account \"liu\". Base Allocation:500,000.00 hours, Current Balance:497,218.77 hours (99% remaining)"
# [2] "Submitted batch job 1556425"

output = stri_flatten(stri_trim_both(res$output), "\n")
# > output
# [1] "sbatch: This job will be charged to the account \"liu\". Base Allocation:500,000.00 hours, Current Balance:497,218.77 hours (99% remaining)\nSubmitted batch job 1556425"

id = stri_split_fixed(output[1L], " ")[[1L]][4L]
# > id
# [1] "will"

Suppanut avatar Sep 07 '19 17:09 Suppanut

Funny to read that - this seems to be the same root cause as #244 - batchtools not allowing anything else other than a single line being returned from the sbatch / bsub command.

While in this case the accounting information are in the way - in #244 it is some information about default resource values being used.

michaelmayer2 avatar Sep 10 '19 13:09 michaelmayer2