Skip to content

Commit

Permalink
πŸ‘Œ IMPROVE: CTRL-C on running process (#4771)
Browse files Browse the repository at this point in the history
Do not call `kill` on a process that is already being killed.
Also log a different message,
so that the user can see that the original CTRL-C was actioned.
  • Loading branch information
chrisjsewell authored Feb 23, 2021
1 parent 889b50f commit da872b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions aiida/engine/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ def _run(self, process: TYPE_RUN_PROCESS, *args: Any, **inputs: Any) -> Tuple[Di

def kill_process(_num, _frame):
"""Send the kill signal to the process in the current scope."""
if process_inited.is_killing:
LOGGER.warning('runner received interrupt, process %s already being killed', process_inited.pid)
return
LOGGER.critical('runner received interrupt, killing process %s', process_inited.pid)
process_inited.kill(msg='Process was killed because the runner received an interrupt')

Expand Down

0 comments on commit da872b2

Please sign in to comment.