ert
ert copied to clipboard
Use `watchdog` to keep Storage with `mode="r"` up-to-date
The Python package watchdog
https://pypi.org/project/watchdog/ lets us watch a directory for changes, particularly when files are created and when files are deleted.
Definition of done is when the following test sketch passes:
def test_watchdog(tmp_path):
with open_storage(tmp_path, mode="r", watch=True) as reader:
assert _cases(reader) == []
with open_storage(tmp_path, mode="w") as writer:
writer.create_experiment().create_ensemble(name="foobar")
assert _cases(reader) == ["foobar"]
Might want to evaluate whether to use watchfiles
instead of watchdog
. https://pypi.org/project/watchfiles/
This looks nice. Do I understand correctly that this would allow me to keep a read-only storage open in a Jupyter notebook while ert is running, and will stay up-to-date as new results are written to storage?
This looks nice. Do I understand correctly that this would allow me to keep a read-only storage open in a Jupyter notebook while ert is running, and will stay up-to-date as new results are written to storage?
Yep.