slv.inversion.cache.fips_cache#
- slv.inversion.cache.fips_cache(filename, key=None)[source]#
Content-addressed cache decorator for the pipeline’s component functions.
- Parameters:
filename – Stage name / cache stem (e.g.
"obs","prior_error").key – Optional
key(config, *args, **kwargs), called with the function’s arguments before the cache is looked up: what the component depends on beyond the config (JSON-able), hashed into its key. The forward operator and the MDM use it for the footprints they are built from (_footprint_keyinslv.inversion.pipelines).
Notes
The decorated function takes the
InversionConfigas its first argument; its result is pickled. Files are stored under{cache_dir}/.fips/{version_tag}/{component}/{hash}.pklwhereversion_tagpins the running fips/pystilt source revision (git describeof the editable checkout, else installed metadata; see_version_tag) andhashis derived only from the config fields that actually affect that component (seeDEFAULT_COMPONENT_DEPS), plus the release versions of the packages it is built with (lair / uataq, seeDEFAULT_COMPONENT_PACKAGES; a new lair release rebuilds the obs and prior, not the Jacobian) and the component’s revision (seeDEFAULT_COMPONENT_REVISIONS; bumped when slv changes what the component holds). Committing/bumping a package therefore lands in a fresh tree rather than silently reusing a stale component (a pickle written by another fips does not load). This means:Changing
prior_base_stdreusesobs.pklandforward_operator.pkluntouched, and only regeneratesprior_error.pkl.Configs that share the same upstream parameters share the same files — no manual cache wiping is needed.
config.cachecontrols caching:False/None— no caching (default)True— cache in the current working directorystr/Path— cache in that directory
config.cache_overwritecontrols forced recomputation:[]— never overwrite (default)"all"— overwrite every component[component, …]— overwrite specific components (all hashes for that component are deleted and the component is recomputed fresh)