pool#

Warm standby sessions for failover.

Standbys are launched when the pool is created, so a failover does not wait for a product launch; the resilient controller keeps them up to date with the active session. Health is checked on demand (when a standby is needed) rather than by background polling. Replaced and retired sessions are exited on a background thread so that a failover never blocks on tearing down a dead server.

Classes:

WarmSessionPool(active, *, size, launcher, ...)

One active session plus size - 1 warm standby sessions.

class ansys.fluent.core.resilient.engine.pool.WarmSessionPool(active, *, size, launcher, adapter)#

Bases: object

One active session plus size - 1 warm standby sessions.

Parameters:
activeobject

The session in use.

sizeint

Total number of sessions, including the active one.

launchercallable()

Zero-argument callable that launches a standby session.

adapterResilientAdapter

The product adapter.

Raises:
ResilientError

If a standby session cannot be launched.

Methods:

__init__(active, *, size, launcher, adapter)

promote(standby, *[, retire_previous])

Make standby the active session; return the previous active session.

release(session)

Put back a standby that was taken but not promoted.

shutdown(*[, keep])

Exit every session of the pool except keep.

take_standby([prefer])

Remove and return a healthy standby session.

Attributes:

active

Return the active session.

on_standby_added

Called with each standby launched after the pool was created.

size

Return the configured number of sessions, including the active one.

standbys

Return the warm standby sessions.

__init__(active, *, size, launcher, adapter)#
property active: Any#

Return the active session.

on_standby_added: Optional[Callable[[Any], None]]#

Called with each standby launched after the pool was created.

promote(standby, *, retire_previous=True)#

Make standby the active session; return the previous active session.

The previous session is exited in the background unless retire_previous is False, and a replacement standby is launched in the background.

release(session)#

Put back a standby that was taken but not promoted.

shutdown(*, keep=None)#

Exit every session of the pool except keep.

property size: int#

Return the configured number of sessions, including the active one.

property standbys: list[Any]#

Return the warm standby sessions.

take_standby(prefer=None)#

Remove and return a healthy standby session.

Unhealthy standbys found on the way are exited.

Parameters:
prefercallable(), optional

Called with each healthy standby; the first one for which it returns True is taken. Otherwise the first healthy standby is taken.

Raises:
FailoverError

If no healthy standby is available.