From b64fd0bbfeb55bdf3f483ebc077588f3bc4d9544 Mon Sep 17 00:00:00 2001 From: Hemant Mishra Date: Tue, 6 Jan 2026 17:05:45 +0530 Subject: [PATCH] Fix Windows service startup timeout by calling set_service_running() --- CHANGELOG.md | 6 ++++++ cognite/extractorutils/__init__.py | 2 +- cognite/extractorutils/unstable/core/runtime.py | 1 + pyproject.toml | 2 +- tests/test_unstable/test_runtime.py | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc56f00..f4d2cc27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ Changes are grouped as follows - `Security` in case of vulnerabilities. +## 7.11.3 + +### Fixed +* In the `unstable` package: Fixed `handle.set_service_running()` call to report service status to Windows Service Control Manager + + ## 7.11.2 ### Fixed diff --git a/cognite/extractorutils/__init__.py b/cognite/extractorutils/__init__.py index c04f427e..0e9eb81f 100644 --- a/cognite/extractorutils/__init__.py +++ b/cognite/extractorutils/__init__.py @@ -16,7 +16,7 @@ Cognite extractor utils is a Python package that simplifies the development of new extractors. """ -__version__ = "7.11.2" +__version__ = "7.11.3" from .base import Extractor __all__ = ["Extractor"] diff --git a/cognite/extractorutils/unstable/core/runtime.py b/cognite/extractorutils/unstable/core/runtime.py index 2cdae9c3..52b78bfc 100644 --- a/cognite/extractorutils/unstable/core/runtime.py +++ b/cognite/extractorutils/unstable/core/runtime.py @@ -444,6 +444,7 @@ def cancel_service() -> None: # Wrap the main runtime loop in a function for the service def service_main(handle: ServiceHandle, service_args: list[str]) -> None: handle.event_log_info("Extractor Windows service is starting.") + handle.set_service_running() try: self._main_runtime(args) except Exception as exc: diff --git a/pyproject.toml b/pyproject.toml index 219c9f71..14d6d58c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cognite-extractor-utils" -version = "7.11.2" +version = "7.11.3" description = "Utilities for easier development of extractors for CDF" authors = [ {name = "Mathias Lohne", email = "mathias.lohne@cognite.com"} diff --git a/tests/test_unstable/test_runtime.py b/tests/test_unstable/test_runtime.py index 29f7757f..0e20f287 100644 --- a/tests/test_unstable/test_runtime.py +++ b/tests/test_unstable/test_runtime.py @@ -343,6 +343,7 @@ def cancel() -> None: # Simulate service_main logic def service_main(handle: ServiceHandle, service_args: list[str]) -> None: handle.event_log_info("Extractor Windows service is starting.") + handle.set_service_running() runtime._main_runtime(args) handle.event_log_info("Extractor Windows service is stopping.") @@ -354,6 +355,7 @@ def service_main(handle: ServiceHandle, service_args: list[str]) -> None: service_main(handle, []) cancel_thread.join() handle.event_log_info.assert_any_call("Extractor Windows service is starting.") + handle.set_service_running.assert_called_once() handle.event_log_info.assert_any_call("Extractor Windows service is stopping.") # Assert that 'Shutting down runtime' was logged, confirming _main_runtime ran mock_logger_info.assert_any_call("Shutting down runtime")