EventsManager#

An instance of EventsManager exists as an active events_manager property in each solution mode session object. You can register client callbacks with the EventsManager. The EventsManager calls each callback whenever a server-side event occurs, passing the session ID and event information arguments to the callback. The EventsManager is useful for solution monitoring and updating graphics during runtime.

Supported events are:

  • CalculationsEndedEvent

  • CalculationsStartedEvent

  • CaseReadEvent, DataReadEvent

  • InitializedEvent

  • IterationEndedEvent

  • ProgressEvent

  • TimestepEndedEvent

The following code triggers a callback at the end of every iteration.

def callback_executed_at_end_of_iteration(session_id, event_info):
    print("Iteration ended index", event_info.index)

cb_itr_id = session.events_manager.register_callback('IterationEndedEvent', callback_executed_at_end_of_iteration)
EventsManager.register_callback(event_name, call_back, *args, **kwargs)#

Register the callback.

Parameters
event_namestr

Event name to register the callback to.

call_backCallable

Callback to register.

Returns
str

Registered callback ID.

Raises
RuntimeError

If event name is not valid.

Return type

str

EventsManager.unregister_callback(callback_id)#

Unregister the callback.

Parameters
callback_idstr

ID of the registered callback.