adapter#

The product seam of the resilient engine.

The engine never imports a product. Everything that differs between products – how a session reports a fatal error, which exceptions it raises, how a checkpoint is written and read, how a standby session is launched – is implemented by a subclass of ResilientAdapter.

Classes:

ErrorClasses([read_only])

Exception classes a product raises for settings errors.

ResilientAdapter()

Product-specific behavior required by the resilient engine.

Functions:

instance_attr(obj, name)

Return obj.name without triggering __getattr__ fallbacks.

class ansys.fluent.core.resilient.engine.adapter.ErrorClasses(read_only=None)#

Bases: object

Exception classes a product raises for settings errors.

Any member may be None; the classifier then relies on message heuristics.

Attributes:

read_only: type | None = None#
class ansys.fluent.core.resilient.engine.adapter.ResilientAdapter#

Bases: ABC

Product-specific behavior required by the resilient engine.

Subclasses must implement the abstract methods. Every other method has a default that suits sessions exposing a settings root and a _settings_service attribute.

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_path consists of.

command_name(command_path)

Return the normalized last segment of a command path.

error_classes()

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 err is 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 callback to run when session exits.

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:

checkpoint_suffix

File suffix of a checkpoint artifact.

interruptible_commands

Commands for which the clean-stop sentinel is a benign interrupt.

irreversible_commands

Command names that cannot be undone by setting values (a checkpoint is written before them when auto_checkpoint is enabled).

non_replayable_commands

Commands that are recorded but never replayed onto a standby session.

non_replayable_prefixes

Command-name prefixes that are recorded but never replayed (for example commands that only write output files).

path_prefixes

Dotted prefixes a user may prepend to a settings path.

product_name

Product name used in messages.

server_name_attr

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_path consists of.

checkpoint_suffix: str = ''#

File suffix of a checkpoint artifact.

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_checkpoint is enabled).

abstract is_fatal(session)#

Return whether the product reported a fatal error for the session.

is_interrupt(err)#

Return whether err is the product’s clean stop of a command.

Only consulted for interruptible_commands. The default is False.

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:
NotImplementedError

If 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.

product_name: str = 'product'#

Product name used in messages.

abstract read_checkpoint(session, file_path, *, include_data)#

Restore the session from the checkpoint at file_path.

register_exit_callback(session, callback)#

Register callback to run when session exits.

Returns whether the callback was registered.

server_name_attr: str = 'obj_name'#

Attribute holding the server-side name of a settings object.

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.

abstract write_checkpoint(session, file_path, *, include_data)#

Write a checkpoint of the session to file_path.

Returns whether solution data was included.

ansys.fluent.core.resilient.engine.adapter.instance_attr(obj, name)#

Return obj.name without triggering __getattr__ fallbacks.

Product sessions often forward unknown attributes to their settings tree (and therefore to the server). Probing them with getattr would issue remote calls, so the engine reads its own bookkeeping attributes with this helper. Returns None when the attribute does not exist.