attach#

Enable and disable resilient mode on a live session.

Classes:

ResilientSession(controller)

Resilient-mode controls of a session, available as session.resilient.

Functions:

disable_resilient_mode(session)

Disable resilient mode on session.

enable_resilient_mode(session[, config, ...])

Enable resilient mode on a live session.

is_resilient(session)

Return whether resilient mode is enabled on session.

class ansys.fluent.core.resilient.engine.attach.ResilientSession(controller)#

Bases: object

Resilient-mode controls of a session, available as session.resilient.

Methods:

__init__(controller)

checkpoint(name)

Write a checkpoint that rollback() can restore.

disable()

Turn resilient mode off and exit the standby sessions.

on_event(listener)

Call listener with every ResilientEvent of the session.

redo()

Re-apply the most recently undone settings value write.

rollback([name])

Restore the newest checkpoint, or the newest one called name.

undo()

Undo the most recent settings value write.

wait_for_standbys([timeout])

Wait until the standby sessions applied every change made so far.

Attributes:

active_session

The session that currently serves settings calls.

adapter

The product adapter.

checkpoints

The retained checkpoints, oldest first.

config

The resilient-mode configuration.

enabled

Whether resilient mode is active on the session.

journal

The journal of state-changing operations.

last_outcome

The outcome of the most recent intercepted write or command.

pool

The warm standby pool, or None when failover is not enabled.

__init__(controller)#
property active_session: Any#

The session that currently serves settings calls.

This is the original session until a failover, and the standby session that took over afterwards.

property adapter: ResilientAdapter#

The product adapter.

checkpoint(name)#

Write a checkpoint that rollback() can restore.

Parameters:
namestr

Name of the checkpoint.

Returns:
Checkpoint

The written checkpoint.

property checkpoints: list[Checkpoint]#

The retained checkpoints, oldest first.

property config: ResilientConfig#

The resilient-mode configuration.

disable()#

Turn resilient mode off and exit the standby sessions.

property enabled: bool#

Whether resilient mode is active on the session.

property journal: Journal#

The journal of state-changing operations.

property last_outcome: StepOutcome | None#

The outcome of the most recent intercepted write or command.

on_event(listener)#

Call listener with every ResilientEvent of the session.

Parameters:
listenercallable()

Called with one ResilientEvent argument.

property pool: WarmSessionPool | None#

The warm standby pool, or None when failover is not enabled.

redo()#

Re-apply the most recently undone settings value write.

Returns:
SetOp

The redone operation.

rollback(name=None)#

Restore the newest checkpoint, or the newest one called name.

Checkpoints written after it, and journal entries recorded after it, are discarded.

Parameters:
namestr, optional

Name of the checkpoint to restore.

Returns:
Checkpoint

The restored checkpoint.

undo()#

Undo the most recent settings value write.

Returns:
SetOp

The undone operation.

wait_for_standbys(timeout=None)#

Wait until the standby sessions applied every change made so far.

Changes that succeed on the active session are applied to the standbys in the background. A failover already waits for them, so calling this is only needed to know that the standbys are up to date.

Parameters:
timeoutfloat, optional

Maximum time to wait, in seconds. The default is None, which waits as long as needed.

Returns:
bool

Whether every standby applied the changes in time and is in sync with the active session.

ansys.fluent.core.resilient.engine.attach.disable_resilient_mode(session)#

Disable resilient mode on session.

Settings calls go directly to the product again and the standby sessions are exited. Calling this on a session without resilient mode does nothing.

Parameters:
sessionobject

A product session.

Returns:
object

The same session.

ansys.fluent.core.resilient.engine.attach.enable_resilient_mode(session, config=None, *, adapter, pool_size=None, standby_launcher=None, journal_complete=False)#

Enable resilient mode on a live session.

Parameters:
sessionobject

A live product session with a settings tree.

configResilientConfig, optional

Resilient-mode configuration. The default configuration is used when omitted. The object is not modified.

adapterResilientAdapter

The product adapter.

pool_sizeint, optional

Shortcut for config.pool.size.

standby_launchercallable(), optional

Zero-argument callable that launches a standby session like session. Product launch functions pass it; it is used only when the configuration does not say how to launch standbys.

journal_completebool, optional

Whether session was just launched, so that the journal records its whole history. Product launch functions pass True.

Returns:
object

The same session, with resilient controls available as session.resilient.

Raises:
ResilientError

If resilient mode is already enabled, the session has no settings service, or standby sessions cannot be launched.

ansys.fluent.core.resilient.engine.attach.is_resilient(session)#

Return whether resilient mode is enabled on session.

Parameters:
sessionobject

A product session.

Returns:
bool

Whether resilient mode is enabled.