resilient#
Resilient mode for Fluent solver sessions.
Enable it with resilient_mode=True on any function that launches a solver
session. Ordinary
PyFluent code then gains:
a journal of settings writes with undo and redo;
checkpoints (case and data files), written automatically before irreversible commands, with automatic rollback when such a command fails; and
optional failover to warm standby sessions.
The behavior is implemented by the product-agnostic engine in
ansys.fluent.core.resilient.engine; FluentAdapter supplies the
Fluent-specific parts.
Examples#
>>> import ansys.fluent.core as pyfluent
>>> solver = pyfluent.Solver.from_install(resilient_mode=True)
>>> solver.settings.file.read_case(file_name="mixing_elbow.cas.h5")
>>> solver.resilient.checkpoint("configured")
>>> solver.settings.solution.run_calculation.iterate(iter_count=100)
>>> solver.resilient.rollback("configured")
Classes:
|
A restorable checkpoint written by the product (for example a case file). |
|
Where and how checkpoints are written. |
|
Result of classifying an exception. |
|
A command executed with |
|
Machine-readable classification of an error raised by a settings call. |
|
Exception classes a product raises for settings errors. |
|
Kinds of events reported by a resilient session. |
Resilient-mode adapter for Fluent solver sessions. |
|
|
Ordered, bounded record of state-changing operations with undo / redo. |
|
A structural change: |
|
Warm standby sessions used for failover. |
Product-specific behavior required by the resilient engine. |
|
|
Configuration of resilient mode. |
|
Resilient state of one session: journal, checkpoints, recovery and failover. |
|
An event reported to listeners registered with |
|
Resilient-mode controls of a session, available as |
|
A value written with |
|
How the engine responds to a classified error. |
|
Outcome of one intercepted settings write or command. |
|
One active session plus |
Exceptions:
Raised when a checkpoint cannot be written, found, or restored. |
|
Raised when a standby session cannot take over from a dead session. |
|
Base class for errors raised by the resilient engine itself. |
|
A standby session took over from a session that died. |
|
Base class for warnings emitted by resilient mode. |
Functions:
|
Disable resilient mode on |
|
Return whether resilient mode is enabled on |
- class ansys.fluent.core.resilient.Checkpoint(name, path, include_data, reason=None, journal_seq=0, created_at=<factory>)#
Bases:
objectA restorable checkpoint written by the product (for example a case file).
Attributes:
Journal position when the checkpoint was taken.
Methods:
to_dict()Return the checkpoint metadata as a plain dictionary.
-
journal_seq:
int= 0# Journal position when the checkpoint was taken. Journal operations with a sequence number at or above this value happened after the checkpoint.
- to_dict()#
Return the checkpoint metadata as a plain dictionary.
-
journal_seq:
- class ansys.fluent.core.resilient.CheckpointConfig(directory=None, keep_last=5, include_data=True)#
Bases:
objectWhere and how checkpoints are written.
- Parameters:
- directory
stroros.PathLike,optional Directory for checkpoint files. For a server that shares the client file system, the default is
resilient_checkpoints/<run-id>under the current working directory. For a remote or containerized server, the default is the server working directory (for a container, the folder mounted into it), and a directory you give is a path on the server (for a container, a path inside it). It must already exist, and every standby session must be able to read it.- keep_last
int,optional Number of most recent checkpoints to keep. Older ones are deleted when the client can reach the files. The default is
5.- include_databool,
optional Whether to include solution data when the product supports it. The default is
True.
- directory
Attributes:
- exception ansys.fluent.core.resilient.CheckpointError#
Bases:
ResilientErrorRaised when a checkpoint cannot be written, found, or restored.
- class ansys.fluent.core.resilient.Classification(category, severity, message, details=None)#
Bases:
objectResult of classifying an exception.
Attributes:
Whether this is a clean solver stop rather than an error.
Whether this error makes the session unusable.
-
category:
ErrorCategory#
-
category:
- class ansys.fluent.core.resilient.CommandOp(path, command, args=<factory>, irreversible=False, checkpoint=None, seq=-1, created_at=<factory>)#
Bases:
objectA command executed with
execute_cmd.Attributes:
Return the command path including the command name.
Methods:
describe()Return a one-line description of the operation.
to_dict()Return the operation as a plain dictionary.
- describe()#
Return a one-line description of the operation.
- to_dict()#
Return the operation as a plain dictionary.
- class ansys.fluent.core.resilient.ErrorCategory(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumMachine-readable classification of an error raised by a settings call.
Attributes:
A clean stop of an interruptible (solve) command.
The server is in a fatal state or no longer serving.
The target is read-only.
None of the above.
- BENIGN_INTERRUPT = 'benign_interrupt'#
A clean stop of an interruptible (solve) command.
- FATAL = 'fatal'#
The server is in a fatal state or no longer serving.
- READ_ONLY = 'read_only'#
The target is read-only.
- UNKNOWN = 'unknown'#
None of the above.
- class ansys.fluent.core.resilient.ErrorClasses(read_only=None)#
Bases:
objectException classes a product raises for settings errors.
Any member may be
None; the classifier then relies on message heuristics.Attributes:
- class ansys.fluent.core.resilient.EventKind(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
-
Kinds of events reported by a resilient session.
Attributes:
A checkpoint was written.
A standby session took over from a session that died.
A journaled settings write was redone.
The session was restored to a checkpoint.
A journaled settings write was undone.
Methods:
__new__(value)- CHECKPOINT = 'checkpoint'#
A checkpoint was written.
- FAILOVER = 'failover'#
A standby session took over from a session that died.
- REDO = 'redo'#
A journaled settings write was redone.
- ROLLBACK = 'rollback'#
The session was restored to a checkpoint.
- UNDO = 'undo'#
A journaled settings write was undone.
- __new__(value)#
- exception ansys.fluent.core.resilient.FailoverError#
Bases:
ResilientErrorRaised when a standby session cannot take over from a dead session.
- class ansys.fluent.core.resilient.FluentAdapter#
Bases:
ResilientAdapterResilient-mode adapter for Fluent solver sessions.
Methods:
can_checkpoint(session)Return whether a case is loaded.
checkpoint_artifacts(file_path, *, include_data)Return the case file and, with data, the companion data file.
Return Fluent's read-only settings exception class.
fatal_details(session)Return the details of Fluent's fatal error, if any.
invalidate_settings_cache(session)Drop the cached settings root of a solver session.
is_fatal(session)Return whether Fluent reported a fatal error for the session.
is_interrupt(err)Return whether
erris the clean stop of an interrupted solve.is_server_healthy(session)Return whether the Fluent server answers its health check.
launch(**kwargs)Launch a Fluent session with
launch_fluent.read_checkpoint(session, file_path, *, ...)Read the case (and data) written by
write_checkpoint().register_exit_callback(session, callback)Run
callbackwhen the session's Fluent connection is finalized.shares_client_filesystem(session)Return whether Fluent runs locally, outside a container.
standby_launcher(session)Return a launcher that repeats the launch of a local or container session.
write_checkpoint(session, file_path, *, ...)Write the case, and the data when it exists, to
file_path.Attributes:
File suffix of a checkpoint artifact.
Commands for which the clean-stop sentinel is a benign interrupt.
Command names that cannot be undone by setting values (a checkpoint is written before them when
auto_checkpointis enabled).Commands that are recorded but never replayed onto a standby session.
Command-name prefixes that are recorded but never replayed (for example commands that only write output files).
Dotted prefixes a user may prepend to a settings path.
Product name used in messages.
Attribute holding the server-side name of a settings object.
- can_checkpoint(session)#
Return whether a case is loaded.
- checkpoint_artifacts(file_path, *, include_data)#
Return the case file and, with data, the companion data file.
- error_classes()#
Return Fluent’s read-only settings exception class.
- fatal_details(session)#
Return the details of Fluent’s fatal error, if any.
-
interruptible_commands:
frozenset[str] = frozenset({'calculate', 'dual_time_iterate', 'iterate'})# Commands for which the clean-stop sentinel is a benign interrupt.
- invalidate_settings_cache(session)#
Drop the cached settings root of a solver session.
-
irreversible_commands:
frozenset[str] = frozenset({'calculate', 'dual_time_iterate', 'iterate', 'read', 'read_case', 'read_case_data', 'read_data', 'read_mesh', 'replace', 'replace_mesh'})# Command names that cannot be undone by setting values (a checkpoint is written before them when
auto_checkpointis enabled).
- is_fatal(session)#
Return whether Fluent reported a fatal error for the session.
- is_interrupt(err)#
Return whether
erris the clean stop of an interrupted solve.Fluent ends an interrupted
iterateorcalculatewithRuntimeError("()").
- is_server_healthy(session)#
Return whether the Fluent server answers its health check.
- launch(**kwargs)#
Launch a Fluent session with
launch_fluent.
-
non_replayable_commands:
frozenset[str] = frozenset({'interrupt'})# Commands that are recorded but never replayed onto a standby session.
-
non_replayable_prefixes:
tuple[str,...] = ('write', 'export', 'save', 'print', 'display')# Command-name prefixes that are recorded but never replayed (for example commands that only write output files).
-
path_prefixes:
tuple[str,...] = ('solver.settings.', 'settings.')# Dotted prefixes a user may prepend to a settings path.
- read_checkpoint(session, file_path, *, include_data)#
Read the case (and data) written by
write_checkpoint().The case and the data are read separately: after a floating point exception, Fluent reads the case of a combined case and data read but skips the data.
- Raises:
RuntimeErrorIf Fluent did not load the data.
- register_exit_callback(session, callback)#
Run
callbackwhen the session’s Fluent connection is finalized.
Return whether Fluent runs locally, outside a container.
- standby_launcher(session)#
Return a launcher that repeats the launch of a local or container session.
Sessions launched by PyFluent on the client machine, directly or in a container, are supported. A container standby is another container started with the same arguments, so it mounts the same host folder. For PIM, remote, or file-transfer sessions, pass
PoolConfig(launch_kwargs=...).
- write_checkpoint(session, file_path, *, include_data)#
Write the case, and the data when it exists, to
file_path.
- class ansys.fluent.core.resilient.Journal(*, max_ops=10000)#
Bases:
objectOrdered, bounded record of state-changing operations with undo / redo.
- Parameters:
- max_ops
int,optional Maximum number of operations kept. When exceeded, the oldest operations are dropped (replay from before that point is then impossible and a failover requires a newer checkpoint).
- max_ops
Methods:
__init__(*[, max_ops])can_redo()Return whether there is an undone operation to redo.
can_undo()Return whether there is an operation to undo.
live_since(seq)Return the live operations with a sequence number of at least
seq.record(op)Append an operation, discarding any undone operations after the cursor.
redo(write)Re-apply the most recently undone value write.
Return the live operations as plain dictionaries.
truncate(seq)Forget every operation with a sequence number of at least
seq.undo(write)Undo the most recent value write by writing back its previous value.
Attributes:
Sequence number the next recorded operation receives.
Return the live operations (oldest first).
- __init__(*, max_ops=10000)#
- can_redo()#
Return whether there is an undone operation to redo.
- can_undo()#
Return whether there is an operation to undo.
- live_since(seq)#
Return the live operations with a sequence number of at least
seq.- Raises:
ResilientErrorIf operations after
seqwere already dropped from the journal.
- record(op)#
Append an operation, discarding any undone operations after the cursor.
- redo(write)#
Re-apply the most recently undone value write.
- Raises:
ResilientErrorIf there is nothing to redo.
- to_script()#
Return the live operations as plain dictionaries.
- truncate(seq)#
Forget every operation with a sequence number of at least
seq.
- undo(write)#
Undo the most recent value write by writing back its previous value.
- Raises:
ResilientErrorIf there is nothing to undo, if the most recent operation is not a value write, or if its previous value was not captured.
- class ansys.fluent.core.resilient.ObjectOp(method, path, args=(), seq=-1, created_at=<factory>)#
Bases:
objectA structural change:
create,delete,renameor a list resize.Attributes:
Methods:
describe()Return a one-line description of the operation.
to_dict()Return the operation as a plain dictionary.
- describe()#
Return a one-line description of the operation.
- to_dict()#
Return the operation as a plain dictionary.
- class ansys.fluent.core.resilient.PoolConfig(size=1, launch_kwargs=None, launcher=None)#
Bases:
objectWarm standby sessions used for failover.
- Parameters:
- size
int,optional Total number of sessions: one active session plus
size - 1warm standbys. The default is1(no standbys, no failover).- launch_kwargs
dict,optional Keyword arguments for the product’s launch function, used to start standbys. When omitted, standbys reuse the arguments that launched the active session if they are known.
- launcher
callable(),optional Zero-argument callable that returns a new session. Takes precedence over
launch_kwargs.
- size
Attributes:
- class ansys.fluent.core.resilient.ResilientAdapter#
Bases:
ABCProduct-specific behavior required by the resilient engine.
Subclasses must implement the abstract methods. Every other method has a default that suits sessions exposing a
settingsroot and a_settings_serviceattribute.Methods:
can_checkpoint(session)Return whether the session currently holds state worth checkpointing.
checkpoint_artifacts(file_path, *, include_data)Return every file a checkpoint written to
file_pathconsists of.command_name(command_path)Return the normalized last segment of a command path.
Return the exception classes the product raises for settings errors.
exit_session(session)Exit a session.
fatal_details(session)Return details of a fatal error, if any.
invalidate_settings_cache(session)Drop the cached settings root so that it is rebuilt on next access.
is_fatal(session)Return whether the product reported a fatal error for the session.
is_interrupt(err)Return whether
erris the product's clean stop of a command.is_interruptible(command_path)Return whether a command may stop with the clean-stop sentinel.
is_irreversible(command_path)Return whether a command cannot be undone by setting values.
is_replayable(command_path)Return whether a recorded command is replayed onto a standby session.
is_server_healthy(session)Return whether the server answers a health check.
launch(**kwargs)Launch a new session with the product's launch function.
read_checkpoint(session, file_path, *, ...)Restore the session from the checkpoint at
file_path.register_exit_callback(session, callback)Register
callbackto run whensessionexits.set_settings_service(session, service)Install a settings service on a session.
settings_root(session)Return the settings root of a session.
settings_service(session)Return the settings service of a session, or
None.shares_client_filesystem(session)Return whether the server reads and writes the client's file system.
standby_launcher(session)Return a callable that launches a session like
session, if known.write_checkpoint(session, file_path, *, ...)Write a checkpoint of the session to
file_path.Attributes:
File suffix of a checkpoint artifact.
Commands for which the clean-stop sentinel is a benign interrupt.
Command names that cannot be undone by setting values (a checkpoint is written before them when
auto_checkpointis enabled).Commands that are recorded but never replayed onto a standby session.
Command-name prefixes that are recorded but never replayed (for example commands that only write output files).
Dotted prefixes a user may prepend to a settings path.
Product name used in messages.
Attribute holding the server-side name of a settings object.
- can_checkpoint(session)#
Return whether the session currently holds state worth checkpointing.
- checkpoint_artifacts(file_path, *, include_data)#
Return every file a checkpoint written to
file_pathconsists of.
- static command_name(command_path)#
Return the normalized last segment of a command path.
Server-side names such as
"solution/run-calculation/read-case"are normalized to Python-style names ("read_case") so that adapters can list commands by their Python names.
- error_classes()#
Return the exception classes the product raises for settings errors.
- exit_session(session)#
Exit a session. Must never raise.
- fatal_details(session)#
Return details of a fatal error, if any.
-
interruptible_commands:
frozenset[str] = frozenset({})# Commands for which the clean-stop sentinel is a benign interrupt.
- abstract invalidate_settings_cache(session)#
Drop the cached settings root so that it is rebuilt on next access.
-
irreversible_commands:
frozenset[str] = frozenset({})# Command names that cannot be undone by setting values (a checkpoint is written before them when
auto_checkpointis enabled).
- abstract is_fatal(session)#
Return whether the product reported a fatal error for the session.
- is_interrupt(err)#
Return whether
erris the product’s clean stop of a command.Only consulted for
interruptible_commands. The default isFalse.
- is_interruptible(command_path)#
Return whether a command may stop with the clean-stop sentinel.
- is_irreversible(command_path)#
Return whether a command cannot be undone by setting values.
- is_replayable(command_path)#
Return whether a recorded command is replayed onto a standby session.
- abstract is_server_healthy(session)#
Return whether the server answers a health check. Must never raise.
- launch(**kwargs)#
Launch a new session with the product’s launch function.
- Raises:
NotImplementedErrorIf the product does not support launching standby sessions.
-
non_replayable_commands:
frozenset[str] = frozenset({})# Commands that are recorded but never replayed onto a standby session.
-
non_replayable_prefixes:
tuple[str,...] = ()# Command-name prefixes that are recorded but never replayed (for example commands that only write output files).
-
path_prefixes:
tuple[str,...] = ('settings.',)# Dotted prefixes a user may prepend to a settings path.
- abstract read_checkpoint(session, file_path, *, include_data)#
Restore the session from the checkpoint at
file_path.
- register_exit_callback(session, callback)#
Register
callbackto run whensessionexits.Returns whether the callback was registered.
- set_settings_service(session, service)#
Install a settings service on a session.
- settings_root(session)#
Return the settings root of a session.
- settings_service(session)#
Return the settings service of a session, or
None.
Return whether the server reads and writes the client’s file system.
- standby_launcher(session)#
Return a callable that launches a session like
session, if known.
- abstract write_checkpoint(session, file_path, *, include_data)#
Write a checkpoint of the session to
file_path.Returns whether solution data was included.
- class ansys.fluent.core.resilient.ResilientConfig(auto_checkpoint=True, auto_rollback=True, journal_max_ops=10000, checkpoint=<factory>, pool=<factory>)#
Bases:
objectConfiguration of resilient mode.
- Parameters:
- auto_checkpointbool,
optional Whether to write a checkpoint before each irreversible command (for example
iterateorread_case). The default isTrue.- auto_rollbackbool,
optional Whether to restore that checkpoint when the irreversible command fails. The original error is raised afterwards in either case. The default is
True.- journal_max_ops
int,optional Maximum number of operations kept in the journal. The default is
10000.- checkpoint
CheckpointConfig,optional Checkpoint location and retention.
- pool
PoolConfig,optional Warm standby sessions for failover.
- auto_checkpointbool,
Attributes:
-
checkpoint:
CheckpointConfig#
-
pool:
PoolConfig#
- class ansys.fluent.core.resilient.ResilientController(session, config, adapter, *, pool=None, journal_complete=False)#
Bases:
objectResilient state of one session: journal, checkpoints, recovery and failover.
The controller is created by
enable_resilient_mode(); users interact with it throughsession.resilient.- Parameters:
- session
object The product session.
- config
ResilientConfig Resilient-mode configuration.
- adapter
ResilientAdapter The product adapter.
- pool
WarmSessionPool,optional Warm standby sessions for failover.
- journal_completebool,
optional Whether the journal records the session from its launch, so that a standby launched the same way can be brought to the same state by replaying it.
- session
Methods:
__init__(session, config, adapter, *[, ...])apply_command(path, command, kwds)Handle an intercepted
execute_cmdcall.apply_object_change(method, path, args)Handle an intercepted
create/delete/rename/ resize call.apply_query(method, args, kwargs)Handle a delegated read; fail over if the server died.
apply_set(path, value)Handle an intercepted
set_varcall.bind(session)Route
session's settings calls through this controller.checkpoint(name)Write a checkpoint called
name.disable()Stop intercepting settings calls and exit the standby sessions.
on_event(listener)Register a listener called with every
ResilientEvent.redo()Re-apply the most recently undone value write.
rollback([name])Restore the newest checkpoint, or the newest one called
name.undo()Undo the most recent value write.
wait_for_standbys([timeout])Wait until every standby applied the changes queued for it.
- __init__(session, config, adapter, *, pool=None, journal_complete=False)#
- apply_command(path, command, kwds)#
Handle an intercepted
execute_cmdcall.
- apply_object_change(method, path, args)#
Handle an intercepted
create/delete/rename/ resize call.
- apply_query(method, args, kwargs)#
Handle a delegated read; fail over if the server died.
Reads have no side effects, so a read that fails because the server died is repeated on the standby that takes over.
- Raises:
ExceptionThe error of the read when it is not caused by a dead server, or when no standby is configured.
- apply_set(path, value)#
Handle an intercepted
set_varcall.
- bind(session)#
Route
session’s settings calls through this controller.
- checkpoint(name)#
Write a checkpoint called
name.- Raises:
CheckpointErrorIf the session has nothing to checkpoint or the write fails.
- disable()#
Stop intercepting settings calls and exit the standby sessions.
- on_event(listener)#
Register a listener called with every
ResilientEvent.
- redo()#
Re-apply the most recently undone value write.
- Raises:
ResilientErrorIf there is nothing to redo.
- rollback(name=None)#
Restore the newest checkpoint, or the newest one called
name.Newer checkpoints and the journal entries recorded after the restored checkpoint are discarded.
- Raises:
CheckpointErrorIf no matching checkpoint exists or the restore fails.
- undo()#
Undo the most recent value write.
- Raises:
ResilientErrorIf the most recent operation cannot be undone.
- exception ansys.fluent.core.resilient.ResilientError#
Bases:
RuntimeErrorBase class for errors raised by the resilient engine itself.
- class ansys.fluent.core.resilient.ResilientEvent(kind, message, path=None, data=<factory>)#
Bases:
objectAn event reported to listeners registered with
on_event.Attributes:
- exception ansys.fluent.core.resilient.ResilientFailoverWarning#
Bases:
ResilientWarningA standby session took over from a session that died.
- class ansys.fluent.core.resilient.ResilientSession(controller)#
Bases:
objectResilient-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
listenerwith everyResilientEventof 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:
The session that currently serves settings calls.
The product adapter.
The retained checkpoints, oldest first.
The resilient-mode configuration.
Whether resilient mode is active on the session.
The journal of state-changing operations.
The outcome of the most recent intercepted write or command.
The warm standby pool, or
Nonewhen 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:
- name
str Name of the checkpoint.
- name
- Returns:
CheckpointThe 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 last_outcome: StepOutcome | None#
The outcome of the most recent intercepted write or command.
- on_event(listener)#
Call
listenerwith everyResilientEventof the session.- Parameters:
- listener
callable() Called with one
ResilientEventargument.
- listener
- property pool: WarmSessionPool | None#
The warm standby pool, or
Nonewhen failover is not enabled.
- 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:
- name
str,optional Name of the checkpoint to restore.
- name
- Returns:
CheckpointThe restored checkpoint.
- 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.
- exception ansys.fluent.core.resilient.ResilientWarning#
Bases:
UserWarningBase class for warnings emitted by resilient mode.
- class ansys.fluent.core.resilient.SetOp(path, new_value, old_value=None, old_value_known=False, seq=-1, created_at=<factory>)#
Bases:
objectA value written with
set_var.Attributes:
Whether
old_valuewas read before the write (required for undo).Methods:
describe()Return a one-line description of the operation.
to_dict()Return the operation as a plain dictionary.
- describe()#
Return a one-line description of the operation.
- to_dict()#
Return the operation as a plain dictionary.
- class ansys.fluent.core.resilient.Severity(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumHow the engine responds to a classified error.
Attributes:
Not an error (clean solver stop).
The session is unusable; fail over to a standby session if one exists.
Not catastrophic; the original error is raised unchanged.
- BENIGN = 'benign'#
Not an error (clean solver stop).
- CATASTROPHIC = 'catastrophic'#
The session is unusable; fail over to a standby session if one exists.
- HARD = 'hard'#
Not catastrophic; the original error is raised unchanged.
- class ansys.fluent.core.resilient.StepOutcome(path, ok, old_value=None, new_value=None, result=None, rolled_back=False, failed_over=False, error=None)#
Bases:
objectOutcome of one intercepted settings write or command.
Attributes:
Methods:
to_dict()Return the non-empty fields of the outcome as a plain dictionary.
- to_dict()#
Return the non-empty fields of the outcome as a plain dictionary.
- class ansys.fluent.core.resilient.WarmSessionPool(active, *, size, launcher, adapter)#
Bases:
objectOne active session plus
size - 1warm standby sessions.- Parameters:
- active
object The session in use.
- size
int Total number of sessions, including the active one.
- launcher
callable() Zero-argument callable that launches a standby session.
- adapter
ResilientAdapter The product adapter.
- active
- Raises:
ResilientErrorIf a standby session cannot be launched.
Methods:
__init__(active, *, size, launcher, adapter)promote(standby, *[, retire_previous])Make
standbythe 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:
Return the active session.
Called with each standby launched after the pool was created.
Return the configured number of sessions, including the active one.
Return the warm standby sessions.
- __init__(active, *, size, launcher, adapter)#
-
on_standby_added:
Optional[Callable[[Any],None]]# Called with each standby launched after the pool was created.
- promote(standby, *, retire_previous=True)#
Make
standbythe active session; return the previous active session.The previous session is exited in the background unless
retire_previousisFalse, 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.
- take_standby(prefer=None)#
Remove and return a healthy standby session.
Unhealthy standbys found on the way are exited.
- Parameters:
- prefer
callable(),optional Called with each healthy standby; the first one for which it returns
Trueis taken. Otherwise the first healthy standby is taken.
- prefer
- Raises:
FailoverErrorIf no healthy standby is available.
- ansys.fluent.core.resilient.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.
- ansys.fluent.core.resilient.is_resilient(session)#
Return whether resilient mode is enabled on
session.