Make batch.id robust to warning messages from sbatch #314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into a crazy bug today:
getJobStatus
gave mebatch.id = "that"
. It turns out that when I requested a large amount of memory,sbatch
returned this um, helpful message:clusterFunctionsSlurm
was pulling the 4th word of the first line, which should have been the Slurm jobid, but instead was "that". It wanted, of course, the last line.This really isn't a bug in
batchtools
, as the sysops inserted an informational message in a crazy place. But I suspect if the smart, on the ball people at the UMass Unity cluster are doing this, others probably are too. It'd be nice forbatchtools
to be robust to such shenanigans. Alternatively, I suppose it could throw an error if batch.id is non-numeric and print the message fromsbatch
.My suggested change looks for a line beginning with "Submitted batch job" and pulls the 4th word as the
batch.id
.I've tested this change against the following:
as well as against real-life
submitJobs
calls, both with and without the informational message.