pydistsim.observers.Observer
- class Observer[source]
Bases:
objectBase class for observers.
Subclasses must implement the on_{event_name} methods for the events they want to listen to.
If an observer is notified of an event it does not listen to, the notification is discarded and a debug message is logged.
To define the events an observer listens to, set the events attribute to a list of event names. The definitive list of allowed events is the union of the events attribute of every class in the inheritance chain. For more information, refer to the
__get_allowed_events__()method.Example of concrete implementations are: -
MetricCollectorclass inpydistsim.metrics-QThreadObserverclass inpydistsim.gui.simulationguiMethods
__init__notifyCalled when the observer is added to an observable object.
Attributes
events- on_added(observable: ObserverManagerMixin) None[source]
Called when the observer is added to an observable object.
- Parameters:
observable (ObserverManagerMixin) – The observable object to which the observer is added.
- Returns:
None