From d3b4a0a4560c9f2f12731def8ba4291b411a5112 Mon Sep 17 00:00:00 2001 From: Mathias Lohne Date: Thu, 28 Nov 2024 11:58:33 +0100 Subject: [PATCH] Don't look for config updates when running local configs (#400) This caused the extractor to restart after each checkin when running with a local config file --- cognite/extractorutils/unstable/core/base.py | 6 +++++- cognite/extractorutils/unstable/scheduling/_scheduler.py | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cognite/extractorutils/unstable/core/base.py b/cognite/extractorutils/unstable/core/base.py index 95e6505..b63d5ce 100644 --- a/cognite/extractorutils/unstable/core/base.py +++ b/cognite/extractorutils/unstable/core/base.py @@ -101,7 +101,11 @@ def _checkin(self) -> None: ) new_config_revision = res.json().get("lastConfigRevision") - if new_config_revision and new_config_revision != self.current_config_revision: + if ( + new_config_revision + and self.current_config_revision != "local" + and new_config_revision != self.current_config_revision + ): self.restart() def _run_checkin(self) -> None: diff --git a/cognite/extractorutils/unstable/scheduling/_scheduler.py b/cognite/extractorutils/unstable/scheduling/_scheduler.py index be675b4..4baa9c8 100644 --- a/cognite/extractorutils/unstable/scheduling/_scheduler.py +++ b/cognite/extractorutils/unstable/scheduling/_scheduler.py @@ -56,7 +56,7 @@ def _get_next(self) -> list[Job]: def _run_job(self, job: Job) -> bool: with self._running_lock: if job in self._running: - self._logger.warning(f"Job {job.name} already running") + self._logger.warning(f"Job '{job.name}' already running") return False def wrap() -> None: @@ -65,7 +65,7 @@ def wrap() -> None: try: job.call() - self._logger.info(f"Job {job.name} done. Next run at {arrow.get(job.schedule.next()).isoformat()}") + self._logger.info(f"Job '{job.name}' done. Next run at {arrow.get(job.schedule.next()).isoformat()}") finally: with self._running_lock: @@ -97,7 +97,7 @@ def run(self) -> None: break for job in next_runs: - self._logger.info(f"Starting job {job.name}") + self._logger.info(f"Starting job '{job.name}'") self._run_job(job) def stop(self) -> None: