File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
egs/wsj/s5/utils/parallel Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 7272my $jobend ;
7373
7474my $array_job = 0;
75+ my $sge_job_id ;
7576
7677sub print_usage () {
7778 print STDERR
@@ -101,6 +102,14 @@ sub exec_command {
101102 # To get the actual exit value, shift right by eight bits.
102103 ($_ = ` $command 2>&1` , $? >> 8);
103104}
105+ sub caught_signal {
106+ if ( defined $sge_job_id ) { # Signal trapped after submitting jobs
107+ my $signal = $! ;
108+ system (" scancel $sge_job_id " );
109+ print STDERR " Caught a signal: $signal , deleting SLURM task: $sge_job_id and exiting\n " ;
110+ exit (2);
111+ }
112+ }
104113
105114if (@ARGV < 2) {
106115 print_usage();
@@ -194,6 +203,8 @@ sub exec_command {
194203# A more detailed description of the ways the options would be handled is at
195204# the top of this file.
196205
206+ $SIG {INT } = \&caught_signal;
207+ $SIG {TERM } = \&caught_signal;
197208my $opened_config_file = 1;
198209
199210open CONFIG, " <$config " or $opened_config_file = 0;
@@ -434,7 +445,6 @@ sub exec_command {
434445 exit (1);
435446}
436447
437- my $sge_job_id ;
438448if (! $sync ) { # We're not submitting with -sync y, so we
439449 # need to wait for the jobs to finish. We wait for the
440450 # sync-files we "touched" in the script to exist.
You can’t perform that action at this time.
0 commit comments