Is there a way to have run commands run one after the other under a single srun? Additionally, can this be done without srunning a seperate file that has all the commands ?
Normally we would do :
srun python ./python_code.py
But I want :
srun python ./python_code1.py & python ./python_code2.py
Is this possible, or will it end up doing srun python ./python_code1.py, then python ./python_code2.py ?
Alternatively, I can have a file that contains my list of executables, like this :
launch.sh:
python ./python_code_1.py
python ./python_code_2.py
which I would then call using srun launch.sh.
But I want to do this all from a single file, if possible.
Thank,
Liam
A line such as
will start
python ./python_code1.pythroughsrunand send that process to the background, and immediately startpython ./python_code2.py.As
srunis expecting an executable, you cannot directly list multiple commands as arguments. But it will forward the arguments of the command so you can use an intermediate invocation ofbashas suggested by @KamilKuk:The alternative you mention with
launch.shwill work providedlaunch.shis executable, i.e. has the executable permission and has a proper Shebang.