The server_types.py module#

Summary#

GhostServer

Class used to keep in memory the port used by previous servers.

BaseServer

Abstract class for servers.

CServer

Abstract class for servers going through the DPFClientAPI.

GrpcClient

Client using the gRPC communication protocol.

GrpcServer

Server using the gRPC communication protocol.

InProcessServer

Server using the InProcess communication protocol.

LegacyGrpcServer

Provides an instance of the DPF server using InProcess gRPC.

check_valid_ip

Check if a valid IP address is entered.

launch_dpf

Launch Ansys DPF.

launch_dpf_on_docker

Launch Ansys DPF.

launch_remote_dpf

Launch a remote dpf server.

check_ansys_grpc_dpf_version

Check DPF grpc server version.

get_system_path

Return the current PATH environment variable value of the system.

Description#

Server types.

Contains the different kinds of servers available for the factory.

Module detail#

server_types.check_valid_ip(ip)#

Check if a valid IP address is entered.

This method raises an error when an invalid IP address is entered.

server_types.launch_dpf(ansys_path, ip=LOCALHOST, port=DPF_DEFAULT_PORT, timeout=10, context: ansys.dpf.core.server_context.ServerContext = None)#

Launch Ansys DPF.

Parameters:
  • ansys_path (str, optional) – Root path for the Ansys installation directory. For example, "/ansys_inc/v212/". The default is the latest Ansys installation.

  • ip (str, optional) – IP address of the remote or local instance to connect to. The default is "LOCALHOST".

  • port (int) – Port to connect to the remote instance on. The default is "DPF_DEFAULT_PORT", which is 50054.

  • timeout (float, optional) – Maximum number of seconds for the initialization attempt. The default is 10. Once the specified number of seconds passes, the connection fails.

  • context (, optional) – Context to apply to DPF server when launching it.

server_types.launch_dpf_on_docker(running_docker_config=server_factory.RunningDockerConfig(), ansys_path=None, ip=LOCALHOST, port=DPF_DEFAULT_PORT, timeout=10.0)#

Launch Ansys DPF.

Parameters:
  • running_docker_config (server_factory.RunningDockerConfig, optional) – To start DPF server as a docker, specify the docker configurations here.

  • ansys_path (str, optional) – Root path for the Ansys installation directory. For example, "/ansys_inc/v212/". The default is the latest Ansys installation.

  • ip (str, optional) – IP address of the remote or local instance to connect to. The default is "LOCALHOST".

  • port (int) – Port to connect to the remote instance on. The default is "DPF_DEFAULT_PORT", which is 50054.

  • timeout (float, optional) – Maximum number of seconds for the initialization attempt. The default is 10. Once the specified number of seconds passes, the connection fails.

server_types.launch_remote_dpf(version=None)#

Launch a remote dpf server.

server_types.check_ansys_grpc_dpf_version(server, timeout)#

Check DPF grpc server version.

server_types.get_system_path() str#

Return the current PATH environment variable value of the system.

server_types.LOG#
server_types.DPF_DEFAULT_PORT#
server_types.LOCALHOST#
server_types.RUNNING_DOCKER#
server_types.MAX_PORT = 65535#
server_types.DpfServer#
server_types.AnyServerType#