Skip to content

Commit

Permalink
Add argument to pass additional command line options to EnSight (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariostieriansys authored Aug 19, 2024
1 parent 30770de commit 6a7518c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/ansys/pyensight/core/dockerlauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class DockerLauncher(Launcher):
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.
Examples
--------
Expand Down Expand Up @@ -504,6 +507,9 @@ def connect(self):

vnc_url = "vnc://%%3Frfb_port=1999%%26use_auth=0"
ensight_args += " -vnc " + vnc_url
if self._additional_command_line_options:
ensight_args += " "
ensight_args += " ".join(self._additional_command_line_options)

logging.debug(f"Starting EnSight with args: {ensight_args}\n")
ret = self._enshell.start_ensight(ensight_args, ensight_env_vars)
Expand Down
7 changes: 6 additions & 1 deletion src/ansys/pyensight/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ class Launcher:
enable_rest_api : bool, optional
Whether to enable the EnSight REST API. The default is ``False``.
This parameter is supported in EnSight 2024 R1 and later.
additional_command_line_options: list, optional
Additional command line options to be used to launch EnSight.
Please note, when using DockerLauncher, arguments that contain spaces
are not supported.
"""

def __init__(
Expand All @@ -68,6 +71,7 @@ def __init__(
use_egl: bool = False,
use_sos: Optional[int] = None,
enable_rest_api: bool = False,
additional_command_line_options: Optional[List] = None,
) -> None:
self._timeout = timeout
self._use_egl_param_val: bool = use_egl
Expand All @@ -87,6 +91,7 @@ def __init__(
self._egl_env_val = False
# a dict of any optional launcher specific query parameters for URLs
self._query_parameters: Dict[str, str] = {}
self._additional_command_line_options = additional_command_line_options

@property
def session_directory(self) -> str:
Expand Down
4 changes: 4 additions & 0 deletions src/ansys/pyensight/core/locallauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class LocalLauncher(Launcher):
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.
Examples
--------
Expand Down Expand Up @@ -154,6 +156,8 @@ def start(self) -> "pyensight.Session":
vnc_url = f"vnc://%%3Frfb_port={self._ports[1]}%%26use_auth=0"
cmd.extend(["-vnc", vnc_url])
cmd.extend(["-ports", str(self._ports[4])])
if self._additional_command_line_options:
cmd.extend(self._additional_command_line_options)

use_egl = self._use_egl()

Expand Down

0 comments on commit 6a7518c

Please sign in to comment.