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:
|
Exception classes a product raises for settings errors. |
Product-specific behavior required by the resilient engine. |
Functions:
|
Return |
- class ansys.fluent.core.resilient.engine.adapter.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.engine.adapter.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.
- ansys.fluent.core.resilient.engine.adapter.instance_attr(obj, name)#
Return
obj.namewithout triggering__getattr__fallbacks.Product sessions often forward unknown attributes to their settings tree (and therefore to the server). Probing them with
getattrwould issue remote calls, so the engine reads its own bookkeeping attributes with this helper. ReturnsNonewhen the attribute does not exist.