The launcher.py
module#
Summary#
Start the |
|
Start the Geometry service remotely using the PIM API. |
|
Start the Geometry service locally using Docker. |
|
Start Ansys Discovery remotely using the PIM API. |
|
Start the Geometry service remotely using the PIM API. |
|
Start Ansys SpaceClaim remotely using the PIM API. |
|
Start the Geometry service locally using the |
|
Start Ansys Discovery locally using the |
|
Start Ansys SpaceClaim locally using the |
Description#
Module for connecting to instances of the Geometry service.
Module detail#
- launcher.launch_modeler(mode: str = None, **kwargs: dict | None) ansys.geometry.core.modeler.Modeler #
Start the
Modeler
interface for PyAnsys Geometry.- Parameters:
- mode
str
, default:None
Mode in which to launch the
Modeler
service. The default isNone
, in which case the method tries to determine the mode automatically. The possible values are:"pypim"
: Launches theModeler
service remotely using the PIM API."docker"
: Launches theModeler
service locally using Docker."geometry_service"
: Launches theModeler
service locally using the Ansys Geometry Service."spaceclaim"
: Launches theModeler
service locally using Ansys SpaceClaim."discovery"
: Launches theModeler
service locally using Ansys Discovery.
- **kwargs
dict
, default:None
Keyword arguments for the launching methods. For allowable keyword arguments, see the corresponding methods for each mode:
For
"pypim"
mode, see thelaunch_remote_modeler()
method.For
"docker"
mode, see thelaunch_docker_modeler()
method.For
"geometry_service"
mode, see thelaunch_modeler_with_geometry_service()
method.For
"spaceclaim"
mode, see thelaunch_modeler_with_spaceclaim()
method.For
"discovery"
mode, see thelaunch_modeler_with_discovery()
method.
- mode
- Returns:
ansys.geometry.core.modeler.Modeler
Pythonic interface for geometry modeling.
Examples
Launch the Geometry service.
>>> from ansys.geometry.core import launch_modeler >>> modeler = launch_modeler()
- launcher.launch_remote_modeler(platform: str = 'windows', version: str | None = None, client_log_level: int = logging.INFO, client_log_file: str | None = None, **kwargs: dict | None) ansys.geometry.core.modeler.Modeler #
Start the Geometry service remotely using the PIM API.
When calling this method, you must ensure that you are in an environment where PyPIM is configured. You can use the
pypim.is_configured
method to check if it is configured.- Parameters:
- platform
str
, default:None
Specific for Ansys Lab. The platform option for the Geometry service. The default is
"windows"
. This parameter is used to specify the operating system on which the Geometry service will run. The possible values are:"windows"
: The Geometry service runs on a Windows machine."linux"
: The Geometry service runs on a Linux machine.
- version
str
, default:None
Version of the Geometry service to run in the three-digit format. For example, “241”. If you do not specify the version, the server chooses the version.
- client_log_level
int
, default:logging.INFO
Log level for the client. The default is
logging.INFO
.- client_log_file
str
, default:None
Path to the log file for the client. The default is
None
, in which case the client logs to the console.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- platform
- Returns:
ansys.geometry.core.modeler.Modeler
Instance of the Geometry service.
- launcher.launch_docker_modeler(port: int = DEFAULT_PORT, connect_to_existing_service: bool = True, restart_if_existing_service: bool = False, name: str | None = None, image: ansys.geometry.core.connection.docker_instance.GeometryContainers | None = None, client_log_level: int = logging.INFO, client_log_file: str | None = None, **kwargs: dict | None) ansys.geometry.core.modeler.Modeler #
Start the Geometry service locally using Docker.
When calling this method, a Geometry service (as a local Docker container) is started. By default, if a container with the Geometry service already exists at the given port, it connects to it. Otherwise, it tries to launch its own service.
- Parameters:
- port
int
,optional
Localhost port to deploy the Geometry service on or the the
Modeler
interface to connect to (if it is already deployed). By default, the value is the one for theDEFAULT_PORT
connection parameter.- connect_to_existing_servicebool, default:
True
Whether the
Modeler
interface should connect to a Geometry service already deployed at the specified port.- restart_if_existing_servicebool, default:
False
Whether the Geometry service (which is already running) should be restarted when attempting connection.
- name
str
, default:None
Name of the Docker container to deploy. The default is
None
, in which case Docker assigns it a random name.- image
GeometryContainers
, default:None
The Geometry service Docker image to deploy. The default is
None
, in which case theLocalDockerInstance
class identifies the OS of your Docker engine and deploys the latest version of the Geometry service for that OS.- client_log_level
int
, default:logging.INFO
Log level for the client. The default is
logging.INFO
.- client_log_file
str
, default:None
Path to the log file for the client. The default is
None
, in which case the client logs to the console.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- port
- Returns:
Modeler
Instance of the Geometry service.
- launcher.launch_modeler_with_discovery_and_pimlight(version: str | None = None, client_log_level: int = logging.INFO, client_log_file: str | None = None, **kwargs: dict | None) ansys.geometry.core.modeler.Modeler #
Start Ansys Discovery remotely using the PIM API.
When calling this method, you must ensure that you are in an environment where PyPIM is configured. You can use the
pypim.is_configured
method to check if it is configured.- Parameters:
- version
str
, default:None
Version of Discovery to run in the three-digit format. For example, “241”. If you do not specify the version, the server chooses the version.
- client_log_level
int
, default:logging.INFO
Log level for the client. The default is
logging.INFO
.- client_log_file
str
, default:None
Path to the log file for the client. The default is
None
, in which case the client logs to the console.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- version
- Returns:
ansys.geometry.core.modeler.Modeler
Instance of Modeler.
- launcher.launch_modeler_with_geometry_service_and_pimlight(version: str | None = None, client_log_level: int = logging.INFO, client_log_file: str | None = None, **kwargs: dict | None) ansys.geometry.core.modeler.Modeler #
Start the Geometry service remotely using the PIM API.
When calling this method, you must ensure that you are in an environment where PyPIM is configured. You can use the
pypim.is_configured
method to check if it is configured.- Parameters:
- version
str
, default:None
Version of the Geometry service to run in the three-digit format. For example, “241”. If you do not specify the version, the server chooses the version.
- client_log_level
int
, default:logging.INFO
Log level for the client. The default is
logging.INFO
.- client_log_file
str
, default:None
Path to the log file for the client. The default is
None
, in which case the client logs to the console.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- version
- Returns:
ansys.geometry.core.modeler.Modeler
Instance of Modeler.
- launcher.launch_modeler_with_spaceclaim_and_pimlight(version: str | None = None, client_log_level: int = logging.INFO, client_log_file: str | None = None, **kwargs: dict | None) ansys.geometry.core.modeler.Modeler #
Start Ansys SpaceClaim remotely using the PIM API.
When calling this method, you must ensure that you are in an environment where PyPIM is configured. You can use the
pypim.is_configured
method to check if it is configured.- Parameters:
- version
str
, default:None
Version of SpaceClaim to run in the three-digit format. For example, “241”. If you do not specify the version, the server chooses the version.
- client_log_level
int
, default:logging.INFO
Log level for the client. The default is
logging.INFO
.- client_log_file
str
, default:None
Path to the log file for the client. The default is
None
, in which case the client logs to the console.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- version
- Returns:
ansys.geometry.core.modeler.Modeler
Instance of Modeler.
- launcher.launch_modeler_with_geometry_service(product_version: int = None, host: str = 'localhost', port: int = None, enable_trace: bool = False, timeout: int = 60, server_log_level: int = 2, client_log_level: int = logging.INFO, server_logs_folder: str = None, client_log_file: str = None, log_level: int = None, logs_folder: str = None, **kwargs: dict | None) ansys.geometry.core.modeler.Modeler #
Start the Geometry service locally using the
ProductInstance
class.When calling this method, a standalone Geometry service is started. By default, if an endpoint is specified (by defining host and port parameters) but the endpoint is not available, the startup will fail. Otherwise, it will try to launch its own service.
- Parameters:
- product_version: int, optional
The product version to be started. Goes from v24.1 to the latest. Default is
None
. If a specific product version is requested but not installed locally, a SystemError will be raised.Ansys products versions and their corresponding int values:
241
: Ansys 24R1242
: Ansys 24R2
- host: str, optional
IP address at which the Geometry service will be deployed. By default, its value will be
localhost
.- port
int
,optional
Port at which the Geometry service will be deployed. By default, its value will be
None
.- enable_tracebool,
optional
Boolean enabling the logs trace on the Geometry service console window. By default its value is
False
.- timeout
int
,optional
Timeout for starting the backend startup process. The default is 60.
- server_log_level
int
,optional
- Backend’s log level from 0 to 3:
0: Chatterbox 1: Debug 2: Warning 3: Error
The default is
2
(Warning).- client_log_level
int
,optional
Logging level to apply to the client. By default, INFO level is used. Use the logging module’s levels: DEBUG, INFO, WARNING, ERROR, CRITICAL.
- server_logs_folder
str
,optional
Sets the backend’s logs folder path. If nothing is defined, the backend will use its default path.
- client_log_file
str
,optional
Sets the client’s log file path. If nothing is defined, the client will log to the console.
- log_level
int
,optional
DEPRECATED. Use
server_log_level
instead.- logs_folder
str
,optional
DEPRECATED. Use
server_logs_folder
instead.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- Returns:
Modeler
Instance of the Geometry service.
- Raises:
ConnectionError
If the specified endpoint is already in use, a connection error will be raised.
SystemError
If there is not an Ansys product 24.1 version or later installed a SystemError will be raised.
Examples
Starting a geometry service with the default parameters and getting back a
Modeler
object:>>> from ansys.geometry.core import launch_modeler_with_geometry_service >>> modeler = launch_modeler_with_geometry_service()
Starting a geometry service, on address
10.171.22.44
, port5001
, with chatty logs, traces enabled and a300
seconds timeout:>>> from ansys.geometry.core import launch_modeler_with_geometry_service >>> modeler = launch_modeler_with_geometry_service(host="10.171.22.44", port=5001, enable_trace= True, timeout=300, server_log_level=0)
- launcher.launch_modeler_with_discovery(product_version: int = None, host: str = 'localhost', port: int = None, api_version: ansys.geometry.core.connection.backend.ApiVersions = ApiVersions.LATEST, timeout: int = 150, manifest_path: str = None, hidden: bool = False, server_log_level: int = 2, client_log_level: int = logging.INFO, client_log_file: str = None, log_level: int = None, **kwargs: dict | None)#
Start Ansys Discovery locally using the
ProductInstance
class.When calling this method, a standalone Discovery session is started. By default, if an endpoint is specified (by defining host and port parameters) but the endpoint is not available, the startup will fail. Otherwise, it will try to launch its own service.
- Parameters:
- product_version: int, optional
The product version to be started. Goes from v24.1 to the latest. Default is
None
. If a specific product version is requested but not installed locally, a SystemError will be raised.Ansys products versions and their corresponding int values:
241
: Ansys 24R1242
: Ansys 24R2
- host: str, optional
IP address at which the Discovery session will be deployed. By default, its value will be
localhost
.- port
int
,optional
Port at which the Geometry service will be deployed. By default, its value will be
None
.- api_version: ApiVersions, optional
The backend’s API version to be used at runtime. Goes from API v21 to the latest. Default is
ApiVersions.LATEST
.- timeout
int
,optional
Timeout for starting the backend startup process. The default is 150.
- manifest_path
str
,optional
Used to specify a manifest file path for the ApiServerAddin. This way, it is possible to run an ApiServerAddin from a version an older product version.
- hidden
starts
the
product
hiding
its
UI.Default
is
False
. - server_log_level
int
,optional
- Backend’s log level from 0 to 3:
0: Chatterbox 1: Debug 2: Warning 3: Error
The default is
2
(Warning).- client_log_level
int
,optional
Logging level to apply to the client. By default, INFO level is used. Use the logging module’s levels: DEBUG, INFO, WARNING, ERROR, CRITICAL.
- client_log_file
str
,optional
Sets the client’s log file path. If nothing is defined, the client will log to the console.
- log_level
int
,optional
DEPRECATED. Use
server_log_level
instead.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- Returns:
Modeler
Instance of the Geometry service.
- Raises:
ConnectionError
If the specified endpoint is already in use, a connection error will be raised.
- SystemError:
If there is not an Ansys product 24.1 version or later installed or if a specific product’s version is requested but not installed locally then a SystemError will be raised.
Examples
Starting an Ansys Discovery session with the default parameters and getting back a
Modeler
object:>>> from ansys.geometry.core import launch_modeler_with_discovery >>> modeler = launch_modeler_with_discovery()
Starting an Ansys Discovery V 24.1 session, on address
10.171.22.44
, port5001
, with chatty logs, using API v231 and a300
seconds timeout:>>> from ansys.geometry.core import launch_modeler_with_discovery >>> modeler = launch_modeler_with_discovery(product_version = 241, host="10.171.22.44", port=5001, api_version= 231, timeout=300, server_log_level=0)
- launcher.launch_modeler_with_spaceclaim(product_version: int = None, host: str = 'localhost', port: int = None, api_version: ansys.geometry.core.connection.backend.ApiVersions = ApiVersions.LATEST, timeout: int = 150, manifest_path: str = None, hidden: bool = False, server_log_level: int = 2, client_log_level: int = logging.INFO, client_log_file: str = None, log_level: int = None, **kwargs: dict | None)#
Start Ansys SpaceClaim locally using the
ProductInstance
class.When calling this method, a standalone SpaceClaim session is started. By default, if an endpoint is specified (by defining host and port parameters) but the endpoint is not available, the startup will fail. Otherwise, it will try to launch its own service.
- Parameters:
- product_version: int, optional
The product version to be started. Goes from v24.1 to the latest. Default is
None
. If a specific product version is requested but not installed locally, a SystemError will be raised.Ansys products versions and their corresponding int values:
241
: Ansys 24R1242
: Ansys 24R2
- host: str, optional
IP address at which the SpaceClaim session will be deployed. By default, its value will be
localhost
.- port
int
,optional
Port at which the Geometry service will be deployed. By default, its value will be
None
.- api_version: ApiVersions, optional
The backend’s API version to be used at runtime. Goes from API v21 to the latest. Default is
ApiVersions.LATEST
.- timeout
int
,optional
Timeout for starting the backend startup process. The default is 150.
- manifest_path
str
,optional
Used to specify a manifest file path for the ApiServerAddin. This way, it is possible to run an ApiServerAddin from a version an older product version.
- hidden
starts
the
product
hiding
its
UI.Default
is
False
. - server_log_level
int
,optional
- Backend’s log level from 0 to 3:
0: Chatterbox 1: Debug 2: Warning 3: Error
The default is
2
(Warning).- client_log_level
int
,optional
Logging level to apply to the client. By default, INFO level is used. Use the logging module’s levels: DEBUG, INFO, WARNING, ERROR, CRITICAL.
- client_log_file
str
,optional
Sets the client’s log file path. If nothing is defined, the client will log to the console.
- log_level
int
,optional
DEPRECATED. Use
server_log_level
instead.- **kwargs
dict
, default:None
Placeholder to prevent errors when passing additional arguments that are not compatible with this method.
- Returns:
Modeler
Instance of the Geometry service.
- Raises:
ConnectionError
If the specified endpoint is already in use, a connection error will be raised.
SystemError
If there is not an Ansys product 24.1 version or later installed or if a specific product’s version is requested but not installed locally then a SystemError will be raised.
Examples
Starting an Ansys SpaceClaim session with the default parameters and get back a
Modeler
object:>>> from ansys.geometry.core import launch_modeler_with_spaceclaim >>> modeler = launch_modeler_with_spaceclaim()
Starting an Ansys SpaceClaim V 24.1 session, on address
10.171.22.44
, port5001
, with chatty logs, using API v231 and a300
seconds timeout:>>> from ansys.geometry.core import launch_modeler_with_spaceclaim >>> modeler = launch_modeler_with_spaceclaim(product_version = 241, host="10.171.22.44", port=5001, api_version= 231, timeout=300, server_log_level=0)