From 9483f016f63ed9980ab8e9965b9ca2df4a860570 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 10 Sep 2024 13:03:47 +0200 Subject: [PATCH 1/4] Switch executable when using conda --- executorlib/shared/executor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/executorlib/shared/executor.py b/executorlib/shared/executor.py index b967a218..b7d8c95f 100644 --- a/executorlib/shared/executor.py +++ b/executorlib/shared/executor.py @@ -13,6 +13,7 @@ from typing import Callable, List, Optional import cloudpickle +from pylammpsmpi.mpi.lmpmpi import commands_list from executorlib.shared.communication import interface_bootup from executorlib.shared.inputcheck import ( @@ -329,6 +330,7 @@ def execute_parallel_tasks( interface = interface_bootup( command_lst=_get_backend_path( cores=cores, + conda=prefix_name is not None or prefix_path is not None, ), connections=spawner(cores=cores, **kwargs), hostname_localhost=hostname_localhost, @@ -486,6 +488,7 @@ def get_command_path(executable: str) -> str: def _get_backend_path( cores: int, + conda: bool = False, ) -> list: """ Get command to call backend as a list of two strings @@ -496,7 +499,10 @@ def _get_backend_path( Returns: list[str]: List of strings containing the python executable path and the backend script to execute """ - command_lst = [sys.executable] + if not conda: + command_lst = [sys.executable] + else: + commands_lst = ["python"] if cores > 1 and importlib.util.find_spec("mpi4py") is not None: command_lst += [get_command_path(executable="interactive_parallel.py")] elif cores > 1: From 3e5a44767eb309eae3d4c97f6a1414d2c0917e7c Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 10 Sep 2024 13:05:32 +0200 Subject: [PATCH 2/4] Update executor.py --- executorlib/shared/executor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/executorlib/shared/executor.py b/executorlib/shared/executor.py index b7d8c95f..1c70ba17 100644 --- a/executorlib/shared/executor.py +++ b/executorlib/shared/executor.py @@ -13,7 +13,6 @@ from typing import Callable, List, Optional import cloudpickle -from pylammpsmpi.mpi.lmpmpi import commands_list from executorlib.shared.communication import interface_bootup from executorlib.shared.inputcheck import ( From 5cafcb49de13e8f7eee6eefe327251435e2052f0 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 10 Sep 2024 13:16:35 +0200 Subject: [PATCH 3/4] fix variable names --- executorlib/shared/executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executorlib/shared/executor.py b/executorlib/shared/executor.py index 1c70ba17..b91417d1 100644 --- a/executorlib/shared/executor.py +++ b/executorlib/shared/executor.py @@ -329,7 +329,7 @@ def execute_parallel_tasks( interface = interface_bootup( command_lst=_get_backend_path( cores=cores, - conda=prefix_name is not None or prefix_path is not None, + conda=conda_environment_name is not None or conda_environment_path is not None, ), connections=spawner(cores=cores, **kwargs), hostname_localhost=hostname_localhost, From e8be866dd6bcb6aaaab76fcb7ff9c6e1d7cf5b20 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 10 Sep 2024 13:17:36 +0200 Subject: [PATCH 4/4] boolean --- executorlib/shared/executor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/executorlib/shared/executor.py b/executorlib/shared/executor.py index b91417d1..9ebdc6b2 100644 --- a/executorlib/shared/executor.py +++ b/executorlib/shared/executor.py @@ -326,10 +326,11 @@ def execute_parallel_tasks( conda_environment_name (str): name of the conda environment to initialize conda_environment_path (str): path of the conda environment to initialize """ + conda = conda_environment_name is not None or conda_environment_path is not None interface = interface_bootup( command_lst=_get_backend_path( cores=cores, - conda=conda_environment_name is not None or conda_environment_path is not None, + conda=conda, ), connections=spawner(cores=cores, **kwargs), hostname_localhost=hostname_localhost,