GrpcClient#
- class ansys.geometry.core.connection.client.GrpcClient(host: str = pygeom_defaults.DEFAULT_HOST, port: str | int = pygeom_defaults.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, proto_version: str | None = None, transport_mode: str | None = None, uds_dir: pathlib.Path | str | None = None, uds_id: str | None = None, certs_dir: pathlib.Path | str | None = None)#
Wraps the gRPC connection for the Geometry service.
- Parameters:
- host
str, default:DEFAULT_HOST Host where the server is running.
- port
strorint, default:DEFAULT_PORT Port number where the server is running.
- channel
Channel, default:None gRPC channel for server communication.
- remote_instance
ansys.platform.instancemanagement.Instance, default:None Corresponding remote instance when the Geometry service is launched through PyPIM. This instance is deleted when calling the
GrpcClient.closemethod.- docker_instance
LocalDockerInstance, 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 theGrpcClient.closemethod is called.- product_instance
ProductInstance, 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 thelaunch_modeler_with_spaceclaim()interface. This instance will be deleted when theGrpcClient.closemethod is called.- timeout
real, default: 120 Maximum time to spend trying to make the connection.
- logging_level
int, default:INFO Logging level to apply to the client.
- logging_file
strorPath, default:None File to output the log to, if requested.
- proto_version
str|None, default:None Protocol version to use for communication with the server. If None, v0 is used. Available versions are “v0”, “v1”, etc.
- transport_mode
str|None Transport mode selected. Needed if
channelis not provided. Options are: “insecure”, “uds”, “wnua”, “mtls”.- uds_dir
Path|str|None Directory to use for Unix Domain Sockets (UDS) transport mode. By default None and thus it will use the “~/.conn” folder.
- uds_id
str|None Optional ID to use for the UDS socket filename. By default None and thus it will use “aposdas_socket.sock”. Otherwise, the socket filename will be “aposdas_socket-
.sock”. - certs_dir
Path|str|None Directory to use for TLS certificates. By default None and thus search for the “ANSYS_GRPC_CERTIFICATES” environment variable. If not found, it will use the “certs” folder assuming it is in the current working directory.
- host
Overview#
Get a string with the backend information. |
|
Close the channel. |
|
Get the target of the channel. |
|
Get the target name of the connection. |
Backend type. |
|
Get the current backend version. |
|
Client gRPC channel. |
|
GRPC services. |
|
Specific instance logger. |
|
Flag indicating whether the client connection is closed. |
|
Flag indicating whether the client channel is healthy. |
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, andSpaceClaim.Notes
This method might return
Nonebecause determining the backend type is not straightforward.
- property GrpcClient.backend_version: semver.version.Version#
Get the current backend version.
- Returns:
VersionBackend version.
- property GrpcClient.channel: grpc.Channel#
Client gRPC channel.
- property GrpcClient.services: ansys.geometry.core._grpc._services._service._GRPCServices#
GRPC services.
- property GrpcClient.log: ansys.geometry.core.logger.PyGeometryCustomAdapter#
Specific instance logger.
Method detail#
- GrpcClient.backend_info(indent=0) str#
Get a string with the backend information.
- Returns:
strString with the backend information.