Hey Pants Team, curious if there's a way we can re...
# general
r
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
the workunits that Pants records contain this information, and so plugins can emit it. Toolchain’s plugin does, for example.
👀 1
r
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
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
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
👀 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
okay cool good to know we can get this data. Thank you for your support on this it's very helpful
b
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