DockerLauncher#

class ansys.pyensight.core.DockerLauncher(data_directory: str | None = None, docker_image_name: str | None = None, use_dev: bool = False, channel: Channel | None = None, pim_instance: Any | None = None, grpc_use_tcp_sockets: bool | None = False, grpc_allow_network_connections: bool | None = False, grpc_disable_tls: bool | None = False, grpc_uds_pathname: str | None = None, **kwargs)#

Creates a Session instance using a copy of EnSight hosted in a Docker container.

This class allows you to either attach to a PIM-launched Docker container hosting EnSight or launch a local Docker container hosting EnSight. gRPC connections to EnShell and EnSight are established. A PyEnSight Session instance is returned upon successful launch and connection.

Parameters:
data_directorystr, optional

Host directory to make into the container at /data. The default is None.

docker_image_namestr, optional

Name of the Docker image to use. The default is None.

use_devbool, optional

Whether to use the latest ensight_dev Docker image. The default is False. However, this value is overridden if the name of a Docker image is specified for the docker_image_name parameter.

channel

Existing gRPC channel to a running EnShell instance provided by PIM.

pim_instance

PyPIM instance if using PIM (internal). The default is None.

timeoutfloat, optional

Number of seconds to try a gRPC connection before giving up. This parameter is defined on the parent Launcher class, where the default is 120.

use_eglbool, optional

Whether to use EGL hardware for accelerated graphics. The platform must be able to support this hardware. This parameter is defined on the parent Launcher class, where the default is False.

use_sosint, optional

Number of EnSight servers to use for SOS (Server of Server) mode. This parameter is defined on the parent Launcher class, where the default is None, in which case SOS mode is not used.

additional_command_line_options: list, optional

Additional command line options to be used to launch EnSight. Arguments that contain spaces are not supported.

grpc_use_tcp_sockets

If using gRPC, and if True, then allow TCP Socket based connections instead of only local connections.

grpc_allow_network_connections

If using gRPC and using TCP Socket based connections, listen on all networks.

grpc_disable_tls

If using gRPC and using TCP Socket based connections, disable TLS.

grpc_uds_pathname

If using gRPC and using Unix Domain Socket based connections, explicitly set the pathname to the shared UDS file instead of using the default.

Examples

>>> from ansys.pyensight.core import DockerLauncher
>>> launcher = DockerLauncher(data_directory="D:\data")
>>> launcher.pull()
>>> session = launcher.start()
>>> session.close()

WARNING: Overriding the default values for these options: grpc_use_tcp_sockets, grpc_allow_network_connections, and grpc_disable_tls can possibly permit control of this computer and any data which resides on it. Modification of this configuration is not recommended. Please see the documentation for your installed product for additional information.

Methods

DockerLauncher.ansys_version()

Get the Ansys version (three-digit string) found in the Docker container.

DockerLauncher.close(session)

Shut down the launched EnSight session.

DockerLauncher.connect()

Create and bind a Session instance to the created EnSight gRPC connection started by EnShell.

DockerLauncher.enshell_log_contents()

Get the contents of the EnShell log if possible.

DockerLauncher.file_service()

Get the PIM file service object if available.

DockerLauncher.launch_webui(container_env_str)

DockerLauncher.pull()

Pull the Docker image.

DockerLauncher.start()

Start EnShell by running a local Docker EnSight image.

DockerLauncher.stop()

Release any additional resources allocated during launching.

Attributes

DockerLauncher.session_directory

Root directory for HTML files.