From 3fcf95048cfd004e9a46db8b9d5e2c7dde7263b4 Mon Sep 17 00:00:00 2001 From: Marcin Usielski Date: Tue, 2 Dec 2025 08:54:43 +0100 Subject: [PATCH 1/3] Warning if command goes to queue --- moler/command_scheduler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moler/command_scheduler.py b/moler/command_scheduler.py index 37c5823de..834ab59b2 100644 --- a/moler/command_scheduler.py +++ b/moler/command_scheduler.py @@ -3,7 +3,7 @@ """Scheduler for commands and events.""" __author__ = "Marcin Usielski" -__copyright__ = "Copyright (C) 2019-2023, Nokia" +__copyright__ = "Copyright (C) 2019-2025, Nokia" __email__ = "marcin.usielski@nokia.com" import logging @@ -11,6 +11,7 @@ import time from threading import Thread +from moler.connection_observer import ConnectionObserver from moler.exceptions import CommandTimeout @@ -18,7 +19,7 @@ class CommandScheduler: """Scheduler for commands and events.""" @staticmethod - def enqueue_starting_on_connection(connection_observer): + def enqueue_starting_on_connection(connection_observer: ConnectionObserver): """ Wait for free slot and runs command when no other command is in run mode. @@ -43,6 +44,7 @@ def enqueue_starting_on_connection(connection_observer): ) t1.daemon = True t1.start() + connection_observer.logger.warning(f"Requested to execute command ({connection_observer}) but the other command is running. Waiting for a free slot.") @staticmethod def dequeue_running_on_connection(connection_observer): From 5d7adf799b9700ee66313156e46acd4c315ce4a5 Mon Sep 17 00:00:00 2001 From: Marcin Usielski Date: Tue, 2 Dec 2025 08:59:37 +0100 Subject: [PATCH 2/3] import --- moler/command_scheduler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/moler/command_scheduler.py b/moler/command_scheduler.py index 834ab59b2..1f583235a 100644 --- a/moler/command_scheduler.py +++ b/moler/command_scheduler.py @@ -11,7 +11,6 @@ import time from threading import Thread -from moler.connection_observer import ConnectionObserver from moler.exceptions import CommandTimeout @@ -19,7 +18,7 @@ class CommandScheduler: """Scheduler for commands and events.""" @staticmethod - def enqueue_starting_on_connection(connection_observer: ConnectionObserver): + def enqueue_starting_on_connection(connection_observer): """ Wait for free slot and runs command when no other command is in run mode. From 7ba6a96fcc641e040e00d31bab4516ddc1697579 Mon Sep 17 00:00:00 2001 From: Marcin Usielski Date: Tue, 2 Dec 2025 10:25:53 +0100 Subject: [PATCH 3/3] dev --- moler/command_scheduler.py | 3 ++- moler/connection_observer.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/moler/command_scheduler.py b/moler/command_scheduler.py index 1f583235a..d0b44a224 100644 --- a/moler/command_scheduler.py +++ b/moler/command_scheduler.py @@ -43,7 +43,8 @@ def enqueue_starting_on_connection(connection_observer): ) t1.daemon = True t1.start() - connection_observer.logger.warning(f"Requested to execute command ({connection_observer}) but the other command is running. Waiting for a free slot.") + connection_observer._log(logging.WARNING, f"Requested to execute command ({connection_observer}) but the other " + "command is running. Waiting for a free slot.") @staticmethod def dequeue_running_on_connection(connection_observer): diff --git a/moler/connection_observer.py b/moler/connection_observer.py index c6cc670d9..c8dc13777 100644 --- a/moler/connection_observer.py +++ b/moler/connection_observer.py @@ -3,7 +3,7 @@ """Base class for all events and commands that are to be observed on connection.""" __author__ = "Grzegorz Latuszek, Marcin Usielski, Michal Ernst" -__copyright__ = "Copyright (C) 2018-2024 Nokia" +__copyright__ = "Copyright (C) 2018-2025 Nokia" __email__ = ( "grzegorz.latuszek@nokia.com, marcin.usielski@nokia.com, michal.ernst@nokia.com" ) @@ -546,7 +546,7 @@ def get_short_desc(self) -> str: """ return f"Observer '{self.__class__.__module__}.{self}'" - def _log(self, lvl: int, msg: str, extra: dict = None, levels_to_go_up: int = 1) -> None: + def _log(self, lvl: int, msg: str, extra: Optional[dict] = None, levels_to_go_up: int = 1) -> None: """ Log a message with the specified level.