## Copied from https://github.com/mllg/batchtools/blob/master/inst/templates/lsf-simple.tmpl
#BSUB-j <%= job.name %>                             # Name of the job
#BSUB-o <%= log.file %>                             # Log file

<%= if (!is.null(resources$queue)) { %>
#BSUB-q <%= resources$queue %>                      # Job queue
<%= } %>

<%= if (!is.null(resources$walltime)) { %>
#BSUB-W <%= round(resources$walltime / 60, 1) %>    # Walltime (LSF requires minutes, batchtools uses seconds)
<%= } %>

<%= if (!is.null(resources$memory)) { %>
#BSUB-M <%= resources$memory %>                     # Memory requirements in KBytes; depends on setting LSF_UNIT_FOR_LIMITS in lsf.conf
<%= } %>

## Export value of DEBUGME environemnt var to worker
export DEBUGME=<%= Sys.getenv("DEBUGME") %>

<%= sprintf("export OMP_NUM_THREADS=%i", resources$omp.threads) -%>
<%= sprintf("export OPENBLAS_NUM_THREADS=%i", resources$blas.threads) -%>
<%= sprintf("export MKL_NUM_THREADS=%i", resources$blas.threads) -%>

Rscript -e 'batchtools::doJobCollection("<%= uri %>")'
