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

Guard download and streaming of WARC files #537

Merged
merged 6 commits into from
Jun 19, 2024

Conversation

MaxDall
Copy link
Collaborator

@MaxDall MaxDall commented Jun 19, 2024

This PR guards the download and streaming of specific WARC files by catching requests.HTTPErrors and fastwarc.stream_io.StreamErrors and logging the corresponding WARC path at error level. This is in order to prevent Fundus from crashing when something went wrong during the processing of an individual WARC file.

This PR also adds a naive retry mechanic, that tries to reload said WARC file every 30 * current try seconds. By default, it does so three times.

@MaxDall MaxDall requested a review from addie9800 June 19, 2024 14:58
Copy link
Collaborator

@addie9800 addie9800 left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this

scraper = CCNewsScraper(source)
yield from scraper.scrape(error_handling, extraction_filter, url_filter)
retries: int = 0
while True and retries <= self.retries:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this simplify to retries <= self.retries?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's True slapstick drum sound

addie9800
addie9800 previously approved these changes Jun 19, 2024
@MaxDall MaxDall merged commit cb39f9b into master Jun 19, 2024
4 checks passed
@MaxDall MaxDall deleted the guard-warc-file-load-stream branch June 19, 2024 18:24
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