From a813845ef71da08ea38cf9b28c045a494ac5c16b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Jan=C3=9Fen?= Date: Sun, 27 Oct 2024 21:39:12 +0100 Subject: [PATCH] bug fixes --- executorlib/cache/shared.py | 2 +- executorlib/standalone/cache/spawner.py | 2 ++ tests/test_cache_executor_serial.py | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/executorlib/cache/shared.py b/executorlib/cache/shared.py index 1ae1ad1e..2f8ba947 100644 --- a/executorlib/cache/shared.py +++ b/executorlib/cache/shared.py @@ -93,7 +93,7 @@ def execute_tasks_h5( memory_dict=memory_dict, file_name_dict=file_name_dict, ) - resource_dict = task_dict["resource_dict"] + resource_dict = task_dict["resource_dict"].copy() if "cores" not in resource_dict: resource_dict["cores"] = cores_per_worker if "cwd" not in resource_dict: diff --git a/executorlib/standalone/cache/spawner.py b/executorlib/standalone/cache/spawner.py index 25e54d62..b4da5ae3 100644 --- a/executorlib/standalone/cache/spawner.py +++ b/executorlib/standalone/cache/spawner.py @@ -29,6 +29,8 @@ def execute_in_subprocess( ] if resource_dict is None: resource_dict = {"cwd": None} + elif len(resource_dict) == 0: + resource_dict = {"cwd": None} return subprocess.Popen(command, universal_newlines=True, cwd=resource_dict["cwd"]) diff --git a/tests/test_cache_executor_serial.py b/tests/test_cache_executor_serial.py index 203a196d..491167dc 100644 --- a/tests/test_cache_executor_serial.py +++ b/tests/test_cache_executor_serial.py @@ -73,7 +73,6 @@ def test_executor_function(self): "cache_directory": cache_dir, "execute_function": execute_in_subprocess, "cores_per_worker": 1, - "resource_dict": {"cwd": None}, "terminate_function": terminate_subprocess, }, ) @@ -115,7 +114,6 @@ def test_executor_function_dependence_kwargs(self): "cache_directory": cache_dir, "execute_function": execute_in_subprocess, "cores_per_worker": 1, - "resource_dict": {"cwd": None}, "terminate_function": terminate_subprocess, }, ) @@ -157,7 +155,6 @@ def test_executor_function_dependence_args(self): "cache_directory": cache_dir, "execute_function": execute_in_subprocess, "cores_per_worker": 1, - "resource_dict": {"cwd": None}, "terminate_function": terminate_subprocess, }, )