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 72
72
my $jobend ;
73
73
74
74
my $array_job = 0;
75
+ my $sge_job_id ;
75
76
76
77
sub print_usage () {
77
78
print STDERR
@@ -101,6 +102,14 @@ sub exec_command {
101
102
# To get the actual exit value, shift right by eight bits.
102
103
($_ = ` $command 2>&1` , $? >> 8);
103
104
}
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
+ }
104
113
105
114
if (@ARGV < 2) {
106
115
print_usage();
@@ -194,6 +203,8 @@ sub exec_command {
194
203
# A more detailed description of the ways the options would be handled is at
195
204
# the top of this file.
196
205
206
+ $SIG {INT } = \&caught_signal;
207
+ $SIG {TERM } = \&caught_signal;
197
208
my $opened_config_file = 1;
198
209
199
210
open CONFIG, " <$config " or $opened_config_file = 0;
@@ -434,7 +445,6 @@ sub exec_command {
434
445
exit (1);
435
446
}
436
447
437
- my $sge_job_id ;
438
448
if (! $sync ) { # We're not submitting with -sync y, so we
439
449
# need to wait for the jobs to finish. We wait for the
440
450
# sync-files we "touched" in the script to exist.
You can’t perform that action at this time.
0 commit comments