hundreds-father-404
02/18/2020, 4:33 PM--fmt-per-target-caching
and --lint-per-target-caching
.
Medium term, we wrote a proposal to replace that option with an implementation that has the benefits of both caching schemes
I’d appreciate a look if you have a moment! https://docs.google.com/document/d/1Tdof6jx9aVaOGeIQeI9Gn-8x7nd6LfjnJ0QrbLFBbgc/edit#witty-crayon-22786
02/20/2020, 10:58 AM--changed
flags in this usecase?witty-crayon-22786
02/20/2020, 10:59 AMhundreds-father-404
02/20/2020, 5:12 PM--changed
. We want to be able to tell users to simply run ./pants fmt ::
. But even if we did, we expect per-target caching to not be worth it if 2-3+ targets have changed, depending on the tool and the size of the codebase.
Linters are unique compared to Pytest in that the cost of running one additional file with a linter is incredibly low, whereas the overhead of starting the linter fresh is quite high
--
There are downsides to losing per-target caching, which is why the option --per-target-caching
is only temporary and we explain a medium-term proposal to get the best of both schemes, i.e. have fine-grained caching while avoiding the overhead of starting the tool multiple timeswitty-crayon-22786
02/20/2020, 7:27 PMwitty-crayon-22786
02/20/2020, 7:27 PMwitty-crayon-22786
02/20/2020, 7:27 PMhundreds-father-404
02/20/2020, 7:27 PMwitty-crayon-22786
02/20/2020, 7:28 PMhundreds-father-404
02/20/2020, 7:29 PMwitty-crayon-22786
02/20/2020, 7:33 PMwitty-crayon-22786
02/20/2020, 7:33 PMhundreds-father-404
02/20/2020, 7:33 PMblack f1.py; black f2.py; black f3.py
, rather than black f1.py f2.py f3.py
witty-crayon-22786
02/20/2020, 7:33 PMwitty-crayon-22786
02/20/2020, 7:34 PMwitty-crayon-22786
02/20/2020, 7:34 PMwitty-crayon-22786
02/20/2020, 7:34 PMwitty-crayon-22786
02/20/2020, 7:35 PMhundreds-father-404
02/20/2020, 7:35 PM1. average target sizeYes, 1-1-1 proves to be a good pattern with linters
witty-crayon-22786
02/20/2020, 7:36 PMwitty-crayon-22786
02/20/2020, 7:36 PMhundreds-father-404
02/20/2020, 7:39 PM(Doesn’t matter for pure formatters, matters for things that need deps)We do have one example of this now:
pylint
, which needs direct dependencies (but not transitive dependencies)hundreds-father-404
02/20/2020, 7:41 PMBecause we’ve done the “invoke in a batch and then try to tease everything back apart” thing before, and it’s not prettyIs there somewhere I can read up on this? On the other side, John mentioned Python Ants used to run things per-target and then added a mechanism to try batching things for these similar performance concerns. https://docs.google.com/document/d/1Tdof6jx9aVaOGeIQeI9Gn-8x7nd6LfjnJ0QrbLFBbgc/edit?disco=AAAAGOanEo8
witty-crayon-22786
02/20/2020, 7:42 PMwitty-crayon-22786
02/20/2020, 7:42 PMhappy-kitchen-89482
02/20/2020, 7:48 PMhappy-kitchen-89482
02/20/2020, 7:49 PMhappy-kitchen-89482
02/20/2020, 7:49 PMhappy-kitchen-89482
02/20/2020, 7:49 PMhappy-kitchen-89482
02/20/2020, 7:52 PM./pants fmt ::
will run on 1000 files in one pass, and say 10 of them fail. We fix those and run ./pants fmt ::
, which again runs on 1000 files, but they all pass. Now we cache the fact "this file is lint free" for each of the 1000 files individually. Now we pull a change that touched 8 files. ./pants fmt ::
will consult the cache for 1000 files, notice that 992 of them have no lint, and run only on the 8 remaining, in one pass.happy-kitchen-89482
02/20/2020, 7:54 PM./pants fmt ::
run could only operate on the 10 files, not the entire 1000.happy-kitchen-89482
02/20/2020, 7:54 PMhappy-kitchen-89482
02/20/2020, 7:54 PMhappy-kitchen-89482
02/20/2020, 7:55 PMwitty-crayon-22786
02/20/2020, 7:56 PM