mllg / batchtools

Tools for computation on batch systems
https://mllg.github.io/batchtools/
GNU Lesser General Public License v3.0
172 stars 51 forks source link

clusterFunctionsSlurm.R returns incorrect "batch.id" #243

Open Suppanut opened 5 years ago

Suppanut commented 5 years ago

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"
michaelmayer2 commented 5 years ago

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.