InProcessServer#

class ansys.dpf.core.server_types.InProcessServer(ansys_path: str | None = None, as_global: bool = True, load_operators: bool = True, timeout: None = None, context: ansys.dpf.core.server_context.AvailableServerContexts = server_context.SERVER_CONTEXT)#

Bases: CServer

Server using the InProcess communication protocol.

Overview#

shutdown

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.

version

Get the version of the InProcess server.

os

Get the operating system of the InProcess server.

client

Get the client for the InProcess server.

local_server

Get whether the InProcess server is running locally.

config

Get the server configuration for the InProcess server.

available_api_types

Return available api type, always c_api.

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.

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.

context

Returns the settings used to load DPF’s plugins.

__eq__

Return true, if the ip and the port are equals.

__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 InProcessServer

Property detail#

property InProcessServer.version#

Get the version of the InProcess server.

Returns:

version – The version of the InProcess server in the format “major.minor.micro[modifier]” for servers using calendar versioning (major >= 2027), or “major.minor” for older servers.

Return type:

str

property InProcessServer.os#

Get the operating system of the InProcess server.

Returns:

os – The operating system name. For InProcess servers, it typically returns the current OS, e.g., “posix” or “nt”.

Return type:

str

property InProcessServer.client#

Get the client for the InProcess server.

Returns:

client – InProcess servers do not have a client, so this property returns None.

Return type:

None

property InProcessServer.local_server#

Get whether the InProcess server is running locally.

Returns:

local_server – True, as the InProcess server is always local.

Return type:

bool

property InProcessServer.config#

Get the server configuration for the InProcess server.

Returns:

config – The server configuration for the InProcess server from the AvailableServerConfigs.

Return type:

AvailableServerConfigs

property InProcessServer.available_api_types#

Return available api type, always c_api.

property InProcessServer.plugins: dict#

Return the list of plugins loaded on the server.

property InProcessServer.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 InProcessServer.session#

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

Return type:

ansys.dpf.core.session.Session

property InProcessServer.on_docker#

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

property InProcessServer.docker_config#

Return the docker config associated with the server.

property InProcessServer.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

Attribute detail#

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

Method detail#

InProcessServer.shutdown()#

Must be implemented by subclasses.

InProcessServer.__eq__(other_server)#

Return true, if the ip and the port are equals.

InProcessServer.get_api_for_type(capi, grpcapi)#

Return api for type.

InProcessServer.__del__()#

Clean up resources associated with the instance.

Raises:

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

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

InProcessServer.has_client()#

Check if server has a connected client.

InProcessServer.release()#

Clear the available Operators and Releases licenses when necessary.

Notes

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

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

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

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

InProcessServer.__str__()#

Return string representation of the instance.

InProcessServer.__ne__(other_server)#

Return true, if the servers are not equal.