LocalServer#

class LocalServer#

Provides startup utilities for a local Additive server.

Overview#

launch

Launch a local gRPC server for the Additive service.

find_open_port

Find an open port on the local host.

Import detail#

from ansys.additive.core.server_connection.local_server import LocalServer

Method detail#

static LocalServer.launch(port: int, cwd: str = USER_DATA_PATH, product_version: str = DEFAULT_PRODUCT_VERSION) subprocess.Popen#

Launch a local gRPC server for the Additive service.

Parameters:
port: int

Port number to use for gRPC connections.

cwd: str

Current working directory to use for the server process.

product_version: str

Version of the Ansys installation to use, of the form "YYR", where YY is the two digit year and R is the release for that year. For example, Ansys 2024 R1 would be "241".

Returns:
process: subprocess.Popen

Server process. To stop the server, call the kill() method on the returned object.

static LocalServer.find_open_port() int#

Find an open port on the local host.

Returns:
port: int

Open port number.

Note

This port may be taken by the time you try to use it.