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

[ENG-6821] Fix CrossRef DOI check task #10886

Conversation

cslzchen
Copy link
Collaborator

@cslzchen cslzchen commented Jan 3, 2025

Purpose

Fix CrossRef DOI check task

Changes

  • Ignore providers that are not configured
  • Improve exception handling and add sentry logging

QA Notes

N/A

Documentation

N/A

Side Effects

N/A

Ticket

https://openscience.atlassian.net/browse/ENG-6821

* Ignore providers that are not configured
* Improve exception handling and add sentry logging
@cslzchen cslzchen force-pushed the feature/fix-crossref-doi-check branch from dd5ffd2 to 0a46e0e Compare January 3, 2025 18:29
Comment on lines +69 to +73
if not doi_prefix:
sentry.log_message(f'Preprint [_id={preprint._id}] has been skipped for CrossRef DOI Check '
f'since the provider [_id={preprint.provider._id}] has invalid DOI Prefix '
f'[doi_prefix={doi_prefix}]')
continue
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewer: Ignore provider that is not properly configured for CrossRef.

Comment on lines +82 to +83
sentry.log_message(f'Could not contact crossref to check for DOIs, response returned with exception {exc}')
continue
Copy link
Collaborator Author

@cslzchen cslzchen Jan 3, 2025

Choose a reason for hiding this comment

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

For reviewer: don't quit if one batch failed. Log to sentry and continue.

Comment on lines +90 to +92
if not base_guid or not version:
sentry.log_message(f'[Skipped] Preprint [_id={preprint__id}] returned by CrossRef API has invalid _id')
continue
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewer: CrossRef must return the correct full (base and version) _id. Similarly, don't quit but just skip if one fails.

Comment on lines +96 to +99
).first()
if not pending_preprint:
sentry.log_message(f'[Skipped] Preprint [_id={preprint__id}] returned by CrossRef API is not found.')
continue
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewer: use filter() and added None check. Similarly, don't quit but just skip if one fails.

@cslzchen cslzchen marked this pull request as ready for review January 3, 2025 18:34
@cslzchen
Copy link
Collaborator Author

cslzchen commented Jan 3, 2025

No new failures and merging now.

@cslzchen cslzchen merged commit 45af5db into CenterForOpenScience:feature/preprints-doi-versioning Jan 3, 2025
4 of 6 checks passed
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.

2 participants