`srun` drop-in replacement
问题 I'm trying to create a function that serves as a drop-in replacement for the SLURM's srun command. The need for this wrapper function is that I want to codify a script using srun when being started under SLURM control, but still being able to run the script without SLURM. So far, I have this function: srun_wrap() { if [ -z "$SLURM_JOB_ID" ] then # Not running under SLURM so start the code without srun "${@:2}" else # A SLURM job ID found, so use srun srun ${@:1:1} "${@:2}" fi } This allows me