You could also choose to propagate the signal to the child process of
test.slurm yourself:
#!/bin/bash
#SBATCH --job-name=test
#SBATCH --ntasks-per-node=1
#SBATCH --nodes=1
#SBATCH --time=00:03:00
#SBATCH --signal=B:SIGINT@30
# This example works, but I need it to work without "B:" in --signal
Jean-mathieu CHANTREIN writes:
> But that is not enough, it is also necessary to use srun in
> test.slurm, because the signals are sent to the child processes only
> if they are also children in the JOB sense.
Good to know!
--
Cheers,
Bjørn-Helge Mevik, dr. scient,
Department for Research
- Mail original -
> De: "b h mevik"
> À: "slurm-users"
> Envoyé: Mardi 21 Avril 2020 10:29:32
> Objet: Re: [slurm-users] How to trap a SIGINT signal in a child process of a
> batch ?
> Jean-mathieu CHANTREIN writes:
>
>> test.sh:
>>
>> #!/bin/bash
>>
>> function sig_handler()
>> {
Jean-mathieu CHANTREIN writes:
> test.sh:
>
> #!/bin/bash
>
> function sig_handler()
> {
> echo "Executable interrupted"
> exit 2
> }
>
> trap 'sig_handler' SIGINT
>
> echo "BEGIN"
> sleep 200
> echo "END"
Note that bash does not interrupt any running command (except "wait")
when it
Hello,
I'm using slurm version 19.05.2 on debian 10.
I'm try to hand a SIGINT signal by a child process of a batch.
The signal is automatically send 30 s before the end of time.
You can see this mechanism in this minimal example:
---
test.slurm: