From 014b2b658f9e7048bb224c373e46030a36484a35 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 11 Aug 2023 16:17:27 -0600 Subject: [PATCH] Clean up get_backend_path() --- pympipool/shared/executorbase.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pympipool/shared/executorbase.py b/pympipool/shared/executorbase.py index c2eea3f0..8f2aafc2 100644 --- a/pympipool/shared/executorbase.py +++ b/pympipool/shared/executorbase.py @@ -154,18 +154,16 @@ def execute_task_dict(task_dict, meta_future_lst): raise ValueError("Unrecognized Task in task_dict: ", task_dict) +def _get_command_path(executable): + return os.path.abspath(os.path.join(__file__, "..", "..", "backend", executable)) + + def get_backend_path(cores): command_lst = [sys.executable] if cores > 1: - command_lst += [ - os.path.abspath( - os.path.join(__file__, "..", "..", "backend", "mpiexec.py") - ), - ] + command_lst += [_get_command_path(executable="mpiexec.py")] else: - command_lst += [ - os.path.abspath(os.path.join(__file__, "..", "..", "backend", "serial.py")), - ] + command_lst += [_get_command_path(executable="serial.py")] return command_lst