Skip to content

Commit 22be2a4

Browse files
committed
Properly treat forceful termination due to signals
1 parent 50d601c commit 22be2a4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

reframe/frontend/executors/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,13 @@ def on_task_success(self, task):
591591
'''Called when a regression test has succeeded.'''
592592

593593

594-
def _handle_sigterm(signum, frame):
595-
raise ForceExitError('received TERM signal')
594+
def _force_exit(signum, frame):
595+
# ReFrame will exit, ignore all other signals that cause a graceful
596+
# termination
597+
signal.signal(signal.SIGINT, signal.SIG_IGN)
598+
signal.signal(signal.SIGHUP, signal.SIG_IGN)
599+
signal.signal(signal.SIGTERM, signal.SIG_IGN)
600+
raise ForceExitError(f'received signal {signum}')
596601

597602

598603
class Runner:
@@ -620,7 +625,8 @@ def __init__(self, policy, printer=None, max_retries=0,
620625
self._policy.printer = self._printer
621626
self._policy.max_failures = max_failures
622627

623-
signal.signal(signal.SIGTERM, _handle_sigterm)
628+
signal.signal(signal.SIGHUP, _force_exit)
629+
signal.signal(signal.SIGTERM, _force_exit)
624630

625631
@property
626632
def max_failures(self):

0 commit comments

Comments
 (0)