https://pantsbuild.org/ logo
#general
Title
# general
b

broad-processor-92400

11/10/2022, 10:56 PM
The change to have mypy's cache work is great (makes our
./pants check ::
runs 10x faster when there's a small change to python code), thank you! However, I noticed that there seems to be a single
cache.db
file per python verison in
~/.cache/pants/named_caches/mypy_cache/
. Does that mean a single cache is used for all invocations of mypy via pants? E.g. I've got multiple check-outs of our internal company repo (sharing a cache seems to make sense between them...), but also the pants repo, and sharing a cache between the pants and our internal one seems a bit unexpected?
w

witty-crayon-22786

11/10/2022, 10:59 PM
cc @bitter-ability-32190
b

bitter-ability-32190

11/10/2022, 11:08 PM
Yes! IIRC pants has a unique dir for these things per repo. @witty-crayon-22786 is that true of the append cache?
Oh wait, I think we uniqueify a subdir per project route. IIRC
w

witty-crayon-22786

11/10/2022, 11:10 PM
Yes! IIRC pants has a unique dir for these things per repo.
mm, we do not
b

bitter-ability-32190

11/10/2022, 11:14 PM
No, specifically for mypy we do this
b

broad-processor-92400

11/10/2022, 11:18 PM
Ah, okay! That... doesn't seem to be functioning as I expect in 2.14, e.g.:
Copy code
$ tree ~/.cache/pants/named_caches/mypy_cache/               
/Users/huon/.cache/pants/named_caches/mypy_cache/
├── 3.7
│   └── cache.db
├── 3.8
│   └── cache.db
└── 3.9
    └── cache.db
And the DB's
files.path
s are all relative to source roots, rather than scoped at all
that will always create a directory called
mypy_cache
, but it will create it at a different place in the sandbox each time.
named_cache_dir
and
run_cache_dir
should maybe be swapped
@broad-processor-92400: would you mind filing a bug against 2.14.x for this?
👍 1
b

bitter-ability-32190

11/10/2022, 11:26 PM
Oh yeah whoops. You win some you learn some 😅
w

witty-crayon-22786

11/10/2022, 11:26 PM
append_only_caches
is definitely not the most obvious API
b

bitter-ability-32190

11/10/2022, 11:28 PM
Lol. My heart was in the right place
❤️ 1
w

witty-crayon-22786

11/10/2022, 11:30 PM
we probably could do what you were suggesting above and differentiate
append_only_caches
from per-repo caches…
global_named_caches
and
repo_named_caches
…?
b

broad-processor-92400

11/10/2022, 11:31 PM
w

witty-crayon-22786

11/10/2022, 11:31 PM
thank you!
b

broad-processor-92400

11/10/2022, 11:31 PM
I'll let you summarise anything frmo this discussion there.
Also I'm assuming
build_root
is (essentially/usually) the absolute path of directory containing the
./pants
script? Does this mean that multiple check-outs (or multiple git worktrees) of a single repo wouldn't be able to share the cache? I guess that sounds bad for concurrency...
b

bitter-ability-32190

11/10/2022, 11:33 PM
Pex_root being an example of global? And mypy would be repo?
@broad-processor-92400 yeah. They wouldn't share a daemon either 🤷‍♂️
6 Views