This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
Respect the ingestion limit if ingest_records is called multiple times #804
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.
Fixes
Fixes #[issue number] by @[issue author]
This is necessary pre-requisite work for refactoring Flickr (#585)
Description
Some of our provider ingesters iterate over a set of query params and call
ingest_records
for each. For example:This causes a problem with
ingestion_limit
, an Airflow variable intended to restrict the number of records ingested (to speed up testing). Reaching the ingestion limit causesingest_records
to return early, but for DAGs like the above that callingest_records
multiple times, you'll have to hit theingestion_limit
once for every run ofingest_records
.This PR just updates the
ProviderDataIngester
to keep track of the number of records ingested across multiple runs ofingest_records
, and respect the limit as soon as it has been reached.Testing Instructions
just test
. I verified the test failed before making the code changes, and passes now 😃You can also try setting an
ingestion_limit
Airflow variable and then runningfinnish_museums_workflow
, which has the mentioned problem. You should see in the logs that ingestion wasn't run for additional params.Other tests:
ingest_records
(example Cleveland) with aningestion_limit
setNOTE: The ingestion limit is still slightly fuzzy. Ingestion will be halted as soon as the number of records committed exceeds the limit, but the last batch it receives is fully processed (tldr if you have a limit of 100, you might see
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin