BaseServer#

class ansys.dpf.core.server_types.BaseServer#

Bases: abc.ABC

Abstract class for servers.

Overview#

get_api_for_type

Must be implemented by subclasses.

shutdown

Must be implemented by subclasses.

__eq__

Must be implemented by subclasses.

set_as_global

Set the current server as global if necessary.

has_client

Check if server has a connected client.

release

Clear the available Operators and Releases licenses when necessary.

apply_context

Define the settings that will be used to load DPF’s plugins.

check_version

Check if the server version matches with a required version.

meet_version

Check if the server version matches with a required version.

client

Must be implemented by subclasses.

version

Must be implemented by subclasses.

plugins

Return the list of plugins loaded on the server.

available_api_types

Must be implemented by subclasses.

info

Server information.

session

Plan event callbacks from the server, such as progress bars during workflow execution and logging.

os

Get the operating system of the server.

on_docker

Whether the DPF server should be started in a Docker Container by default.

docker_config

Return the docker config associated with the server.

config

Must be implemented by subclasses.

context

Returns the settings used to load DPF’s plugins.

local_server

Must be implemented by subclasses.

__str__

Return string representation of the instance.

__ne__

Return true, if the servers are not equal.

__del__

Clean up resources associated with the instance.

Import detail#

from ansys.dpf.core.server_types import BaseServer

Property detail#

abstract property BaseServer.client#

Must be implemented by subclasses.

abstract property BaseServer.version#

Must be implemented by subclasses.

property BaseServer.plugins: dict#

Return the list of plugins loaded on the server.

abstract property BaseServer.available_api_types#

Must be implemented by subclasses.

property BaseServer.info#

Server information.

Returns:

info – Dictionary with server information, including "server_ip", "server_port", "server_process_id", "server_version" , "os" and "path" keys.

Return type:

dictionary

property BaseServer.session#

Plan event callbacks from the server, such as progress bars during workflow execution and logging.

Return type:

ansys.dpf.core.session.Session

abstract property BaseServer.os#

Get the operating system of the server.

Returns:

os – “nt” or “posix”

Return type:

str

property BaseServer.on_docker#

Whether the DPF server should be started in a Docker Container by default.

property BaseServer.docker_config#

Return the docker config associated with the server.

abstract property BaseServer.config#

Must be implemented by subclasses.

property BaseServer.context#

Returns the settings used to load DPF’s plugins.

To update the context server side, use ansys.dpf.core.BaseServer.server_types.apply_context()

Return type:

ServerContext

property BaseServer.local_server: bool#
Abstractmethod:

Must be implemented by subclasses.

Attribute detail#

BaseServer.__slots__ = ()#

Method detail#

BaseServer.set_as_global(as_global=True)#

Set the current server as global if necessary.

Parameters:

as_global (bool, optional) – Global variable that stores the IP address and port for the DPF module. All DPF objects created in this Python session will use this IP and port. The default is True.

BaseServer.has_client()#

Check if server has a connected client.

abstractmethod BaseServer.get_api_for_type(capi, grpcapi)#

Must be implemented by subclasses.

abstractmethod BaseServer.shutdown()#

Must be implemented by subclasses.

BaseServer.release()#

Clear the available Operators and Releases licenses when necessary.

Notes

Available with server’s version starting at 6.0 (Ansys 2023R2).

BaseServer.apply_context(context)#

Define the settings that will be used to load DPF’s plugins.

A DPF xml file can be used to list the plugins and set up variables.

Parameters:

context (ServerContext) – The context allows to choose which capabilities are available server side.

Notes

Available with server’s version starting at 6.0 (Ansys 2023R2).

BaseServer.check_version(required_version, msg=None)#

Check if the server version matches with a required version.

Parameters:
  • required_version (str) – Required version to compare with the server version.

  • msg (str, optional) – Message for the raised exception if version requirements do not match.

:raises dpf_errors : errors: errors.DpfVersionNotSupported is raised if failure.

Returns:

True if the server version meets the requirement.

Return type:

bool

BaseServer.meet_version(required_version)#

Check if the server version matches with a required version.

Parameters:

required_version (str) – Required version to compare with the server version.

Returns:

True if the server version meets the requirement.

Return type:

bool

BaseServer.__str__()#

Return string representation of the instance.

abstractmethod BaseServer.__eq__(other_server)#

Must be implemented by subclasses.

BaseServer.__ne__(other_server)#

Return true, if the servers are not equal.

BaseServer.__del__()#

Clean up resources associated with the instance.

Raises:

Warning – If an exception occurs while attempting to delete resources.