I have a code that is usually run under SLURM. Something like
if ! lengthy_command
then
echo "Error occured"
fi
For accounting purposes, I would like to move to a srun based launch of the command:
if ! srun <srun params> lengthy_command
then
echo "Error occured"
fi
But after changing that line, the script will no longer run in an interactive session (outside SLURM). Is there any way to generalize the script so it can run under both conditions? I cannot see anything in the srun documentation that points in that direction.