The server_factory.py module#

Summary#

CommunicationProtocols

Defines available communication protocols.

DockerConfig

Manage DPF Docker configuration and communication.

ServerConfig

Provides an instance of ServerConfig object to manage the server type used.

AvailableServerConfigs

Define available server configurations.

RunningDockerConfig

Holds all the configuration options and the process information of a running Docker image of a DPF server.

ServerFactory

Factory for server type choice depending on current configuration.

get_default_server_config

Return the default configuration depending on the server version.

get_default_remote_server_config

Return the default configuration for gRPC communication.

create_default_docker_config

Return a docker configuration instance.

Description#

Server factory, server configuration and communication protocols.

Contains the server factory as well as the communication protocols and server configurations available.

Module detail#

server_factory.get_default_server_config(server_lower_than_or_equal_to_0_3: bool = False, docker_config: DockerConfig = None)#

Return the default configuration depending on the server version.

  • if ansys.dpf.core.SERVER_CONFIGURATION is not None, then this variable is taken

  • if server_lower_than_or_equal_to_0_3 is True, then LegacyGrpcServer is taken

  • if DPF_SERVER_TYPE environment variable is set to INPROCESS, GRPC, or LEGACYGRPC, then this variable is taken

  • else DEFAULT_COMMUNICATION_PROTOCOL and DEFAULT_LEGACY are used.

Raises:

If DPF_SERVER_TYPE environment variable is set to unknown value.

server_factory.get_default_remote_server_config()#

Return the default configuration for gRPC communication.

Follows get_default_server_config

Raises:

If DPF_SERVER_TYPE environment variable is set to unknown value.

server_factory.create_default_docker_config() DockerConfig#

Return a docker configuration instance.

server_factory.DEFAULT_COMMUNICATION_PROTOCOL#
server_factory.DEFAULT_LEGACY = False#