GrpcClient#

class ansys.geometry.core.connection.client.GrpcClient(host: str = DEFAULT_HOST, port: str | int = DEFAULT_PORT, channel: grpc.Channel | None = None, remote_instance: ansys.platform.instancemanagement.Instance | None = None, docker_instance: ansys.geometry.core.connection.docker_instance.LocalDockerInstance | None = None, product_instance: ansys.geometry.core.connection.product_instance.ProductInstance | None = None, timeout: ansys.geometry.core.typing.Real = 120, logging_level: int = logging.INFO, logging_file: pathlib.Path | str | None = None, backend_type: ansys.geometry.core.connection.backend.BackendType | None = None)#

Wraps the gRPC connection for the Geometry service.

Parameters:
hoststr, default: DEFAULT_HOST

Host where the server is running.

portstr or int, default: DEFAULT_PORT

Port number where the server is running.

channelChannel, default: None

gRPC channel for server communication.

remote_instanceansys.platform.instancemanagement.Instance, default: None

Corresponding remote instance when the Geometry service is launched through PyPIM. This instance is deleted when calling the GrpcClient.close method.

docker_instanceLocalDockerInstance, default: None

Corresponding local Docker instance when the Geometry service is launched using the launch_docker_modeler() method. This local Docker instance is deleted when the GrpcClient.close method is called.

product_instanceProductInstance, default: None

Corresponding local product instance when the product (Discovery or SpaceClaim) is launched through the launch_modeler_with_geometry_service(), launch_modeler_with_discovery() or the launch_modeler_with_spaceclaim() interface. This instance will be deleted when the GrpcClient.close method is called.

timeoutreal, default: 120

Maximum time to spend trying to make the connection.

logging_levelint, default: INFO

Logging level to apply to the client.

logging_filestr or Path, default: None

File to output the log to, if requested.

backend_type: BackendType, default: None

Type of the backend that PyAnsys Geometry is communicating with. By default, this value is unknown, which results in None being the default value.

Overview#

close

Close the channel.

target

Get the target of the channel.

get_name

Get the target name of the connection.

backend_type

Backend type.

backend_version

Get the current backend version.

multiple_designs_allowed

Flag indicating whether multiple designs are allowed.

channel

Client gRPC channel.

log

Specific instance logger.

is_closed

Flag indicating whether the client connection is closed.

healthy

Flag indicating whether the client channel is healthy.

__repr__

Represent the client as a string.

Import detail#

from ansys.geometry.core.connection.client import GrpcClient

Property detail#

property GrpcClient.backend_type: ansys.geometry.core.connection.backend.BackendType#

Backend type.

Options are Windows Service, Linux Service, Discovery, and SpaceClaim.

Notes

This method might return None because determining the backend type is not straightforward.

property GrpcClient.backend_version: semver.version.Version#

Get the current backend version.

Returns:
Version

Backend version.

property GrpcClient.multiple_designs_allowed: bool#

Flag indicating whether multiple designs are allowed.

Notes

This method will return False if the backend type is Discovery or Linux Service. Otherwise, it will return True.

property GrpcClient.channel: grpc.Channel#

Client gRPC channel.

property GrpcClient.log: ansys.geometry.core.logger.PyGeometryCustomAdapter#

Specific instance logger.

property GrpcClient.is_closed: bool#

Flag indicating whether the client connection is closed.

property GrpcClient.healthy: bool#

Flag indicating whether the client channel is healthy.

Attribute detail#

GrpcClient.grpc_backend_response#

Method detail#

GrpcClient.__repr__() str#

Represent the client as a string.

GrpcClient.close()#

Close the channel.

Notes

If an instance of the Geometry service was started using PyPIM, this instance is deleted. Furthermore, if a local Docker instance of the Geometry service was started, it is stopped.

GrpcClient.target() str#

Get the target of the channel.

GrpcClient.get_name() str#

Get the target name of the connection.