Make Document Processing Pipeline More Fault Tolerant #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Experimenting with some real-world document collections, it's become apparent that the document processing could not be done on a doc-by-doc basis. The variation is too great. Most documents are OK, but some can go to the thousands or pages or have poor image compression. This creates situations where our celery workers crash due to over-consumption of memory or timeout due to insanely long processing times. New processing pipeline splits pdfs by page and then assigns each page to a worker in the celery queue. The bytes contents of the pages are no longer stored in the worker args as this consumes memory in Redis. Instead, they're stored to local FS or S3, depending on if
USE_AWS
is set.