diff --git a/src/ansys/fluent/core/fluent_connection.py b/src/ansys/fluent/core/fluent_connection.py index 654f2abc6bf..3e33788e82b 100644 --- a/src/ansys/fluent/core/fluent_connection.py +++ b/src/ansys/fluent/core/fluent_connection.py @@ -9,7 +9,7 @@ import socket import subprocess import threading -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import Callable, List, Optional, Tuple, Union import warnings import weakref @@ -225,7 +225,7 @@ def __init__( channel: Optional[grpc.Channel] = None, cleanup_on_exit: bool = True, remote_instance: Optional[Instance] = None, - launcher_args: Optional[Dict[str, Any]] = None, + slurm_job_id: Optional[str] = None, inside_container: Optional[bool] = None, ): """Initialize a Session. @@ -299,7 +299,7 @@ def __init__( # throws, we should not proceed. self.health_check_service.check_health() - self._slurm_job_id = launcher_args and launcher_args.get("slurm_job_id") + self._slurm_job_id = slurm_job_id self._id = f"session-{next(FluentConnection._id_iter)}" @@ -365,7 +365,6 @@ def __init__( ) self._remote_instance = remote_instance - self.launcher_args = launcher_args self._exit_event = threading.Event() diff --git a/src/ansys/fluent/core/launcher/container_launcher.py b/src/ansys/fluent/core/launcher/container_launcher.py index 805e159d22c..9ec41012d4c 100644 --- a/src/ansys/fluent/core/launcher/container_launcher.py +++ b/src/ansys/fluent/core/launcher/container_launcher.py @@ -227,7 +227,7 @@ def __call__(self): port=port, password=password, cleanup_on_exit=self.cleanup_on_exit, - launcher_args=self.argvals, + slurm_job_id=self.argvals and self.argvals.get("slurm_job_id"), inside_container=True, ), file_transfer_service=self.file_transfer_service, diff --git a/src/ansys/fluent/core/launcher/pim_launcher.py b/src/ansys/fluent/core/launcher/pim_launcher.py index 93392a22d7f..680f3c03676 100644 --- a/src/ansys/fluent/core/launcher/pim_launcher.py +++ b/src/ansys/fluent/core/launcher/pim_launcher.py @@ -292,7 +292,7 @@ def launch_remote_fluent( channel=channel, cleanup_on_exit=cleanup_on_exit, remote_instance=instance, - launcher_args=launcher_args, + slurm_job_id=launcher_args and launcher_args.get("slurm_job_id"), ) file_transfer_service = ( diff --git a/src/ansys/fluent/core/launcher/watchdog_exec b/src/ansys/fluent/core/launcher/watchdog_exec index b85fb4eb83b..34595104524 100644 --- a/src/ansys/fluent/core/launcher/watchdog_exec +++ b/src/ansys/fluent/core/launcher/watchdog_exec @@ -74,7 +74,7 @@ if __name__ == "__main__": "ip": ip, "port": int(port), "password": password, - "launcher_args": None, + "slurm_job_id": None, "cleanup_on_exit": True, } diff --git a/src/ansys/fluent/core/session.py b/src/ansys/fluent/core/session.py index f9323be0aac..687333d743a 100644 --- a/src/ansys/fluent/core/session.py +++ b/src/ansys/fluent/core/session.py @@ -3,7 +3,7 @@ import importlib import json import logging -from typing import Any, Optional, Union +from typing import Any, Dict, Optional, Union import warnings from ansys.fluent.core.fluent_connection import FluentConnection @@ -94,6 +94,7 @@ def __init__( fluent_connection: FluentConnection, file_transfer_service: Optional[Any] = None, start_transcript: bool = True, + launcher_args: Optional[Dict[str, Any]] = None, ): """BaseSession. @@ -109,6 +110,7 @@ def __init__( subsequently via method calls on the Session object. """ self._start_transcript = start_transcript + self._launcher_args = launcher_args BaseSession.build_from_fluent_connection( self, fluent_connection, file_transfer_service ) @@ -270,6 +272,7 @@ def _create_from_server_info_file( server_info_file_name: str, file_transfer_service: Optional[Any] = None, start_transcript: bool = True, + launcher_args: Optional[Dict[str, Any]] = None, **connection_kwargs, ): """Create a Session instance from server-info file. @@ -302,6 +305,7 @@ def _create_from_server_info_file( ), file_transfer_service=file_transfer_service, start_transcript=start_transcript, + launcher_args=launcher_args, ) return session diff --git a/src/ansys/fluent/core/session_meshing.py b/src/ansys/fluent/core/session_meshing.py index f9394de1868..27c36bd823c 100644 --- a/src/ansys/fluent/core/session_meshing.py +++ b/src/ansys/fluent/core/session_meshing.py @@ -1,6 +1,6 @@ """Module containing class encapsulating Fluent connection.""" -from typing import Any, Optional +from typing import Any, Dict, Optional from ansys.fluent.core.fluent_connection import FluentConnection from ansys.fluent.core.session_pure_meshing import PureMeshing @@ -22,6 +22,7 @@ def __init__( fluent_connection: FluentConnection, file_transfer_service: Optional[Any] = None, start_transcript: bool = True, + launcher_args: Optional[Dict[str, Any]] = None, ): """Meshing session. @@ -33,6 +34,7 @@ def __init__( fluent_connection=fluent_connection, file_transfer_service=file_transfer_service, start_transcript=start_transcript, + launcher_args=launcher_args, ) self.switch_to_solver = lambda: self._switch_to_solver() self.switched = False diff --git a/src/ansys/fluent/core/session_pure_meshing.py b/src/ansys/fluent/core/session_pure_meshing.py index e67ee4a3d39..437aa1c3430 100644 --- a/src/ansys/fluent/core/session_pure_meshing.py +++ b/src/ansys/fluent/core/session_pure_meshing.py @@ -1,7 +1,7 @@ """Module containing class encapsulating Fluent connection.""" import functools -from typing import Any, Optional +from typing import Any, Dict, Optional import ansys.fluent.core as pyfluent from ansys.fluent.core.data_model_cache import DataModelCache, NameKey @@ -32,6 +32,7 @@ def __init__( fluent_connection: FluentConnection, file_transfer_service: Optional[Any] = None, start_transcript: bool = True, + launcher_args: Optional[Dict[str, Any]] = None, ): """PureMeshing session. @@ -43,6 +44,7 @@ def __init__( fluent_connection=fluent_connection, file_transfer_service=file_transfer_service, start_transcript=start_transcript, + launcher_args=launcher_args, ) self._base_meshing = BaseMeshing( self.execute_tui, diff --git a/src/ansys/fluent/core/session_solver.py b/src/ansys/fluent/core/session_solver.py index b513023eb14..743c39f7f34 100644 --- a/src/ansys/fluent/core/session_solver.py +++ b/src/ansys/fluent/core/session_solver.py @@ -5,7 +5,7 @@ import importlib import logging import threading -from typing import Any, Optional +from typing import Any, Dict, Optional import warnings from ansys.fluent.core.services import service_creator @@ -78,6 +78,7 @@ def __init__( fluent_connection, file_transfer_service: Optional[Any] = None, start_transcript: bool = True, + launcher_args: Optional[Dict[str, Any]] = None, ): """Solver session. @@ -89,6 +90,7 @@ def __init__( fluent_connection=fluent_connection, file_transfer_service=file_transfer_service, start_transcript=start_transcript, + launcher_args=launcher_args, ) self._build_from_fluent_connection(fluent_connection) @@ -252,7 +254,7 @@ def read_case_lightweight(self, file_name: str): import ansys.fluent.core as pyfluent self.file.read(file_type="case", file_name=file_name, lightweight_setup=True) - launcher_args = dict(self._fluent_connection.launcher_args) + launcher_args = dict(self._launcher_args) launcher_args.pop("lightweight_mode", None) launcher_args["case_file_name"] = file_name fut: Future = asynchronous(pyfluent.launch_fluent)(**launcher_args) diff --git a/src/ansys/fluent/core/session_solver_icing.py b/src/ansys/fluent/core/session_solver_icing.py index 05453fbdb01..13a51ee4ccd 100644 --- a/src/ansys/fluent/core/session_solver_icing.py +++ b/src/ansys/fluent/core/session_solver_icing.py @@ -4,7 +4,7 @@ """ import importlib -from typing import Any, Optional +from typing import Any, Dict, Optional from ansys.fluent.core.fluent_connection import FluentConnection from ansys.fluent.core.session_solver import Solver @@ -22,6 +22,7 @@ def __init__( fluent_connection: FluentConnection, file_transfer_service: Optional[Any] = None, start_transcript: bool = True, + launcher_args: Optional[Dict[str, Any]] = None, ): """SolverIcing session. @@ -33,6 +34,7 @@ def __init__( fluent_connection=fluent_connection, file_transfer_service=file_transfer_service, start_transcript=start_transcript, + launcher_args=launcher_args, ) self._flserver_root = None self._fluent_version = None diff --git a/src/ansys/fluent/core/session_solver_lite.py b/src/ansys/fluent/core/session_solver_lite.py index f3813c2ab7d..c17d8af03ef 100644 --- a/src/ansys/fluent/core/session_solver_lite.py +++ b/src/ansys/fluent/core/session_solver_lite.py @@ -3,6 +3,8 @@ **********PRESENTLY SAME AS SOLVER WITH A SWITCH TO SOLVER*********** """ +from typing import Any, Dict, Optional + from ansys.fluent.core.session_solver import Solver @@ -15,6 +17,7 @@ def __init__( self, fluent_connection=None, start_transcript: bool = True, + launcher_args: Optional[Dict[str, Any]] = None, ): """SolverLite session. @@ -24,6 +27,7 @@ def __init__( super().__init__( fluent_connection=fluent_connection, start_transcript=start_transcript, + launcher_args=launcher_args, ) self._tui_service = self.datamodel_service_tui self._settings_service = self.settings_service