Skip to content

Commit

Permalink
Have job_dispatch.py safely terminate child processes on exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Sep 24, 2024
1 parent 6587920 commit 07228b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/_ert/forward_model_runner/job_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ def sigterm_handler(_signo, _stack_frame):
def main():
os.nice(19)
signal.signal(signal.SIGTERM, sigterm_handler)
job_runner_main(sys.argv)
try:
job_runner_main(sys.argv)
except Exception as e:
pgid = os.getpgid(os.getpid())
os.killpg(pgid, signal.SIGTERM)
raise e


if __name__ == "__main__":
Expand Down

0 comments on commit 07228b8

Please sign in to comment.