When I run a pants command and then run it a secon...
# general
d
When I run a pants command and then run it a second time with no changes, sometimes it hangs about for ~10 seconds apparently rebuilding its graph, and sometimes it finishes instantly. I'm curious what makes the difference?
h
Do you see a message saying "Initializing scheduler..."?
d
yes
But then it does "find all targets in project" which is the bit that seems to take a while
h
and that's in-between the two runs? If so, that means that Pantsd (daemon) restarted so you lost all memoization You can look at
.pants.d/pants.log
to see why
d
👍
Yeah, I just ran it six times in a row, and it initialized scheduler four times
Copy code
18:25:22.86 [INFO] handling request: `--pants-bin-name=./v2pants --pants-version=2.9.0 test test/python/foursquare_test/fs::`
18:25:40.86 [INFO] request completed: `--pants-bin-name=./v2pants --pants-version=2.9.0 test test/python/foursquare_test/fs::`
18:25:41.18 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {".git", ".git/index.lock"}
18:25:41.19 [INFO] notify invalidation: cleared 1 and dirtied 45 nodes for: {".git", ".git/index.lock"}
18:25:42.08 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {".git/index.lock", ".git"}
18:25:42.08 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {".git", ".git/index.lock"}
18:25:42.09 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {".git/index.lock", ".git"}
18:25:42.10 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {".git/index.lock", ".git"}
18:26:43.63 [INFO] Extending leases
18:26:45.37 [INFO] Done extending leases
I guess I need to tell it to ignore .git
Oh:
Copy code
less .pants.d/pants.log                                                                          PantsPrototype ⬆ ✭ ✱ ◼
18:28:59.15 [INFO] handling request: `--pants-bin-name=./v2pants --pants-version=2.9.0 test test/python/foursquare_test/fs::`
18:29:15.00 [ERROR] The scheduler was invalidated: Exception('pantsd process 40426 was using 1025.42 MiB of memory (above the `--pantsd-max-mem
18:29:15.18 [ERROR] service failure for <pants.pantsd.service.scheduler_service.SchedulerService object at 0x103f66cd0>.
18:29:15.18 [INFO] Waiting for ongoing runs to complete before exiting...
18:29:15.34 [INFO] request completed: `--pants-bin-name=./v2pants --pants-version=2.9.0 test test/python/foursquare_test/fs::`
18:29:15.34 [INFO] Server exiting with Ok(())
18:29:15.34 [INFO] Waiting for Sessions to complete before exiting...
18:29:15.34 [INFO] Waiting for shutdown of: ["scheduler_service_session", "store_gc_service_session", "pants_run_2022_01_27_18_28_59_894_2a6b16
18:29:15.34 [INFO] Shutdown completed: "scheduler_service_session"
18:29:15.34 [INFO] Shutdown completed: "store_gc_service_session"
18:29:15.34 [INFO] Shutdown completed: "pants_run_2022_01_27_18_28_59_894_2a6b16f182f241c987f27580b0ac3f60"
18:29:15.37 [INFO] Exiting pantsd
18:29:15.38 [WARN] File watcher exiting with: The watcher was shut down.
h
is
.git
not in your
.gitignore
?
d
It is
h
do you set
pants_ignore
in
pants.toml
? if so, check that you use
pants_ignore.add = []
d
oooo
I did set pants_ignore = rather than using .add
IS there a recommended value to set the max_memory option to? Searching the docs it only seems to be mentioned in setting up CI
h
idk why this was truncated, but this is the issue also with pantsd restarting:
Copy code
The scheduler was invalidated: Exception('pantsd process 40426 was using 1025.42 MiB of memory (above the `--pantsd-max-mem
IS there a recommended value to set the max_memory option to?
Depends on how powerful your org's machines are. It defaults to
1GiB
. Might want to try
1.5GiB
or
2GiB
d
👍 I guess we can tune that til it seems to work well 🙂
Can I set that in pants.toml or does it have to be passed with a flag/set as an env var? The docs are a little unclear as to which options are toml-able and which arent
h
any options can be set via CLI, env var, or pants.toml. See https://www.pantsbuild.org/docs/options
d
Sweet 🙂 I missed that page somewhere! And I must have just misconfigured my attempt to set it in the toml.
Fixed.
Thanks Eric!
❤️ 1