deisa.ray.window_handler module

class deisa.ray.window_handler.Deisa(*, ray_start: Callable[[], None] | None = None, handshake: Callable[[Deisa], None] | None = None)[source]

Bases: object

execute_callbacks() None[source]

Execute the registered simulation callback loop.

Notes

Supports a single registered callback at present. Manages array retrieval from the head actor, optional preparation tasks, windowed array delivery, and garbage collection between iterations.

register_callback(simulation_callback: Callable, arrays_description: list[WindowArrayDefinition], *, max_iterations=1000000000, prepare_iteration: Callable | None = None, preparation_advance: int = 3) None[source]

Register the analytics callback and array descriptions.

Parameters:
  • simulation_callback (Callable) – Function to run for each iteration; receives arrays as kwargs and timestep.

  • arrays_description (list[WindowArrayDefinition]) – Descriptions of arrays to stream to the callback (with optional sliding windows).

  • max_iterations (int, optional) – Maximum iterations to execute. Default is a large sentinel.

  • prepare_iteration (Callable or None, optional) – Optional preparatory callback run preparation_advance steps ahead. Receives the array and timestep.

  • preparation_advance (int, optional) – How many iterations ahead to prepare when prepare_iteration is provided. Default is 3.

set(*args, key: Hashable, value: Any, chunked: bool = False, **kwargs) None[source]

Broadcast a feedback value to all node actors.

Parameters:
  • key (Hashable) – Identifier for the shared value.

  • value (Any) – Value to distribute.

  • chunked (bool, optional) – Placeholder for future distributed-array feedback. Only False is supported today. Default is False.

Notes

The method lazily fetches node actors once and uses fire-and-forget remote calls; callers should not assume synchronous delivery.

unregister_callback(simulation_callback: Callable) None[source]

Unregister a previously registered simulation callback.

Parameters:

simulation_callback (Callable) – Callback to remove from the registry.

Raises:

NotImplementedError – Always, as the feature has not been implemented yet.