How to hold up a script until a slurm job (start with srun) is completely finished?

前端 未结 3 1503
我在风中等你
我在风中等你 2020-12-11 20:36

I am running a job array with SLURM, with the following job array script (that I run with sbatch job_array_script.sh [args]:

#!/bin/bash

#SBATC         


        
3条回答
  •  萌比男神i
    2020-12-11 21:36

    You can use --wait option in sbatch in combination with wait in bash to send jobs off to the cluster, pause script execution until those are complete, and then continue. E.g.

    #!/bin/bash
    set -e
    date
    
    for((i=0; i<5; i++)); do
        sbatch -W --wrap='echo "hello from $SLURM_ARRAY_TASK_ID eat $VAR"; sleep 10' &
    done;
    wait
    
    date
    echo "I am finished"
    

提交回复
热议问题