Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyPy and Pylint partition inputs via CoarsenedTarget #15141

Merged

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Apr 13, 2022

CoarsenedTargets are structure shared, and because they preserve their internal structure, they can service requests for transitive targets for different roots from the same datastructure. Concretely: Mypy and Pylint can consume CoarsenedTargets to execute a single @rule-level graph walk, and then compute per-root closures from the resulting CoarsenedTarget instances.

This does not address #11270 in a general way (and it punts on #15241, which means that we still need per-root transitive walks), but it might provide a prototypical way to solve that problem on a case-by-case basis.

Performance wise, this moves cold check :: for ~1k files from:

  • main: 32s total, and 26s spent in partitioning
  • branch: 19s total, and 13s spent in partitioning

The rest of the time is wrapped up in #15241.

@stuhood stuhood changed the title Mypy and Pylint partition inputs via CoarsenedTarget MyPy and Pylint partition inputs via CoarsenedTarget Apr 13, 2022
stuhood added 3 commits April 24, 2022 15:20
… targets.

[ci skip-rust]
[ci skip-build-wheels]
…tion to be shared.

[ci skip-rust]
[ci skip-build-wheels]
@stuhood stuhood force-pushed the stuhood/mypy-and-pylint-partition-via-ct branch from 423d053 to def8be0 Compare April 24, 2022 22:21
@stuhood stuhood marked this pull request as ready for review April 24, 2022 22:58
@stuhood
Copy link
Member Author

stuhood commented Apr 24, 2022

This is ready for review.

@stuhood stuhood merged commit 387635f into pantsbuild:main Apr 25, 2022
@stuhood stuhood deleted the stuhood/mypy-and-pylint-partition-via-ct branch April 25, 2022 16:53
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Another approach to mitigate the impact of this is #12652 - if only 1 constraint and 1 resolve is defined, then we can skip partitioning.

@stuhood stuhood added this to the 2.11.x milestone Apr 25, 2022
stuhood added a commit to stuhood/pants that referenced this pull request Apr 25, 2022
…d#15141)

`CoarsenedTarget`s are structure shared, and because they preserve their internal structure, they can service requests for transitive targets for different roots from the same datastructure. Concretely: Mypy and Pylint can consume `CoarsenedTargets` to execute a single `@rule`-level graph walk, and then compute per-root closures from the resulting `CoarsenedTarget` instances.

This does not address pantsbuild#11270 in a general way (and it punts on pantsbuild#15241, which means that we still need per-root transitive walks), but it might provide a prototypical way to solve that problem on a case-by-case basis.

Performance wise, this moves cold `check ::` for ~1k files from:
* `main`: 32s total, and 26s spent in partitioning
*  `branch`: 19s total, and 13s spent in partitioning

The rest of the time is wrapped up in pantsbuild#15241.
# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
stuhood added a commit that referenced this pull request Apr 25, 2022
…ck of #15141) (#15244)

`CoarsenedTarget`s are structure shared, and because they preserve their internal structure, they can service requests for transitive targets for different roots from the same datastructure. Concretely: Mypy and Pylint can consume `CoarsenedTargets` to execute a single `@rule`-level graph walk, and then compute per-root closures from the resulting `CoarsenedTarget` instances.

This does not address #11270 in a general way (and it punts on #15241, which means that we still need per-root transitive walks), but it might provide a prototypical way to solve that problem on a case-by-case basis.

Performance wise, this moves cold `check ::` for ~1k files from:
* `main`: 32s total, and 26s spent in partitioning
*  `branch`: 19s total, and 13s spent in partitioning

The rest of the time is wrapped up in #15241.
@Eric-Arellano Eric-Arellano removed this from the 2.11.x milestone Apr 26, 2022
stuhood added a commit that referenced this pull request Apr 29, 2022
…e in `check`. (#15277)

#15141 gave `CoarsenedTarget` new usecases, which unfortunately exposed a case where `check` would re-run in exponential runtime due to not having implemented a TODO about `__eq__` using a memoized graph walk.

[ci skip-rust]
[ci skip-build-wheels]
stuhood added a commit to stuhood/pants that referenced this pull request Apr 29, 2022
…e in `check`. (pantsbuild#15277)

pantsbuild#15141 gave `CoarsenedTarget` new usecases, which unfortunately exposed a case where `check` would re-run in exponential runtime due to not having implemented a TODO about `__eq__` using a memoized graph walk.

[ci skip-rust]
[ci skip-build-wheels]
stuhood added a commit that referenced this pull request Apr 29, 2022
…e in `check`. (Cherry-pick of #15277) (#15278)

#15141 gave `CoarsenedTarget` new usecases, which unfortunately exposed a case where `check` would re-run in exponential runtime due to not having implemented a TODO about `__eq__` using a memoized graph walk.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants