diff --git a/src/jsi/cli.py b/src/jsi/cli.py index 4db182b..e463d30 100644 --- a/src/jsi/cli.py +++ b/src/jsi/cli.py @@ -28,7 +28,7 @@ Less common options: --output DIRECTORY directory where solver output files will be written - --supervisor run a supervisor process to avoid orphaned subprocesses + --reaper run a reaper process that kills orphaned solvers when jsi exits --debug enable debug logging --csv print solver results in CSV format (/.csv) --perf print performance timers @@ -207,8 +207,8 @@ def parse_args(args: list[str]) -> Config: config.model = True case "--csv": config.csv = True - case "--supervisor": - config.supervisor = True + case "--reaper": + config.reaper = True case "--daemon": config.daemon = True case "--timeout": @@ -346,8 +346,8 @@ def main(args: list[str] | None = None) -> int: controller.start() status.start() - if config.supervisor: - from jsi.supervisor import Supervisor + if config.reaper: + from jsi.reaper import Reaper # wait for the subprocesses to start, we need the PIDs for the supervisor while controller.task.status.value < TaskStatus.RUNNING.value: @@ -356,9 +356,9 @@ def main(args: list[str] | None = None) -> int: # start a supervisor process in daemon mode so that it does not block # the program from exiting child_pids = [command.pid for command in controller.commands] - sv = Supervisor(os.getpid(), child_pids, config.debug) - sv.daemon = True - sv.start() + reaper = Reaper(os.getpid(), child_pids, config.debug) + reaper.daemon = True + reaper.start() # wait for the solvers to finish controller.join() diff --git a/src/jsi/config/loader.py b/src/jsi/config/loader.py index 9423cab..a62ece6 100644 --- a/src/jsi/config/loader.py +++ b/src/jsi/config/loader.py @@ -24,7 +24,7 @@ def __init__( debug: bool = False, input_file: str | None = None, output_dir: str | None = None, - supervisor: bool = False, + reaper: bool = False, sequence: Sequence[str] | None = None, model: bool = False, csv: bool = False, @@ -36,7 +36,7 @@ def __init__( self.debug = debug self.input_file = input_file self.output_dir = output_dir - self.supervisor = supervisor + self.reaper = reaper self.sequence = sequence self.model = model self.csv = csv diff --git a/src/jsi/supervisor.py b/src/jsi/reaper.py similarity index 89% rename from src/jsi/supervisor.py rename to src/jsi/reaper.py index 330d584..c4a56ee 100644 --- a/src/jsi/supervisor.py +++ b/src/jsi/reaper.py @@ -5,8 +5,8 @@ from jsi.utils import LogLevel, get_console, kill_process, logger, pid_exists -class Supervisor(multiprocessing.Process): - """Supervisor process that monitors the parent process and its children.""" +class Reaper(multiprocessing.Process): + """Reaper process that monitors the parent process and its children.""" parent_pid: int child_pids: list[int] @@ -22,7 +22,7 @@ def run(self): level = LogLevel.DEBUG if self.debug else LogLevel.INFO logger.enable(console=get_console(sys.stderr), level=level) - logger.info(f"supervisor started (PID: {self.pid})") + logger.info(f"reaper started (PID: {self.pid})") logger.info(f"watching parent (PID: {self.parent_pid})") logger.info(f"watching children (PID: {self.child_pids})")