https://pantsbuild.org/ logo
r

rapid-bird-79300

01/11/2023, 8:04 PM
Hey Pants Team, curious if there's a way we can retrieve granular runtimes from the lint goal. For example, if we run `flake8`/`isort` on lint we want to know the total runtime for each lint tool
w

witty-crayon-22786

01/11/2023, 9:25 PM
the workunits that Pants records contain this information, and so plugins can emit it. Toolchain’s plugin does, for example.
👀 1
r

rapid-bird-79300

01/11/2023, 9:56 PM
okay that is cool, so pants records this can we can access it in via a separate plugin. So we would run
./pants lint ::
and then
./pants our-workunit-inspector-plugin
Toolchain website new look is awesome
❤️ 1
w

witty-crayon-22786

01/11/2023, 9:58 PM
So we would run
./pants lint ::
and then
./pants our-workunit-inspector-plugin
not quite… the relevant plugin interface is
StreamingWorkunitHandler
: it receives workunits during the run, rather than being a separate goal.
👍 1
r

rapid-bird-79300

01/11/2023, 10:09 PM
I found this test and I'm getting an idea how this works. Is there any other examples of this. Does Toolchain already offer that break down by lint tool workunit?
w

witty-crayon-22786

01/11/2023, 10:15 PM
👀 1
Does Toolchain already offer that break down by lint tool workunit?
yes, on a build-by-build basis. we don’t aggregate across tasks currently, but it’s something we’ve discussed doing
👍 1
r

rapid-bird-79300

01/11/2023, 10:20 PM
okay cool good to know we can get this data. Thank you for your support on this it's very helpful
b

broad-processor-92400

01/12/2023, 2:24 AM
For a one-off investigation, a short-cut that avoids a plugin might be something like:
Copy code
./pants --stats-log --no-local-cache --no-pantsd lint --only=isort ::
(and similarly with
--only=flake8
), and then looking at the
local_process_total_time_run_ms: ...
. I think this will include the time to set-up the tools, but if you're just doing this to work out why linting is taking a very long time (or similar), I suspect that it'll be enough to narrow down the problem
2 Views