Skip to content

Built-in templates: Add support for running 'Rscript' in a Linux container, etc. #99

@HenrikBengtsson

Description

@HenrikBengtsson

Wish

Add support for launching Rscript via a Linux container, e.g.

## Call batchtools inside container
module load apptainer/latest
export APPTAINER_BINDPATH="/run/munge,/var/run/munge,/etc/slurm,/var/spool/slurm/slurmd/conf-cache/slurm.conf,$APPTAINER_BINDPATH"

apptainer exec /modules/admin-resources/ood-dev/unity-r_4.4.0.sif Rscript --no-restore --quiet --no-save -e 'batchtools::doJobCollection("<%= uri %>")'

Source: mlr-org/batchtools#314 (comment)

Idea

  • Add support for specifying how Rscript is launched, e.g.
plan(batchtools_slurm, resources = list(rscript = c("/modules/admin-resources/ood-dev/unity-r_4.4.0.sif", '--bind="/run/munge,/var/run/munge,/etc/slurm,/var/spool/slurm/slurmd/conf-cache/slurm.conf,$APPTAINER_BINDPATH"', "Rscript", "--no-restore", "--quiet", "--no-save"))

This would then become the following in the rendered job script:

/modules/admin-resources/ood-dev/unity-r_4.4.0.sif --bind="/run/munge,/var/run/munge,/etc/slurm,/var/spool/slurm/slurmd/conf-cache/slurm.conf,$APPTAINER_BINDPATH" Rscript -e 'batchtools::doJobCollection("<%= uri %>")'
plan(batchtools_slurm, resources = list(rscript_args = c("--no-restore", "--quiet", "--no-save"))

This would then become the following in the rendered job script:

Rscript --no-restore --quiet --no-save -e 'batchtools::doJobCollection("<%= uri %>")'
  • Add support for setting environment variables, e.g.
plan(batchtools_slurm, resources = list(rscript = c("/modules/admin-resources/ood-dev/unity-r_4.4.0.sif", "Rscript"), envs = c(APPTAINER_BINDPATH = "/run/munge,/var/run/munge,/etc/slurm,/var/spool/slurm/slurmd/conf-cache/slurm.conf,$APPTAINER_BINDPATH"))
export APPTAINER_BINDPATH="/run/munge,/var/run/munge,/etc/slurm,/var/spool/slurm/slurmd/conf-cache/slurm.conf,$APPTAINER_BINDPATH"

/modules/admin-resources/ood-dev/unity-r_4.4.0.sif Rscript -e 'batchtools::doJobCollection("<%= uri %>")'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions