Skip to content

Commit

Permalink
Remove listen_to_children function
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvanrun committed Aug 12, 2024
1 parent e37a835 commit 5baa601
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import random
from statistics import mean
from pathlib import Path
from pprint import pformat, pprint
from helpers import run_prediction_processing, listen_to_children_errors
from helpers import run_prediction_processing

INPUT_DIRECTORY = Path("/input")
OUTPUT_DIRECTORY = Path("/output")
Expand All @@ -42,9 +42,6 @@ def process(job):
report += pformat(job)
report += "\n"

# Before we start, ensure we catch any child-process crashes
listen_to_children_errors()

# Firstly, find the location of the results
{% for ci in cookiecutter.phase.algorithm_outputs %}
{%- set py_slug = ci.slug | replace("-", "_") -%}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import multiprocessing
import os
import signal
from concurrent.futures import ProcessPoolExecutor, as_completed
from multiprocessing import Manager, Process

Expand Down Expand Up @@ -154,11 +153,3 @@ def _terminate_child_processes():
os.waitpid(-1, 0)
except ChildProcessError:
pass # No child processes, that if fine


def listen_to_children_errors():
def handler(*_, **__):
print("A child failed, terminating all other children")
_terminate_child_processes()

signal.signal(signal.SIGCHLD, handler)

0 comments on commit 5baa601

Please sign in to comment.