mllg / batchtools

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

Trouble with LSF support #244

Open michaelmayer2 opened 4 years ago

michaelmayer2 commented 4 years ago

We just released some new changes to LSF 10.1 on our cluster. As a result we now provide some default values for all resources (number of cores, amount of memory, elapsed time). In case users do not specify any of that we have an esub script that spits out some messages when bsub is run saying that default values are going to be used.

This behavior effectively breaks batchtools as it no longer can identify the LSF job IDs. I produced a patch (see below) that fixes the issue. Basically it no longer scans for the first number, it scans for the first number that is wrapped around <> signs.

Happy to discover further.

Michael.

PS: I really love batchtools and i see it being used quite a lot in my local environment.

index 155596a..c810ac1 100644
--- a/R/clusterFunctionsLSF.R
+++ b/R/clusterFunctionsLSF.R
@@ -43,7 +43,8 @@ makeClusterFunctionsLSF = function(template = "lsf", scheduler
     if (res$exit.code > 0L) {
       cfHandleUnknownSubmitError("bsub", res$exit.code, res$output)
     } else {
-      batch.id = stri_extract_first_regex(stri_flatten(res$output, " "), "\\d+"
+      tmpstr = stri_extract_first_regex(stri_flatten(res$output, " "), "<\\d+>"
+      batch.id=stri_sub(tmpstr,2,stri_length(tmpstr)-1)
       makeSubmitJobResult(status = 0L, batch.id = batch.id)
     }
   }