Engine#
- class Engine(is_run_only: bool = False, force_local: bool = False, heartbeat_interval: numpy.uint = 30000, allowed_heartbeat_misses: numpy.uint = 3)#
Bases: ansys.modelcenter.workflow.api.IEngine
Provides the gRPC implementation of IEngine.
Overview#
Shut down the gRPC server and clear out all objects. |
|
Create a workflow. |
|
Load a workflow from a local file into the engine. |
|
Create an instance of a formatter that can be used to format numbers |
|
Get the value of a preference. |
|
Set the value of a preference. |
|
Get available units by category. |
|
Get whether the engine is in run-only mode. |
|
Get information about the server that is serving the request. |
Flag indicating if this instance has been closed. |
|
Flag indicating if ModelCenter Desktop was started locally or |
|
Get the gRPC channel used to communicate with ModelCenter Desktop. |
|
ID of the connected process, which is useful for debugging. |
Import detail#
from ansys.modelcenter.workflow.grpc_modelcenter.engine import Engine
Property detail#
- property Engine.is_local: bool#
Flag indicating if ModelCenter Desktop was started locally or remotely.
- Returns:
- bool
True
if ModelCenter Desktop was started locally,False
otherwise.
- property Engine.channel: grpc.Channel | None#
Get the gRPC channel used to communicate with ModelCenter Desktop.
- Returns:
grpc.Channel
grpc.Channel
object orNone
if it has not been created.
Method detail#
- Engine.__enter__()#
Initialization when created in a βwithβ statement.
- Engine.__exit__(exc_type, exc_val, exc_tb)#
Clean up when leaving a βwithβ block.
- Engine.close()#
Shut down the gRPC server and clear out all objects.
- Engine.new_workflow(name: str, workflow_type: ansys.modelcenter.workflow.api.WorkflowType = WorkflowType.DATA) ansys.modelcenter.workflow.grpc_modelcenter.workflow.Workflow #
Create a workflow.
- Parameters:
- name
str
Filename or path where the workflow is to be created.
- workflow_type
WorkflowType
,optional
Type of workflow. The default is a data workflow.
- name
- Returns:
IWorkflow
Created
IWorkflow
instance.
- Engine.load_workflow(file_name: os.PathLike | str, ignore_connection_errors: bool | None = None) ansys.modelcenter.workflow.grpc_modelcenter.workflow.Workflow #
Load a workflow from a local file into the engine.
- Engine.get_formatter(fmt: str) ansys.modelcenter.workflow.grpc_modelcenter.format.Format #
Create an instance of a formatter that can be used to format numbers to and from a particular string style.
- Engine.get_preference(pref: str) bool | int | float | str #
Get the value of a preference.
Preferences control how the engine behaves in various ways. The data type of the value may be
bool
,float
,int
, orstr
.
- Engine.set_preference(pref: str, value: bool | int | float | str) None #
Set the value of a preference.
Preferences control how the engine behaves in various ways. The data type of the value may be
bool
,float
,int
, orstr
.- Parameters:
- pref
str
Name of the preference to set.
- value: Union[bool, int, float, str]
Value to set.
- pref
- Engine.get_run_only_mode() bool #
Get whether the engine is in run-only mode.
Run-only mode has lower licensing requirements, but it does not allow for the workflow to be edited.
- Returns:
- bool
True
if in run-only mode,False
otherwise.
- Engine.get_server_info() ansys.engineeringworkflow.api.WorkflowEngineInfo #
Get information about the server that is serving the request.
- Returns:
WorkflowEngineInfo
Object with information about the server that is serving the request.