CServer#

class ansys.dpf.core.server_types.CServer(ansys_path=None, load_operators=True)#

Bases: BaseServer, abc.ABC

Abstract class for servers going through the DPFClientAPI.

Overview#

shutdown

Must be implemented by subclasses.

__eq__

Must be implemented by subclasses.

get_api_for_type

Return api for type.

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.

available_api_types

Return available api type, always c_api.

client

Must be implemented by subclasses.

version

Must be implemented by subclasses.

plugins

Return the list of plugins loaded on the server.

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.

__del__

Clean up resources associated with the instance.

__str__

Return string representation of the instance.

__ne__

Return true, if the servers are not equal.

Import detail#

from ansys.dpf.core.server_types import CServer

Property detail#

property CServer.available_api_types#

Return available api type, always c_api.

abstract property CServer.client#

Must be implemented by subclasses.

abstract property CServer.version#

Must be implemented by subclasses.

property CServer.plugins: dict#

Return the list of plugins loaded on the server.

property CServer.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 CServer.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 CServer.os#

Get the operating system of the server.

Returns:

os – “nt” or “posix”

Return type:

str

property CServer.on_docker#

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

property CServer.docker_config#

Return the docker config associated with the server.

abstract property CServer.config#

Must be implemented by subclasses.

property CServer.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 CServer.local_server: bool#
Abstractmethod:

Must be implemented by subclasses.

Attribute detail#

CServer.ansys_path = None#
CServer.__hash__ = None#
CServer.__slots__ = ()#

Method detail#

CServer.get_api_for_type(capi, grpcapi)#

Return api for type.

CServer.__del__()#

Clean up resources associated with the instance.

Raises:

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

CServer.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.

CServer.has_client()#

Check if server has a connected client.

abstractmethod CServer.shutdown()#

Must be implemented by subclasses.

CServer.release()#

Clear the available Operators and Releases licenses when necessary.

Notes

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

CServer.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).

CServer.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

CServer.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

CServer.__str__()#

Return string representation of the instance.

abstractmethod CServer.__eq__(other_server)#

Must be implemented by subclasses.

CServer.__ne__(other_server)#

Return true, if the servers are not equal.