From 8e9a70ff43b0a0e5f3807b3bb763fc5293132cc5 Mon Sep 17 00:00:00 2001 From: mike seibel Date: Mon, 21 Oct 2024 12:49:46 -0700 Subject: [PATCH] end daemon pod on exception, let restartPolicy restart pod --- scripts/call_command.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/call_command.py b/scripts/call_command.py index 23bc122..08fa3da 100644 --- a/scripts/call_command.py +++ b/scripts/call_command.py @@ -114,7 +114,9 @@ def run(self): rv = int(str(ex)) except Exception as ex: rv = -1 - logger.error("exception: {}".format(ex), exc_info=True) + logger.error("{} exception: {}".format( + "daemon" if self.is_daemon else "cron", ex), + exc_info=True) finish = time.time() duration = finish - start @@ -124,6 +126,10 @@ def run(self): exit=(rv if rv and isinstance(rv, int) else 0)) if self.is_daemon: + if rv < 0: + self.metrics.flush() + break + self.pause(start) else: self.metrics.flush()