Is there a way to clear the pants cache? I've been...
# general
l
Is there a way to clear the pants cache? I've been trying to figure out an issue with my project structure, Finally just deleted the cache and re-ran tailor, which fixed the issue. I was expecting that to happen automatically, but I guess it wouldn't if I didn't change any files? It's really weird, now if I edit
pants.toml
for example, when I run pants again it doesn't seem to know that the edit has been made. I get the same error message that caused me to update. But if I delete
.pants.d
and
pids
then run it works.
w
I think my second ever Pants issue: https://github.com/pantsbuild/pants/issues/11477 In summary, it's a bit manual right now - but I really feel like we should have a goal for it. ... Unless someone sneakily added one without me knowing. For a full wipe, I do:
Copy code
rm -r ~/.cache/pants
rm -r ./pants.d
rm -r ./pids
./pants version
h
In theory clearing the cache should not be necessary except for when debugging Pants itself perhaps. If you're seeing end-user behavior change after deleting caches then that is a bug!
Editing
pants.toml
will cause pantsd to restart, so all the in-memory memoization will be lost and some work will re-run, but cached processes will still be satisfied from the on-disk cache.
w
“In theory” - practically, I wipe the cache due to transient pseudo-bugs that can’t be replicated once every month or two.
h
Yeah, not saying we don't have bugs... 😞
But for example I would expect running tailor, which is idempotent, to not be sensitive to the cache state
1
w
@loud-laptop-89838 Could you specify what the error was that tailor was intended to solve? Missing targets or something?
w
https://www.pantsbuild.org/docs/troubleshooting#cache-or-pantsd-invalidation-issues walks through a particular order to try things in, and how to report issues
l
I think the issue is due to running it as
wsl ./pants ...
when my project is in a windows directory. Pants is working fine for a project that is in Ubuntu (wsl), but I was running into the issue that any file changes wouldn't be picked up by subsequent pants calls, regardless of the call and that project is in a windows directory.
I'm on Windows 10, running wsl2 and Ubuntu 20.04 I think.
h
Oh...
Yeah, I would not be surprised if there are file-watching issues in that setup
l
haha ok good to know. I'll stick to a consistent file system.
w
Yeahhh, we have looong slack chats about this. And a couple of issues
b
Might it be possible to have an example reproduction of this issue within GitHub actions using the following? https://github.com/marketplace/actions/setup-wsl Might be worth having a failing CI test on record so that the issue is visible?
👀 1
l
It sounds like it's not something pants can really deal with without the native integration to windows? Not a big deal honestly, I just setup my repo in my wsl home dir and it works fine. This issue came up for a repo that was already setup on the windows filesystem.