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

Catch some allowed exceptions #5

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

maxrjones
Copy link

@maxrjones maxrjones commented Jan 17, 2025

zarr.create_array works with this PR. Here are a couple open questions:

  1. Should allowed exceptions be constant or configurable as in the fsspec store?
  2. What's the best way to catch any exceptions returned during get_partial_values?

Work torwards zarr-developers#1661

@kylebarron
Copy link
Owner

  1. Should allowed exceptions be constant or configurable as in the fsspec store?

I'm happy to make it configurable. Perhaps we should provide a default but make it configurable?

  1. What's the best way to catch any exceptions returned during get_partial_values?

I think as you have is probably fine?

@kylebarron kylebarron merged commit 72c9b30 into kylebarron:kyle/object-store Jan 17, 2025
4 checks passed
@maxrjones
Copy link
Author

Should allowed exceptions be constant or configurable as in the fsspec store?

I'm happy to make it configurable. Perhaps we should provide a default but make it configurable?

This is the approach that fsspec takes. I think it's necessary to provide a default because FileNotFoundErrors need to be caught for determining groups/arrays/nothing.

What's the best way to catch any exceptions returned during get_partial_values?

I think as you have is probably fine?

I could test this, but I thought that there may be an issue in

# TODO: this gather a list of list of Response; not sure if there's a way to
# unpack these lists inside of an `asyncio.gather`?
for responses in await asyncio.gather(*futs):
for resp in responses:
buffers[resp["original_request_index"]] = resp["buffer"]
with the 'buffer' key not existing in the responses if there was a 'FileNotFoundError'.

@kylebarron
Copy link
Owner

This is the approach that fsspec takes. I think it's necessary to provide a default because FileNotFoundErrors need to be caught for determining groups/arrays/nothing.

So in that case we should always catch FileNotFound, and if the user desires we can catch additional errors?

@kylebarron
Copy link
Owner

kylebarron commented Jan 17, 2025

I could test this, but I thought that there may be an issue in

# TODO: this gather a list of list of Response; not sure if there's a way to
# unpack these lists inside of an `asyncio.gather`?
for responses in await asyncio.gather(*futs):
for resp in responses:
buffers[resp["original_request_index"]] = resp["buffer"]

with the 'buffer' key not existing in the responses if there was a 'FileNotFoundError'.

Oh perhaps; maybe just use get instead of []?

@maxrjones maxrjones deleted the object-store branch January 17, 2025 19:14
@kylebarron
Copy link
Owner

Perhaps you're right that this snippet needs to be updated in more ways than just replacing [] with get(). I haven't spent time thinking about it yet.

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

Successfully merging this pull request may close these issues.

2 participants