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

Make independent owners requests per file to improve memoization #10491

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/python/pants/backend/python/dependency_inference/rules.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import itertools
from pathlib import PurePath

from pants.backend.python.dependency_inference import module_mapper
Expand Down Expand Up @@ -123,11 +124,11 @@ async def infer_python_init_dependencies(
)

# And add dependencies on their owners.
return InferredDependencies(
await Get(
Owners, OwnersRequest(extra_init_files.snapshot.files, OwnersNotFoundBehavior.error)
)
owners = await MultiGet(
Get(Owners, OwnersRequest((f,), OwnersNotFoundBehavior.error))
for f in extra_init_files.snapshot.files
)
return InferredDependencies(itertools.chain.from_iterable(owners))


class InferConftestDependencies(InferDependenciesRequest):
Expand All @@ -149,11 +150,11 @@ async def infer_python_conftest_dependencies(
)

# And add dependencies on their owners.
return InferredDependencies(
await Get(
Owners, OwnersRequest(extra_conftest_files.snapshot.files, OwnersNotFoundBehavior.error)
)
owners = await MultiGet(
Get(Owners, OwnersRequest((f,), OwnersNotFoundBehavior.error))
for f in extra_conftest_files.snapshot.files
)
return InferredDependencies(itertools.chain.from_iterable(owners))


def rules():
Expand Down