diff --git a/force_bdss/mco/base_mco.py b/force_bdss/mco/base_mco.py index 1edb2c56f89bca6943e3dc131d78c7de0f243e43..ae9d89b72092c962ebc7f6415d3fa8166613711e 100644 --- a/force_bdss/mco/base_mco.py +++ b/force_bdss/mco/base_mco.py @@ -14,7 +14,7 @@ class BaseMCO(ABCHasStrictTraits): #: A reference to the factory factory = Instance(IMCOFactory) - #: Must be triggered when an event occurs. + #: Triggered when an event occurs. event = Event(BaseMCOEvent) def __init__(self, factory, *args, **kwargs): @@ -41,4 +41,16 @@ class BaseMCO(ABCHasStrictTraits): """ def notify_event(self, event): + """Method based interface to deliver an event, instead of + assignment to traits. + + Sends the event, synchronously. When the routine returns, + listeners have been fully informed (they might, however, handle + the event asynchronously at their convenience) + + Parameters + ---------- + event: BaseMCOEvent + The event to deliver. + """ self.event = event diff --git a/force_bdss/mco/events.py b/force_bdss/mco/events.py index 2800b8b3387d651600c8c6c8d20247410438f585..216e1effa30d7b1e81e0a8f82312310bb3fae583 100644 --- a/force_bdss/mco/events.py +++ b/force_bdss/mco/events.py @@ -2,17 +2,20 @@ from traits.api import HasStrictTraits, Tuple class BaseMCOEvent(HasStrictTraits): - pass + """Base event for the MCO""" class MCOStartEvent(BaseMCOEvent): - pass + """MCO should emit this event when the evaluation starts.""" class MCOFinishEvent(BaseMCOEvent): - pass + """MCO should emit this event when the evaluation ends.""" class MCOProgressEvent(BaseMCOEvent): + """MCO should emit this event for every new evaluation that has been + completed. It carries data about the evaluation, specifically the + input data (MCO parameter values) and the resulting output (KPIs).""" input = Tuple() output = Tuple()