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."""