Skip to content

How to submit commands that rely on a personal Conda environment

When a job starts up on an OOD compute node it does not inherit the environment that you had when it was submitted. Modules are ordinarily re-loaded, so if the software is configured using a module then it should still work when submitted (you could write your own modules if you wish - see https://lmod.readthedocs.io/en/latest/015_writing_modules.html).

If your command is installed into a Conda environment not configured by a module then the cluster node will not know where to find it. You can either specify the full path to the script (typically <path of environment>/bin/<scriptname>) or you can create a wrapper script and submit this script to fsl_sub. A basic (generic) wrapper follows:

#!/bin/bash
# Enable Conda
eval "$(conda shell.bash hook)"
# Activate your environment
conda activate <name or pathtoenvironment>
"$@"

Make this executable:

chmod +x <name of script>

and then you can use it to run commands:

fsl_sub -R 1 -T 1 ./conda_wrapper.sh mypython_command option1 option2

To run mypython_command option1 option2 option2.