Skip to content

Commit

Permalink
Merge pull request #438 from pyiron/command
Browse files Browse the repository at this point in the history
Move get_command_path() to separate module
  • Loading branch information
jan-janssen authored Oct 26, 2024
2 parents b4941b8 + 9a0430e commit 8561d56
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion executorlib/shared/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions executorlib/shared/command.py
Original file line number Diff line number Diff line change
@@ -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))
15 changes: 1 addition & 14 deletions executorlib/shared/executor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import importlib.util
import inspect
import os
import queue
import sys
from concurrent.futures import (
Expand All @@ -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,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8561d56

Please sign in to comment.