Is there a way to disable logging to `.pants.d/run...
# general
n
Is there a way to disable logging to
.pants.d/run-tracker/*
directory? Or just disable logging to files altogether? For context, we are running pantsbuild along with another tool(skaffold) which results in pants goals being called in a loop, sometimes many times a second. This results in a proliferation of the
.pants.d/run-tracker/pants_run_YYYY_MM_DD_MM_SS_SHA
folders which are not really necessary. Since the
.pants.d
folder is required to be in the repository this is causing issues with some IDEs where file watching is not as configurable.
h
Hmm, can’t think of a way offhand. Which IDEs are these? I use IntelliJ/PyCharm and those do let you ignore subdirs
e
What version of Pants is this? I may be out of touch with restrictions, but this doc / help seem to contradict your assertion: https://www.pantsbuild.org/docs/reference-global#pants_workdir
h
Yeah, I had thought pants_workdir could be outside the buildroot
n
Sorry for the delayed response. The issues stemmed primarily from IntelliJ. I think ignoring directories was attempted but there is some weird behavior from IntelliJ still trying to watch the ignored files. As to moving the workdir, I checked with the members of my team having these issues and it does seem like moving the pants_workdir out of the buildroot is supported with that flag. I think I had seen this (https://www.pantsbuild.org/docs/troubleshooting#how-to-change-your-cache-directory) docs page, which I guess is outdated, that says "This [pants_workdir] must be relative to the build root."
h
Huh, yeah I think that is just wrong
Oh, actually, hmm
This is where
pants run
and
pants repl
create their workdirs, which do have to be in the repo
So probably those should be separate concerns
since there is no reason to force logs and the like to be under there?
Well anyway, good that it works for you
n
I spoke too soon. Running into issues like this, exactly how you mentioned (redacted) -
Copy code
./pants run misc:script_name
15:05:29.16 [INFO] Initialization options changed: reinitializing scheduler...
15:05:29.85 [INFO] Scheduler initialized.
15:05:33.01 [INFO] Starting: Building 1 requirement for script_name.pex from the python/pants.lock resolve: jinja2==3.1.2
15:05:34.47 [INFO] Completed: Building 1 requirement for script_name.pex from the python/pants.lock resolve: jinja2==3.1.2
15:05:34.47 [INFO] Starting: Building local_dists.pex
15:05:35.09 [INFO] Completed: Building local_dists.pex
15:05:35.10 [ERROR] 1 Exception encountered:
  ValueError: '/home/dev/.pants.d/tmpxp7xc43j' is not in the subpath of '/home/dev/<repo_name>' OR one path is relative and the other is absolute.
h
grrr
Hmmm
I don’t see an easy solution here short of code changes
n
I think we found a workaround. For the script which invokes pants repeatedly, we only need to run
./pants package
so we can afford to set the
PANTS_WORKDIR
env var inside that script and redirect it to somewhere in
/tmp/
. For everything else, the
.pants.d
directory can stay in the buildroot as needed.
Also I don't remember this(https://www.pantsbuild.org/v2.12/docs/reference-global#section-logdir) logdir flag being there, is this something new?
h
Ah, that works!
No, that’s not new