From 2faad63dea9ce47f9a0c1c1420dd08f3f4069a07 Mon Sep 17 00:00:00 2001 From: Benjamin Labrecque Date: Tue, 14 Jul 2026 11:14:46 +0200 Subject: [PATCH] feat: add optional on_transition_to_paused method for services --- packages/agebd/src/agebd/service/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/agebd/src/agebd/service/base.py b/packages/agebd/src/agebd/service/base.py index 9faf73e..39e3681 100644 --- a/packages/agebd/src/agebd/service/base.py +++ b/packages/agebd/src/agebd/service/base.py @@ -39,6 +39,13 @@ class BaseService(Generic[T]): """Override this method in child classes to implement service logic.""" raise NotImplementedError("Subclasses must implement the update() loop.") + def on_transition_to_paused(self): + """ + Override this method in child classes to implement custom logic when a + service is transitioned to paused. Does nothing by default. + """ + pass + def transition_to_running(self): self.status = ServiceStatus.RUNNING self.pvs.status.put("running") @@ -46,6 +53,7 @@ class BaseService(Generic[T]): def transition_to_paused(self): self.status = ServiceStatus.PAUSED self.pvs.status.put("paused") + self.on_transition_to_paused() def finalize_termination(self): """Determines the exit reason and safely alerts the ALH watchdogs."""