From: Christian Herdtweck Date: Tue, 24 Jun 2025 08:48:57 +0000 (+0200) Subject: Fix generate check when arnied is absent X-Git-Tag: v1.7.4~1^2~5 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=a67cf323e94bb685e64918a831192444541bfe98;p=pyi2ncommon Fix generate check when arnied is absent --- diff --git a/src/arnied_wrapper.py b/src/arnied_wrapper.py index cfbf0b2..2a7cef8 100644 --- a/src/arnied_wrapper.py +++ b/src/arnied_wrapper.py @@ -403,12 +403,15 @@ def wait_for_generate(timeout: int = 300, vm=None) -> bool: cmd1 = f"{BIN_ARNIED_HELPER} --is-scheduled-or-running GENERATE" cmd2 = f"{BIN_ARNIED_HELPER} --is-scheduled-or-running GENERATE_OFFLINE" end_time = time.monotonic() + timeout - 0.5 - while run_cmd(cmd=cmd1, ignore_errors=True, vm=vm).returncode == 0 \ - or run_cmd(cmd=cmd2, ignore_errors=True, vm=vm).returncode == 0: - # one of them is scheduled or running, so check timeout and wait - if time.monotonic() > end_time: - log.warning("Timeout waiting for generate to start/finish") - return False + + while time.monotonic() < end_time: + # from docu of arnied_helper: + # --is-scheduled-or-running PROGNAME Exit code 0 if scheduled or running, 1 otherwise + if run_cmd(cmd=cmd1, ignore_errors=True, vm=vm).returncode == 1 \ + and run_cmd(cmd=cmd2, ignore_errors=True, vm=vm).returncode == 1: + # both commands succeeded and indicate that neither program is running nor scheduled + return True log.debug("Waiting for generate to start/finish...") time.sleep(1) - return True \ No newline at end of file + log.warning("Timeout waiting for generate to start/finish") + return False