8000 Suppress FileNotFoundError when deleting keys in the obstore adapter by lukasbindreiter · Pull Request #3140 · zarr-developers/zarr-python · GitHub
[go: up one dir, main page]

Skip to content

Suppress FileNotFoundError when deleting keys in the obstore adapter #3140

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lukasbindreiter
Copy link
Contributor
@lukasbindreiter lukasbindreiter commented Jun 18, 2025

Suppress FileNotFoundError in delete operation of the obstore adapter.

Since some underlying stores allow this, while others raise an error, supressing the error results in consistent behaviour across all stores. This also mimics how the same thing is implemented in the fsspec adapter.

Fixes #3136

TODO:

  • Add unit tests and/or doctests in docstrings
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jun 18, 2025
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Jun 18, 2025
@dstansby
Copy link
Contributor

Thanks for the PR/fix! This is slightly surprising behaviour to me - I would expect trying to delete a non-existent file to raise an error. But I guess if this is existing behaviour/design across other stores, this is good.

To be sure that we're getting consistent behaviour across stores, could you move the test you added to the StoreTests class, so it's run across all stores that are tested?

@d-v-b
Copy link
Contributor
d-v-b commented Jun 18, 2025

I think a better long-term solution would be for the stores to all raise the same exception when attempting to delete a missing key, and for the caller of the store method to handle that exception specifically in the context of attempting to remove an empty chunk. But this fix also works!

@kylebarron
Copy link
Contributor

I think a better long-term solution would be for the stores to all raise the same exception when attempting to delete a missing key

From the obstore side I don't have total control over that. The upstream s3 implementation does not raise an error: https://docs.rs/object_store/latest/object_store/trait.ObjectStore.html#method.delete_stream

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.

FileNotFoundError when writing an array that contains empty chunks
4 participants
0