ansys.dyna.core.pre.launcher#
Module for launching the pre service locally.
Attributes#
Classes#
Provides server thread properties. |
Functions#
|
Check the state of ports in a port range. |
|
Determine if a port is in use at a given host. |
Get the virtual environment path. |
|
|
Launch the pre service locally in gRPC mode. |
Start DYNA PRE remotely using the product instance management API. |
|
|
Start the pre service locally. |
Module Contents#
- ansys.dyna.core.pre.launcher.check_ports(port_range, ip='localhost')[source]#
Check the state of ports in a port range.
- ansys.dyna.core.pre.launcher.port_in_use(port, host=LOCALHOST)[source]#
Determine if a port is in use at a given host.
- Parameters:
- port
int
Port.
- host
- Host. The default is
LOCALHOST
, in which case"127.0.0.1"
is used.
- Host. The default is
- port
- Returns:
True
when
a
port
is
in
use
at
the
given
host
,False
otherwise.
Notes
The port must “bind” the address. Just checking if a socket can be created is insufficient because it is possible to run into permission errors like this one:
“An attempt was made to access a socket in a way forbidden by its access permissions.”
- ansys.dyna.core.pre.launcher.launch_grpc(port=DYNAPRE_DEFAULT_PORT, ip=LOCALHOST, server_path='') tuple [source]#
Launch the pre service locally in gRPC mode.
- Parameters:
- port
int
,optional
Port to launch the pre service on. The default is
DYNAPRE_DEFAULT_PORT
. The final port is the first port available after (or including) this port.- ip
str
,optional
IP address. The default is
LOCALHOST
, in which case"127.0.0.1"
is used.- server_path
str
,optional
Path to the pre service. The default is
None
.
- port
- Returns:
int
Port number that the gRPC instance started on.
- ansys.dyna.core.pre.launcher.launch_remote_dynapre(version=None, cleanup_on_exit=True) ansys.dyna.core.pre.dynasolution.DynaSolution [source]#
Start DYNA PRE remotely using the product instance management API.
When calling this method, you need to ensure that you are in an environment where PyPIM is configured. This can be verified with
pypim.is_configured
.- Parameters:
- Returns:
ansys.dyna.core.pre.DynaSolution
An instance of DynaSolution.
- class ansys.dyna.core.pre.launcher.ServerThread(threadID, port, ip, server_path)[source]#
Bases:
threading.Thread
Provides server thread properties.
- Parameters:
- threadID
- port
- ip
- server_path
- run()[source]#
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- ansys.dyna.core.pre.launcher.launch_dynapre(port=50051, ip='localhost') ansys.dyna.core.pre.dynasolution.DynaSolution [source]#
Start the pre service locally.