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

Atomic UrlOperations.upload for ssh- and file-URLs #649

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

christian-monch
Copy link
Contributor

@christian-monch christian-monch commented Mar 27, 2024

This PR addresses issue datalad-ria #102 and touches on issue #454 where atomic upload operations are discussed as well.

The PR also adds atomic upload to files. This can prevent data loss in the case where two threads write to the same file concurrently.

All ssh- and file-uploads should be atomic, which means an atomic-parameter that controls atomicity on a per-call basis is not necessary.

@christian-monch christian-monch changed the title Atomic UrlOperations.upload for ssh- and file-URLs Atomic UrlOperations.upload for ssh-URLs Mar 27, 2024
@christian-monch christian-monch changed the title Atomic UrlOperations.upload for ssh-URLs Atomic UrlOperations.upload for ssh- and file-URLs Mar 27, 2024
@christian-monch christian-monch force-pushed the atomic-upload branch 4 times, most recently from 0c248eb to 8c7fc58 Compare March 27, 2024 17:03
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 97.36842% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 93.10%. Comparing base (5a12b73) to head (8c7fc58).

❗ Current head 8c7fc58 differs from pull request most recent head 407abfb. Consider uploading reports for the commit 407abfb to get more accurate results

Files Patch % Lines
datalad_next/url_operations/file.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #649      +/-   ##
==========================================
+ Coverage   92.47%   93.10%   +0.62%     
==========================================
  Files         183      171      -12     
  Lines       12346    11992     -354     
  Branches     1890     1809      -81     
==========================================
- Hits        11417    11165     -252     
+ Misses        727      639      -88     
+ Partials      202      188      -14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This commit fixes the arguments to
`UrlOperationsRessourceUnknown` and
`UrlOperationsRemoteError` in
`FileUrlOperations.upload()`.

A regression test for
`UrlOperationsRemoteError` is added
as well.
This commit adds an atomic upload for files. This
can prevent errors where two threads are
writing to the same file concurrently.
This commit adds return statements to
the methods `FileUrlOperations.delete`
and `FileUrlOperations.upload` to
ensure that the expected return types
are in fact returned in all cases,
instead of returning `None`.
@christian-monch christian-monch self-assigned this Apr 25, 2024
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.

None yet

1 participant