From 750b993ed0fae4fab895aeccc64c04d00b4e7034 Mon Sep 17 00:00:00 2001 From: Pingu Carsti Date: Tue, 14 May 2024 16:46:07 +0200 Subject: [PATCH] overwrite birdy.client._console_method to skip signal --- rooki/client.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/rooki/client.py b/rooki/client.py index 356c889..8feb5c0 100644 --- a/rooki/client.py +++ b/rooki/client.py @@ -82,3 +82,30 @@ def _execute(self, pid, **kwargs): except Exception: raise RuntimeError("execution failed") return Result(resp, output_dir=self.output_dir) + + def _console_monitor(self, execution, sleep=3): + """ + TODO: overwrites birdy method to avoid conflict with usage of signal and dask. + """ + # import signal + + # # Intercept CTRL-C + # def sigint_handler(signum, frame): + # self.cancel() + + # signal.signal(signal.SIGINT, sigint_handler) + + while not execution.isComplete(): + execution.checkStatus(sleepSecs=sleep) + self.logger.info( + "{} [{}/100] - {} ".format( + execution.process.identifier, + execution.percentCompleted, + execution.statusMessage[:50], + ) + ) + + if execution.isSucceded(): + self.logger.info(f"{execution.process.identifier} done.") + else: + self.logger.info(f"{execution.process.identifier} failed.")