From 4fc437c345e8b1c724e7959e8df06bb34248dcb0 Mon Sep 17 00:00:00 2001 From: achitwar Date: Fri, 7 Oct 2022 16:59:48 +0530 Subject: [PATCH 1/3] Added current working directory option for launch_fluent API. --- src/ansys/fluent/core/launcher/launcher.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ansys/fluent/core/launcher/launcher.py b/src/ansys/fluent/core/launcher/launcher.py index 854c7af69061..9b7f7c003497 100644 --- a/src/ansys/fluent/core/launcher/launcher.py +++ b/src/ansys/fluent/core/launcher/launcher.py @@ -428,6 +428,7 @@ def launch_fluent( server_info_filepath: str = None, password: str = None, py: bool = None, + cwd: str = None, ) -> Union[_BaseSession, Session]: """Launch Fluent locally in server mode or connect to a running Fluent server instance. @@ -506,6 +507,10 @@ def launch_fluent( Passes ``"-py"`` as an additional_argument to launch fluent in python mode. The default is ``None``. + cwd: str, Optional + Path to specify current working direcotory to launch fluent from the defined directory as + current working directory. + Returns ------- ansys.fluent.session.Session @@ -536,6 +541,7 @@ def launch_fluent( if mode != LaunchModes.SOLVER_ICING: env["APP_LAUNCHED_FROM_CLIENT"] = "1" # disables flserver datamodel kwargs = _get_subprocess_kwargs_for_fluent(env) + kwargs.update(cwd = cwd) subprocess.Popen(launch_string, **kwargs) _await_fluent_launch(server_info_filepath, start_timeout, sifile_last_mtime) From 6360a487574a66b1b36b86d1749b0c88e1267c47 Mon Sep 17 00:00:00 2001 From: achitwar Date: Fri, 7 Oct 2022 19:54:05 +0530 Subject: [PATCH 2/3] Updated the docstring based on pre-commit checks --- src/ansys/fluent/core/launcher/launcher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ansys/fluent/core/launcher/launcher.py b/src/ansys/fluent/core/launcher/launcher.py index 9b7f7c003497..2f21af0518a7 100644 --- a/src/ansys/fluent/core/launcher/launcher.py +++ b/src/ansys/fluent/core/launcher/launcher.py @@ -508,8 +508,8 @@ def launch_fluent( The default is ``None``. cwd: str, Optional - Path to specify current working direcotory to launch fluent from the defined directory as - current working directory. + Path to specify current working directory to launch fluent from the defined directory as + current working directory. Returns ------- @@ -541,7 +541,7 @@ def launch_fluent( if mode != LaunchModes.SOLVER_ICING: env["APP_LAUNCHED_FROM_CLIENT"] = "1" # disables flserver datamodel kwargs = _get_subprocess_kwargs_for_fluent(env) - kwargs.update(cwd = cwd) + kwargs.update(cwd=cwd) subprocess.Popen(launch_string, **kwargs) _await_fluent_launch(server_info_filepath, start_timeout, sifile_last_mtime) From e1f93f51b3e2c62d958710412dbba7ea651c984a Mon Sep 17 00:00:00 2001 From: Abhishek Chitwar <99339845+abhishekchitwar@users.noreply.github.com> Date: Mon, 10 Oct 2022 13:59:06 +0530 Subject: [PATCH 3/3] Update src/ansys/fluent/core/launcher/launcher.py Updated the suggestion. Co-authored-by: Mainak Kundu <94432368+mkundu1@users.noreply.github.com> --- src/ansys/fluent/core/launcher/launcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ansys/fluent/core/launcher/launcher.py b/src/ansys/fluent/core/launcher/launcher.py index 2f21af0518a7..d9b37d2ad3cb 100644 --- a/src/ansys/fluent/core/launcher/launcher.py +++ b/src/ansys/fluent/core/launcher/launcher.py @@ -541,7 +541,8 @@ def launch_fluent( if mode != LaunchModes.SOLVER_ICING: env["APP_LAUNCHED_FROM_CLIENT"] = "1" # disables flserver datamodel kwargs = _get_subprocess_kwargs_for_fluent(env) - kwargs.update(cwd=cwd) + if cwd: + kwargs.update(cwd=cwd) subprocess.Popen(launch_string, **kwargs) _await_fluent_launch(server_info_filepath, start_timeout, sifile_last_mtime)