Skip to content

Commit

Permalink
fix: Option to clear Fluent parallel env vars (#3441)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkundu1 authored Oct 31, 2024
1 parent 0d268e9 commit de1295e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/ansys/fluent/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ def version_info() -> str:

# Whether to skip health check
CHECK_HEALTH = True

# Whether to clear environment variables related to Fluent parallel mode
CLEAR_FLUENT_PARA_ENVS = False
7 changes: 5 additions & 2 deletions src/ansys/fluent/core/launcher/launcher_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def is_windows():


def _get_subprocess_kwargs_for_fluent(env: Dict[str, Any], argvals) -> Dict[str, Any]:
from ansys.fluent.core import CLEAR_FLUENT_PARA_ENVS, INFER_REMOTING_IP

scheduler_options = argvals.get("scheduler_options")
is_slurm = scheduler_options and scheduler_options["scheduler"] == "slurm"
kwargs: Dict[str, Any] = {}
Expand All @@ -33,10 +35,11 @@ def _get_subprocess_kwargs_for_fluent(env: Dict[str, Any], argvals) -> Dict[str,
fluent_env = os.environ.copy()
fluent_env.update({k: str(v) for k, v in env.items()})
fluent_env["REMOTING_THROW_LAST_TUI_ERROR"] = "1"
if CLEAR_FLUENT_PARA_ENVS:
del fluent_env["PARA_NPROCS"]
del fluent_env["PARA_MESH_NPROCS"]

if not is_slurm:
from ansys.fluent.core import INFER_REMOTING_IP

if INFER_REMOTING_IP and not "REMOTING_SERVER_ADDRESS" in fluent_env:
remoting_ip = find_remoting_ip()
if remoting_ip:
Expand Down

0 comments on commit de1295e

Please sign in to comment.