How to run a SLURM job within Python interactively

When a SLURM job is started interactively and needs to wait until completion so that we know if the job was executed sucessfully or not. Example use: start a test interactively and report the error code of the job once executed from SLURM and use it to report the test status in a CI pipeline .

from subprocess import call
call (["srun", '--mem-per-cpu=500', '--time=00:10', '--ntasks=1', '-o', 'blockMesh.log', "blockMesh"])

See also