Skip to content

Commit

Permalink
Remove h5io from dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Oct 1, 2024
1 parent d66db91 commit 01e2aca
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 27 deletions.
3 changes: 1 addition & 2 deletions .ci_support/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ dependencies:
- pyzmq =26.2.0
- flux-core
- jupyter-book =1.0.0
- h5py =3.11.0
- h5io =0.2.4
- h5py =3.11.0
1 change: 0 additions & 1 deletion .ci_support/environment-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- mpi4py =4.0.0
- pyzmq =26.2.0
- h5py =3.11.0
- h5io =0.2.4
- matplotlib =3.9.2
- networkx =3.3
- pygraphviz =1.13
Expand Down
1 change: 0 additions & 1 deletion .ci_support/environment-old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- mpi4py =3.1.4
- pyzmq =25.0.0
- h5py =3.6.0
- h5io =0.2.1
- matplotlib =3.5.3
- networkx =2.8.8
- ipython =7.33.0
Expand Down
1 change: 0 additions & 1 deletion .ci_support/environment-openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- mpi4py =4.0.0
- pyzmq =26.2.0
- h5py =3.11.0
- h5io =0.2.4
- matplotlib =3.9.2
- networkx =3.3
- pygraphviz =1.13
Expand Down
1 change: 0 additions & 1 deletion .ci_support/environment-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- mpi4py =4.0.0
- pyzmq =26.2.0
- h5py =3.11.0
- h5io =0.2.4
- matplotlib =3.9.2
- networkx =3.3
- pygraphviz =1.13
Expand Down
1 change: 0 additions & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ dependencies:
- flux-pmix =0.5.0
- versioneer =0.28
- h5py =3.11.0
- h5io =0.2.2
26 changes: 7 additions & 19 deletions executorlib/cache/hdf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Tuple

import cloudpickle
import h5io
import h5py
import numpy as np

Expand All @@ -23,14 +22,11 @@ def dump(file_name: str, data_dict: dict) -> None:
with h5py.File(file_name, "a") as fname:
for data_key, data_value in data_dict.items():
if data_key in group_dict.keys():
h5io.write_hdf5(
fname=fname,
data=np.void(cloudpickle.dumps(data_value)),
overwrite="update",
title=group_dict[data_key],
fname.create_dataset(
name="/" + group_dict[data_key],
data=np.void(cloudpickle.dumps(data_value))
)


def load(file_name: str) -> dict:
"""
Load data dictionary from HDF5 file
Expand All @@ -44,21 +40,15 @@ def load(file_name: str) -> dict:
with h5py.File(file_name, "r") as hdf:
data_dict = {}
if "function" in hdf:
data_dict["fn"] = cloudpickle.loads(
h5io.read_hdf5(fname=hdf, title="function", slash="ignore")
)
data_dict["fn"] = cloudpickle.loads(np.void(hdf["/function"]))
else:
raise TypeError("Function not found in HDF5 file.")
if "input_args" in hdf:
data_dict["args"] = cloudpickle.loads(
h5io.read_hdf5(fname=hdf, title="input_args", slash="ignore")
)
data_dict["args"] = cloudpickle.loads(np.void(hdf["/input_args"]))
else:
data_dict["args"] = ()
if "input_kwargs" in hdf:
data_dict["kwargs"] = cloudpickle.loads(
h5io.read_hdf5(fname=hdf, title="input_kwargs", slash="ignore")
)
data_dict["kwargs"] = cloudpickle.loads(np.void(hdf["/input_kwargs"]))
else:
data_dict["kwargs"] = {}
return data_dict
Expand All @@ -76,8 +66,6 @@ def get_output(file_name: str) -> Tuple[bool, object]:
"""
with h5py.File(file_name, "r") as hdf:
if "output" in hdf:
return True, cloudpickle.loads(
h5io.read_hdf5(fname=hdf, title="output", slash="ignore")
)
return True, cloudpickle.loads(np.void(hdf["/output"]))
else:
return False, None
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ conda = ["conda_subprocess==0.0.4"]
mpi = ["mpi4py==4.0.0"]
hdf = [
"h5py==3.11.0",
"h5io==0.2.4",
]
graph = [
"pygraphviz==1.13",
Expand Down

0 comments on commit 01e2aca

Please sign in to comment.