Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions executorlib/standalone/hdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def load(file_name: str) -> dict:
Returns:
dict: dictionary containing the python function to be executed {"fn": ..., "args": (), "kwargs": {}}
"""
with h5py.File(file_name, "r") as hdf:
with h5py.File(file_name, "r", swmr=True) as hdf:
data_dict = {}
if "function" in hdf:
data_dict["fn"] = cloudpickle.loads(np.void(hdf["/function"]))
Expand All @@ -66,15 +66,15 @@ def get_output(file_name: str) -> Tuple[bool, object]:
Returns:
Tuple[bool, object]: boolean flag indicating if output is available and the output object itself
"""
with h5py.File(file_name, "r") as hdf:
with h5py.File(file_name, "r", swmr=True) as hdf:
if "output" in hdf:
return True, cloudpickle.loads(np.void(hdf["/output"]))
else:
return False, None


def get_queue_id(file_name: str) -> Optional[int]:
with h5py.File(file_name, "r") as hdf:
with h5py.File(file_name, "r", swmr=True) as hdf:
if "queue_id" in hdf:
return cloudpickle.loads(np.void(hdf["/queue_id"]))
else:
Expand Down
Loading
Loading