Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use atomic writes for new files in LocalStore#3412

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
d-v-b merged 6 commits intozarr-developers:mainfromshoyer:atomic-write
Aug 28, 2025

Conversation

@shoyer
Copy link
Contributor

@shoyershoyer commentedAug 27, 2025
edited
Loading

Fixes#3411

I use the standard strategy of writing to a temporary file in the same directory, and then renaming it to the desired name. This ensure that Zarr writes are either complete or not written at all.

It would be nice if partial writes (_put() withstart) could also be atomic, but I'm honestly not sure if both atomic and efficient partial writes of files are possible. Interestingly, I don't see any uses ofset_partial_values() inside Zarr, so maybe this feature isn't needed after all? (see#2859 for discussion)

TODO:

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

Fixeszarr-developers#3411I use the standard strategy of writing to a temporary file in the samedirectory, and then renaming it to the desired name.This ensure that Zarr writes are either complete or not written at all.
@github-actionsgithub-actionsbot added the needs release notesAutomatically applied to PRs which haven't added release notes labelAug 27, 2025
@shoyershoyer changed the titleUse atomic writes in LocalStoreUse atomic writes for new files in LocalStoreAug 27, 2025
@codecov
Copy link

codecovbot commentedAug 27, 2025
edited
Loading

Codecov Report

❌ Patch coverage is91.66667% with2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.70%. Comparing base (c9509ee) to head (f2c1fcd).
⚠️ Report is 1 commits behind head on main.

Files with missing linesPatch %Lines
src/zarr/storage/_local.py91.66%2 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main    #3412      +/-   ##==========================================- Coverage   94.70%   94.70%   -0.01%==========================================  Files          79       79                Lines        9532     9549      +17     ==========================================+ Hits         9027     9043      +16- Misses        505      506       +1
Files with missing linesCoverage Δ
src/zarr/storage/_local.py92.39% <91.66%> (+0.17%)⬆️
🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

)->int|None:
path.parent.mkdir(parents=True,exist_ok=True)
# write takes any object supporting the buffer protocol
view=value.as_buffer_like()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this makes me wonder whyBuffer doesn't implement the buffer protocol!

shoyer reacted with thumbs up emoji
Copy link
Contributor

@d-v-bd-v-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we should probably get arelease note for this change. I'm happy to write one if that works. Otherwise it looks g2g!

@github-actionsgithub-actionsbot removed the needs release notesAutomatically applied to PRs which haven't added release notes labelAug 28, 2025
@d-v-bd-v-benabled auto-merge (squash)August 28, 2025 17:26
@shoyer
Copy link
ContributorAuthor

The missing code coverage is for the unused/untestedset_partial_values (#2859) and foros.rename on Windows (I guess Codecov does not include the Windows build?)

@d-v-bd-v-b merged commit96a531b intozarr-developers:mainAug 28, 2025
29 checks passed
@shoyershoyer deleted the atomic-write branchAugust 28, 2025 17:43
@shoyershoyer mentioned this pull requestAug 28, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@d-v-bd-v-bd-v-b approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Atomic writes in LocalStore

2 participants

@shoyer@d-v-b

[8]ページ先頭

©2009-2025 Movatter.jp