Probably a stupid question, but is there a good re...
# general
f
Probably a stupid question, but is there a good reliable way to run pants commands with nice? I guess once pantsd is started you have to renice it, but you also never know when pantsd will need to be restarted, so you'd have to nice the invocation of
./pants
too? Like this:
Copy code
renice 19 $(cat .pids/**/pid)
nice ./pants ...
Does this make sense or am I thinking about this all wrong?
just realized that i really like typing
nice ./pants
๐Ÿ˜‚
๐Ÿ’ฏ 1
๐Ÿ˜‚ 1
f
Would you want all invoked subprocesses to also be `nice`โ€™d?
f
yeah that's actually what I want niced
i don't think pants/pantsd uses that much CPU, it's the stuff it spawns
w
thatโ€™s charitable ๐Ÿ˜‰
it looks like we could probably do this programmatically based on a setting with setpriority (linux / macOS)
f
That would be useful in the future
I'm not really using pants as a runner for the moment (just a tool for calculating targets affected by changes), but I will be moving in that direction, and this could be helpful
f
also this is a relatively easy change to make to Pants especially for a new contributor. Define an option (e.g.,
--subprocess-environment-priority=...
), thread it through into the local execution runner in Rust (there are several PRs that serve as examples), and then invoke the correct API from the libc crate to set the nice value (probably using https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.pre_exec on the
Command
and
setpriority
https://docs.rs/libc/0.2.117/libc/fn.setpriority.html)
๐Ÿค” 1