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

Don't backup if draft modified timestamp hasn't advanced #245

Merged
merged 5 commits into from
Aug 12, 2022
Merged

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Aug 9, 2022

Closes #239.

This PR makes the following changes:

  • When backing up the draft version of a Dandiset, the draft's modified timestamp is now stored in .dandi/assets-state.json at the end of the backup. Intermediate commits made along the way store the modified timestamp of the most recent asset at that point.
  • When starting a backup of the draft version of a Dandiset, if .dandi/assets-state.json exists and the timestamp within is not earlier than the draft's current modified date, no backup is performed.
  • When backing up a published version of a Dandiset, the version's created timestamp is now stored in .dandi/assets-state.json.
  • A --verify-timestamps flag has been added to update-from-backup; when given, if a backup would be skipped due to timestamps, the backup is instead run, and an error occurs if anything would be changed.
  • If there is any asset metadata that needs to be "garbage collected," an error is emitted unless the --gc-assets flag is passed to update-from-backup.

@codecov
Copy link

codecov bot commented Aug 9, 2022

Codecov Report

Merging #245 (bbd69c8) into draft (a7b7215) will decrease coverage by 0.39%.
The diff coverage is 69.86%.

@@            Coverage Diff             @@
##            draft     #245      +/-   ##
==========================================
- Coverage   78.30%   77.90%   -0.40%     
==========================================
  Files          14       14              
  Lines        1954     2014      +60     
  Branches      323      341      +18     
==========================================
+ Hits         1530     1569      +39     
- Misses        301      314      +13     
- Partials      123      131       +8     
Impacted Files Coverage Δ
tools/backups2datalad/zarr.py 78.20% <20.00%> (-2.96%) ⬇️
tools/backups2datalad/syncer.py 82.25% <42.85%> (-5.68%) ⬇️
tools/backups2datalad/asyncer.py 80.11% <69.23%> (-0.60%) ⬇️
tools/backups2datalad/datasetter.py 76.78% <85.71%> (+0.11%) ⬆️
tools/backups2datalad/__main__.py 63.58% <100.00%> (+1.15%) ⬆️
tools/backups2datalad/adataset.py 80.80% <100.00%> (+1.34%) ⬆️
tools/backups2datalad/config.py 91.54% <100.00%> (+0.24%) ⬆️
tools/backups2datalad/util.py 79.69% <100.00%> (+0.30%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

Looks great. I didn't dare to try though ;) needs a little more of conditions and "unittests" for paranoid Yarik.

tools/backups2datalad/asyncer.py Show resolved Hide resolved
tools/backups2datalad/datasetter.py Show resolved Hide resolved
tools/backups2datalad/__main__.py Show resolved Hide resolved
@yarikoptic
Copy link
Member

Coolio, thank you! I will add a cron job to do a run with --verify-timestamps once a day

@yarikoptic yarikoptic merged commit f4c4e23 into draft Aug 12, 2022
@yarikoptic yarikoptic deleted the gh-239 branch August 12, 2022 17:01
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.

Idea: dandiset Version "wide" state sha256s
2 participants