If the contents of a named cached (append only cac...
# plugins
f
If the contents of a named cached (append only cache) are dependent upon for another rule, is the only way to guarantee the cache is populated to have the rule set as
ProcessCacheScope.PER_SESSION
Rule A -> package install into named cache Rule B (depends on A) -> reads from named cache
g
I don't think even that is a guarantee. I can
rm -rf ~/.cache/pants/named_caches
while pantsd is running. What issue are you solving where regular caching isn't enough? Would immutable input digests be an option? If it has to be filled before rule-run it sounds more apt that way.
Depending on what you're trying to do, it may be interesting to look at how pyenv installs are managed since they do something like that.
f
Seems pyenv is doing exactly this https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/python/providers/pyenv/rules.py#L272-L275 I believe “per session” is per invocation of the pants cli, which is “good enough” for me I have a problem very similar to the pyenv use case where I need to download dependencies for later use. I looked at using digests for this but unfortunately the tool is leaking full filesystem paths, so. I need the fully qualified path to be stable across sandboxes 😞
I ended up abandoning named_caches because of this path leak, had to rely a directory outside of pants
g
A potential hack around that is to use a run script which does something like
export MYPATH=$(realpath .my-cache)
etc. I do that for various reasons in several of my plugins.
That also leaks the cache path but it's somewhat static.