Skip to content

Commit

Permalink
Fix Issue #75: controller now kills child containers
Browse files Browse the repository at this point in the history
  • Loading branch information
cueltschey committed Dec 20, 2024
1 parent 885d31e commit 594dbfc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion docker/controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ RUN poetry install --only main

WORKDIR /app/

CMD ["/bin/bash", "entrypoint.sh"]
CMD poetry run python3 main.py --config $CONFIG --docker 1

14 changes: 0 additions & 14 deletions docker/controller/src/entrypoint.sh

This file was deleted.

14 changes: 14 additions & 0 deletions docker/controller/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pathlib
import yaml
import logging
import signal
from typing import List, Dict, Union

# Configuration data class
Expand All @@ -21,6 +22,19 @@


logger = logging.getLogger(__name__)
global process_list
process_list = []

def handle_signal(signum, frame):
global process_list
for process in process_list:
process["handle"].stop()
logging.debug(f"Killed process {process['id']}")
process_list= []
sys.exit(0)

signal.signal(signal.SIGINT, handle_signal)
signal.signal(signal.SIGTERM, handle_signal)


def configure() -> None:
Expand Down

0 comments on commit 594dbfc

Please sign in to comment.