Hello there! I am using pants on a devcontainer, a...
# general
p
Hello there! I am using pants on a devcontainer, and the
/tmp
partition gets filled up pretty quickly - i changed it using
local_execution_root_dir = ".temp"
in the [GLOBAL] part of pants.toml, but now whenever I run for example
pants test ::
I get in infinite loop:
Copy code
15:48:48.52 [INFO] Initializing scheduler...
15:48:52.12 [INFO] Scheduler initialized.
15:48:52.52 [INFO] Filesystem changed during run: retrying `Paths(**)` in 500ms...
15:48:52.52 [INFO] Filesystem changed during run: retrying `Paths(**)` in 500ms...
15:48:52.52 [INFO] Filesystem changed during run: retrying `@rule(pants.core.goals.test.run_tests())` in 500ms...
15:48:53.33 [INFO] Filesystem changed during run: retrying `@rule(pants.core.goals.test.run_tests())` in 500ms...
15:48:54.38 [INFO] Filesystem changed during run: retrying `@rule(pants.core.goals.test.run_tests())` in 500ms...
15:48:54.39 [INFO] Filesystem changed during run: retrying `@rule(pants.backend.python.dependency_inference.rules.resolve_parsed_dependencies())` in 500ms...
15:48:54.40 [INFO] Filesystem changed during run: retrying `@rule(pants.backend.python.dependency_inference.rules.resolve_parsed_dependencies())` in 500ms...
How can I exclude a folder to from the inotify service that pants uses? Or what other solution could there be to have the temp folder where the main repository is? Thank you so much in advance! 🙂
c
https://www.pantsbuild.org/docs/reference-global#pants_ignore does that, but it seems it should ignore any directory with a
.
prefix already. Do you set your own ignores overriding the defaults rather than adding to them perhaps? https://www.pantsbuild.org/docs/options#addremove-semantics
also, if you look at the
.pants.d/pants.log
file, it tells you the file path that was notified as changed, so you can verify it is what you expected
p
@curved-television-6568 thanks so much as always for your help, this works! I get another error though:
IntrinsicError: Failed to create hardlink to /workspaces/kittl-python/.cache/immutable/files/fa/faad51a6a108fba9d40b2a10e82a2646fccbaf8c3d9be47818f4bffae02d94b8 at /workspaces/kittl-python/.temp/pants-sandbox-9z0B1O/pex: No such file or directory (os error 2)
It seems that it is not creating
.temp/pants-sandbox-9z0B1O/pex
My [GLOBAL] pants.toml is:
Copy code
[GLOBAL]
pants_version = "2.17.0"
pants_ignore = [
  "!.env", # for tests to work
]
local_store_dir = ".cache"
local_cache = true
local_execution_root_dir = ".temp"
Any idea how to fix this by any chance? Thank you! 🙂
c
hmm.. if you try to run with
-ldebug
maybe you get some more hints? and/or with
--keep-sandboxes=always
?
🙏 1
my knowledge on linking is a bit limited.. and also I think there may be gotchas with having the sandbox root be in-repo.. but I’m not sure about that one. could be that you need to ignore it, like we just did.
🙏 1
p
Thanks so much! I have executed the command, the log is here: https://gist.github.com/pietrobolcato/889887fe2aaf8570ab6f5e9c6bc09e0f
What do you mean by "could be that you need to ignore it, like we just did"? 🙂
e
@proud-byte-81916 the IntrinsicError above looks like https://github.com/pantsbuild/pants/issues/18661 which was supposedly fixed in 2.17.0 final. Perhaps its unrelated / new and just looks similar or that issue was never actually fixed.
c
What do you mean by “could be that you need to ignore it, like we just did”?
about the gotcha of having the sandbox root in-repo, would at least require to ignore it, which we just did by adding it to
pants_ignore
(although I don’t see that in your pants config above) — but you said it’s working now 😉
p
Ah yes, I added that to .gitignore and was working, and also added it to
pants_ignore
but didn't change
Seems very related to that issue above 😕 it's strange because if I leave /tmp/ it works, but the root repo doesn't My version is 2.17.0
Question: is this temporary folder used for caching, or is there a problem if i would nuke it after every run, to recover the space?
c
unless you run with
keep-sandboxes
what’s left in there? it should be cleaned up, is my impression (not used for caching, no, that would be the local store dir.
p
Perhaps that's another problem then - it doesn't get cleaned up automatically in my case, any ideas as to why?
🤷 1
It's now creating problem with linting as well 😕
Copy code
vscode ➜ /workspaces/kittl-python (CU-86bvyazwa-Deploy-Logo-Generator-NER) $ pants lint ::
17:30:08.23 [ERROR] 1 Exception encountered:

Engine traceback:
  in `lint` goal

IntrinsicError: Error making tempdir for local process execution: Custom { kind: NotFound, error: PathError { path: "/tmp/pants/pants-sandbox-YdPTW5", err: Os { code: 2, kind: NotFound, message: "No such file or directory" } } }
c
just to cover some basics, have you tried rebooting? just get a feeling this could be some fluke state you’ve got into.. ?
p
I am using a devcontainer, perhaps that's causing some issues? I tried rebuilding it from scratch but that didn't help
c
on what host system?
p
MacOS Sonoma 14.0 (23A344)
c
ah, ok. Yea, I don’t know.. nothing for sure 🙂
p
After running
pants test ::
in my temp folder i keep having folders like:
immutable_inputsgXwqTN  immutable_inputsz9zVwU
not sure why these are there, but even if they stay, not sure then why linting is trying to find a sandbox there
This is not a major issue though, I can solve it already by increasing devcontainer storage size on docker - it's just eating up my host system one, but not the end of the world The most interesting part to look at is probably at the issue above, so having the temp folder relative to the root of the repo Thanks so much anyway for your patience and help dear @curved-television-6568 I really appreciate your help as always and all you do for the community! 🙏
❤️ 1
👍 1
b
FYI, for this code:
Copy code
pants_ignore = [
  "!.env", # for tests to work
]
you may want to use
pants_ignore.add = [ ...
(i.e. add the
.add
) instead, or else it's overwriting the default. Without the default, it'll be noticing changes in
.git
and other unhelpful locations: • see https://www.pantsbuild.org/docs/reference-global#pants_ignore for the default • see https://www.pantsbuild.org/docs/options#addremove-semantics (particularly the "toml" callout) for how
.add
works
❤️ 1
p
Thanks so much for the tip!
b
lordy, pants_ignore.add saved my bacon, thank you @broad-processor-92400. I was running a postgres container in CI and attempting to run 'pants test' making network calls to the container. postgres comes up (that alone was an achievement on BitBucket cloud 🙂 ) and stealthily changes the permissions of a folder in the purview of pants => pants gives me a scarily cryptic 'no-can-do' message about os permissions