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

Avoid overwriting valid catalogs. #464

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

gitosaurus
Copy link
Contributor

@gitosaurus gitosaurus commented Dec 28, 2024

Strong refusal without options, since it's easier and safer to move the catalog out of the way.

Change Description

Before beginning a catalog import or generating a margin cache, check whether the output artifact already contains a valid catalog, and if so, stop by raising a ValueError.

Closes #459 .

  • My PR includes a link to the issue that I am addressing

Solution Description

Code Quality

  • I have read the Contribution Guide and LINCC Frameworks Code of Conduct
  • My code follows the code style of this project
  • My code builds (or compiles) cleanly without any errors or warnings
  • My code contains relevant comments and necessary documentation

Bug Fix Checklist

Tested this end-to-end on epyc, and verified it, and added unit tests to verify argument validation.

  • My fix includes a new test that breaks as a result of the bug (if possible)
  • My change includes a breaking change
    • My change includes backwards compatibility and deprecation warnings (if possible)

@gitosaurus gitosaurus linked an issue Dec 28, 2024 that may be closed by this pull request
3 tasks
Copy link

codecov bot commented Dec 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.59%. Comparing base (e401c6c) to head (0b3e702).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #464      +/-   ##
==========================================
+ Coverage   94.55%   94.59%   +0.04%     
==========================================
  Files          28       28              
  Lines        1615     1627      +12     
==========================================
+ Hits         1527     1539      +12     
  Misses         88       88              

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

Strong refusal without options, since it's easier and safer to move the catalog out of the way.
@gitosaurus gitosaurus force-pushed the 459-import-avoid-overwriting-valid-catalog branch from 6647085 to 107a822 Compare December 31, 2024 18:29
@gitosaurus gitosaurus marked this pull request as ready for review December 31, 2024 22:29
@maxwest-uw
Copy link
Contributor

Should this be using the strict option for is_valid_catalog ? naively it seems like the non-strict option only checks if there are valid partition and metadata files (which might cause problems in the cause where an import was paused/interrupted). Otherwise this looks good to me !

@gitosaurus
Copy link
Contributor Author

Should this be using the strict option for is_valid_catalog ? naively it seems like the non-strict option only checks if there are valid partition and metadata files (which might cause problems in the cause where an import was paused/interrupted). Otherwise this looks good to me !

The main reason is performance: strict=False (the default) takes ~3ms to run, while strict=True takes ~25s. Moreover, strict=False will still correctly reject in-progress catalogs as invalid, in my testing.

@maxwest-uw
Copy link
Contributor

oh if it's that slow than I think non strict is probably fine :)

@gitosaurus gitosaurus force-pushed the 459-import-avoid-overwriting-valid-catalog branch from 0b3e702 to b713e9c Compare January 2, 2025 22:18
@gitosaurus gitosaurus enabled auto-merge (rebase) January 2, 2025 22:29
@gitosaurus gitosaurus merged commit c3fb952 into main Jan 2, 2025
16 checks passed
@gitosaurus gitosaurus deleted the 459-import-avoid-overwriting-valid-catalog branch January 2, 2025 22:30
@delucchi-cmu delucchi-cmu mentioned this pull request Jan 23, 2025
15 tasks
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.

Avoid overwriting a valid HATS catalog during import
2 participants