eta_nexus.connections.connection_utils module

class eta_nexus.connections.connection_utils.RetryWaiter[source]

Bases: object

Helper class which keeps track of waiting time before retrying a connection.

VALUES: Final[list[int]] = [0, 1, 3, 5, 5, 10, 20, 30, 40, 60]
tried() None[source]

Register a retry with the RetryWaiter.

success() None[source]

Register a successful connection with the RetryWaiter.

property wait_time: int

Return the time to wait for.

wait() None[source]

Wait/sleep synchronously.

async wait_async() None[source]

Wait/sleep asynchronously - must be awaited.

class eta_nexus.connections.connection_utils.IntervalChecker[source]

Bases: object

Class for the subscription interval checking.

node_latest_values: dict[Node, list]

Dictionary that stores the value and the time for checking changes and the time interval

push(node: Node, value: Any | pd.Series | Sequence[Any], timestamp: datetime | pd.DatetimeIndex | TimeStep | None = None) None[source]

Push value and time in dictionary for a node. If the value doesn’t change compared to the previous timestamp, the push is skipped.

Parameters:
  • node – Node to check.

  • value – Value from the subscription.

  • timestamp – Time of the incoming value of the node.

check_interval_connection() bool | None[source]

Check the interval between old and new value. If no interval has been defined, the check interval is skipped.

Returns:

Boolean for the interval check.