ancient-france-42909
08/18/2022, 11:37 PMgenerate-lockfiles
takes 5 minutes per ‘thing’, how can I find out why?ancient-france-42909
08/18/2022, 11:38 PM$ ls ~/.cache/pants/
lmdb_store named_caches setup
witty-crayon-22786
08/18/2022, 11:46 PMancient-france-42909
08/18/2022, 11:47 PMwitty-crayon-22786
08/18/2022, 11:48 PMancient-france-42909
08/18/2022, 11:48 PMreal 0m38.479s
witty-crayon-22786
08/18/2022, 11:48 PMwitty-crayon-22786
08/18/2022, 11:50 PM--no-local-cache --ldebug
, capture the “spawning local process” DEBUG line for the relevant process, and then report a github.com/pantsbuild/pex issue with the contentancient-france-42909
08/18/2022, 11:50 PM./pants check ::
though, it’s been resolving coaresned targets for 40 seconds, then got warnings about interpreter_constraints
ancient-france-42909
08/18/2022, 11:50 PMwitty-crayon-22786
08/18/2022, 11:51 PMancient-france-42909
08/18/2022, 11:51 PMancient-france-42909
08/18/2022, 11:51 PMancient-france-42909
08/18/2022, 11:52 PMancient-france-42909
08/18/2022, 11:52 PMwitty-crayon-22786
08/18/2022, 11:52 PMthe interpreter constraints thing is an error nowyea… that change is actually intended to improve performance
ancient-france-42909
08/19/2022, 12:04 AM^3.7
vs >3.7
stuff, I just removed everything basically 🙂ancient-france-42909
08/19/2022, 4:06 PM$ ./pants generate-lockfiles --resolve=pytest
⠐ 480.20s Resolve transitive targets
⠐ 480.20s Resolve transitive targets
⠐ 469.92s Resolve transitive targets
⠐ 470.12s Resolve transitive targets
⠐ 465.09s Resolve transitive targets
ancient-france-42909
08/19/2022, 4:06 PMhundreds-father-404
08/19/2022, 4:09 PM./pants dependencies --transitive ::
? (To help us figure out if this is a regression)ancient-france-42909
08/19/2022, 4:10 PMhundreds-father-404
08/19/2022, 4:14 PMtailor
does), or fewer BUILD files with **
globs in the sources
field?
• are there import cycles between your files?
• what does ./pants --concurrent roots | wc -l
in another terminal say?
None of those would explain 15 minutes...but give us some info on the shape of your repository.ancient-france-42909
08/19/2022, 4:14 PMhundreds-father-404
08/19/2022, 4:15 PMancient-france-42909
08/19/2022, 4:18 PMancient-france-42909
08/19/2022, 4:18 PMhundreds-father-404
08/19/2022, 4:22 PM2.6 dependencies took 54 secondsCertainly slower than we'd like—and we continue to make performance optimizations—but yeah, that's within the upper range I would expect for a repo that size. So, it sounds like somewhere between 2.6 and 2.13 there was a change that made this pathologically slow for you. It sounds like you were upgrading one version at a time. When do you first remember noticing how slow this was? I think there could be two approaches to figuring this out: 1. Bisect when things slowed down for you, or 2. use profiling to figure out on 2.13 where the slowdown is happening
ancient-france-42909
08/19/2022, 4:23 PMhundreds-father-404
08/19/2022, 4:23 PMsome things were horribly broken still.Meaning this performance slowdown, or other things?
ancient-france-42909
08/19/2022, 4:23 PMancient-france-42909
08/19/2022, 4:23 PMancient-france-42909
08/19/2022, 4:25 PM./pants dependencies --transitive ::
on 2.13 took 2m23shundreds-father-404
08/19/2022, 4:29 PMgenerate-lockfiles
command on 2.13 also? ./pants dependencies --transitive ::
should trigger the same "Resolving targets" rule as generate-lockfiles
was doingancient-france-42909
08/19/2022, 4:30 PM./pants generate-lockfiles --resolve=pytest
), it’s been running for mroe than 2.5 minutes and doesn’t seem like it’s finishing. And, yeah, 2.13hundreds-father-404
08/19/2022, 4:30 PMancient-france-42909
08/19/2022, 4:30 PMwitty-crayon-22786
08/19/2022, 4:31 PMResolve transitive targets
, then it’s related to https://github.com/pantsbuild/pants/issues/11270 … but that should no longer be relevant under generate-lockfiles
, I don’t think?ancient-france-42909
08/19/2022, 4:31 PMwitty-crayon-22786
08/19/2022, 4:31 PMgenerate-lockfiles
ancient-france-42909
08/19/2022, 4:32 PMwitty-crayon-22786
08/19/2022, 4:32 PMhundreds-father-404
08/19/2022, 4:33 PMwould want to find where we’re making multiple TT calls for generate-lockfiles@witty-crayon-22786 I suspect this has pathological behavior in their repo:
constraints = await _pytest_interpreter_constraints(python_setup)
all_tgts = await Get(AllTargets, AllTargetsRequest())
transitive_targets_per_test = await MultiGet(
Get(TransitiveTargets, TransitiveTargetsRequest([tgt.address]))
for tgt in all_tgts
if PythonTestFieldSet.is_applicable(tgt)
)
But I don't understand why dependencies --transitive ::
would be faster; iiuc it does the same type of MultiGet
ancient-france-42909
08/19/2022, 4:33 PM'pants.backend.python',
"pants.backend.docker",
"pants.backend.plugin_development",
'pants.backend.python.lint.bandit',
'pants.backend.python.lint.black',
'pants.backend.python.lint.flake8',
'pants.backend.python.lint.isort',
'pants.backend.python.lint.pylint',
"pants.backend.python.typecheck.mypy",
"pants.backend.python.lint.docformatter",
"pants.backend.python.mixed_interpreter_constraints",
And a custom one, which reminds me, I might’ve had it off last night when I was trying.witty-crayon-22786
08/19/2022, 4:35 PMhundreds-father-404
08/19/2022, 4:37 PM-ldebug
or anything like that to confirm where the rule is getting stuck?ancient-france-42909
08/19/2022, 4:37 PMhundreds-father-404
08/19/2022, 4:39 PMcould maybe try resolve-by-resolve.George-Cristian, for context, I would expect
generate-lockfiles --resolve=isort
to be much faster, for example, because it does not need to consult your own code's interpreter constraints to figure out which to use for the lockfile. I suspect it's that interpreter constraints calculation for Pytest that is messing us upancient-france-42909
08/19/2022, 4:39 PMancient-france-42909
08/19/2022, 4:40 PM[pytest]
lockfile = "pants-lockfile.pytest"
args = ["--durations=50"]
version = "pytest==7.0.1"
extra_requirements.add = [
# improve diffs when comparing objects in tests
"pytest-icdiff==0.5",
# add syntax highlighting for pytest output
"pygments==2.9.0",
# allow to use ipdb instead of pdb in debug mode
"ipdb==0.13.2",
# required by the pytest configuration in `pytest.ini`
"SQLAlchemy==1.3.0",
# Somehow pants decides to upgrade that.
"pyparsing==2.4.7",
]
hundreds-father-404
08/19/2022, 4:40 PMwitty-crayon-22786
08/19/2022, 4:41 PM``` all_tgts = await Get(AllTargets, AllTargetsRequest())
transitive_targets_per_test = await MultiGet(
Get(TransitiveTargets, TransitiveTargetsRequest([tgt.address]))
for tgt in all_tgts
if PythonTestFieldSet.is_applicable(tgt)
)```is no longer necessary after the IC deprecation, right?
hundreds-father-404
08/19/2022, 4:41 PMwitty-crayon-22786
08/19/2022, 4:41 PMwitty-crayon-22786
08/19/2022, 4:41 PMhundreds-father-404
08/19/2022, 4:43 PMancient-france-42909
08/19/2022, 4:43 PMwitty-crayon-22786
08/19/2022, 4:44 PMhundreds-father-404
08/19/2022, 4:44 PM-ldebug
to confirmwitty-crayon-22786
08/19/2022, 4:45 PMhundreds-father-404
08/19/2022, 5:00 PM./pants generate-lockfiles --resolve=black
, and make sure that [black].interpreter_constraints
is not set. My change updates Pytest to use the same algorithm as Black was already usinghundreds-father-404
08/19/2022, 5:04 PMgenerate-lockfiles --resolve=pytest
goes from 4.7 seconds to 0.4 seconds 🎉ancient-france-42909
08/19/2022, 5:13 PMhundreds-father-404
08/19/2022, 5:15 PMancient-france-42909
08/19/2022, 8:10 PMhundreds-father-404
08/19/2022, 8:29 PMancient-france-42909
08/19/2022, 8:32 PMhundreds-father-404
08/19/2022, 9:10 PMmain
hundreds-father-404
08/19/2022, 9:11 PMblack
was fast, I'm fairly confident this PR will fix your issue with pytest 🙂ancient-france-42909
08/19/2022, 9:11 PMhundreds-father-404
08/20/2022, 12:28 AMancient-france-42909
08/23/2022, 7:14 PMhundreds-father-404
08/23/2022, 8:32 PMancient-france-42909
08/23/2022, 8:59 PM