Repository navigation
Conversation
A download given a cache_key, with SOURCE_CACHE_ROOT set, is copied from
{SOURCE_CACHE_ROOT}/{cache_key} when there, and left there once fetched, so
later processes (other tiles, other pods) skip the publisher. Only immutable
URLs get a key: the Zenodo records behind gpw_livestock and liao_gaced30.
SOURCE_CACHE_ROOT is optional; a Config field with a default may now be
left out of .env.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds an optional
SOURCE_CACHE_ROOT. Sources are downloaded again by every process that needs them: each ingest pod, each tile, each rerun. The GAcED30 archives and GPW livestock rasters are large, and they come from Zenodo, which throttles. WithSOURCE_CACHE_ROOTset, a download is fetched from the publisher once and then shared.Standalone on
main; no dependency on the other open PRs.Behaviour
utils.save_remote_url_to_local_pathtakes an optionalcache_key. When a key is given andSOURCE_CACHE_ROOTis set:{SOURCE_CACHE_ROOT}/{cache_key}exists, it is copied instead of asking the publisher;gpw_livestock:zenodo/{record}/{name};liao_gaced30:zenodo/18199675/{name}. Here the key uses the unquoted archive name, while the URL and local path stay quoted as before.SOURCE_CACHE_ROOTis optional becauseConfigfields with a default may now be left out of.env. Required fields still raise if missing.storage.get_fileis the read counterpart ofput_file..env.exampledocuments the new variable.Testing
jdluc/__tests__/source_cache_test.pystubs the publisher and checks:SOURCE_CACHE_ROOTmay be absent from.env, while a required key may not.uv run pytest jdlucanduv run pre-commit run --all-filespass.