Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the safety of file gatherer utilities #1261

Open
Zeitsperre opened this issue Dec 16, 2022 · 1 comment
Open

Improve the safety of file gatherer utilities #1261

Zeitsperre opened this issue Dec 16, 2022 · 1 comment

Comments

@Zeitsperre
Copy link
Collaborator

Zeitsperre commented Dec 16, 2022

I have no idea if this is related, but I noticed that we download the MD5 file even if the netCDF file already exists:

if local_file.is_file():
local_md5 = file_md5_checksum(local_file)
try:
url = "/".join((github_url, "raw", branch, md5_name.as_posix()))
LOGGER.info(f"Attempting to fetch remote file md5: {md5_name.as_posix()}")
urlretrieve(url, md5_file) # nosec
with open(md5_file) as f:
remote_md5 = f.read()

This means we are still writing to disk each time open_dataset is called. Maybe there some non-thread-safe things happenning? (I have no idea how it could resolve in a HDF error though).

We could try to:

  • Download the MD5 to memory instead than to a file?
  • Use locks to prevent multiple write attemps.
    ?

Originally posted by @aulemahal in #1258 (comment)

@Zeitsperre Zeitsperre added this to the v0.42 milestone Jan 13, 2023
@Zeitsperre Zeitsperre modified the milestones: v0.42, Summer 2023 Mar 21, 2023
@Zeitsperre
Copy link
Collaborator Author

Relevant: xarray-contrib/cf-xarray#436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant