diff --git a/executorlib/shared/cache.py b/executorlib/shared/cache.py index 07fb36eb..13f493b6 100644 --- a/executorlib/shared/cache.py +++ b/executorlib/shared/cache.py @@ -6,7 +6,7 @@ from concurrent.futures import Future from typing import Any, Tuple -from executorlib.shared.executor import get_command_path +from executorlib.shared.command import get_command_path from executorlib.shared.hdf import dump, get_output, load from executorlib.shared.serialize import serialize_funct_h5 diff --git a/executorlib/shared/command.py b/executorlib/shared/command.py new file mode 100644 index 00000000..8dfa8e83 --- /dev/null +++ b/executorlib/shared/command.py @@ -0,0 +1,14 @@ +import os + + +def get_command_path(executable: str) -> str: + """ + Get path of the backend executable script + + Args: + executable (str): Name of the backend executable script, either mpiexec.py or serial.py + + Returns: + str: absolute path to the executable script + """ + return os.path.abspath(os.path.join(__file__, "..", "..", "backend", executable)) diff --git a/executorlib/shared/executor.py b/executorlib/shared/executor.py index b49c55f0..24c0c613 100644 --- a/executorlib/shared/executor.py +++ b/executorlib/shared/executor.py @@ -1,6 +1,5 @@ import importlib.util import inspect -import os import queue import sys from concurrent.futures import ( @@ -14,6 +13,7 @@ import cloudpickle +from executorlib.shared.command import get_command_path from executorlib.shared.communication import interface_bootup from executorlib.shared.inputcheck import ( check_resource_dict, @@ -465,19 +465,6 @@ def execute_tasks_with_dependencies( sleep(refresh_rate) -def get_command_path(executable: str) -> str: - """ - Get path of the backend executable script - - Args: - executable (str): Name of the backend executable script, either mpiexec.py or serial.py - - Returns: - str: absolute path to the executable script - """ - return os.path.abspath(os.path.join(__file__, "..", "..", "backend", executable)) - - def _get_backend_path( cores: int, ) -> list: