Skip to content

Commit 3cd6581

Browse files
committed
fixed pickle load
1 parent 3ea1336 commit 3cd6581

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pydra/engine/helpers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ def load_result(checksum, cache_locations):
187187
if (location / checksum).exists():
188188
result_file = location / checksum / "_result.pklz"
189189
if result_file.exists() and result_file.stat().st_size > 0:
190-
return cp.load(result_file)
190+
with open(result_file, "rb") as fp:
191+
return cp.load(fp)
191192
return None
192193
return None
193194

@@ -569,11 +570,10 @@ def load_and_run(task_pkl: Path, rerun: bool = False) -> Path:
569570
# await task()
570571

571572

572-
def load_task(task_pkl: Path | str) -> "Task[DefType]":
573+
def load_task(task_pkl: os.PathLike) -> "Task[DefType]":
573574
"""loading a task from a pickle file, settings proper input for the specific ind"""
574-
if isinstance(task_pkl, str):
575-
task_pkl = Path(task_pkl)
576-
task = cp.load(task_pkl)
575+
with open(task_pkl, "rb") as fp:
576+
task = cp.load(fp)
577577
return task
578578

579579

0 commit comments

Comments
 (0)