Skip to content

Do not require bazel for check_grpcio_tools.py#13463

Merged
mehrdada merged 1 commit intogrpc:masterfrom
mehrdada:fix-check_grpcio_tools
Nov 20, 2017
Merged

Do not require bazel for check_grpcio_tools.py#13463
mehrdada merged 1 commit intogrpc:masterfrom
mehrdada:fix-check_grpcio_tools

Conversation

@mehrdada
Copy link
Copy Markdown
Contributor

@mehrdada mehrdada commented Nov 20, 2017

Fixes #13404.

The make_grpcio_tools.py rube-goldberg machinery relies on
bazel to extract the list of files required to compile the
grpcio-tools package that are provided by the protobuf
submodule. In order to ensure that list is up to date,
check_grpcio_tools.py sanity check does the same bazel
query, and checks the full contents against the already
existing list in the repository. This has the downside of
requiring bazel to run that particular check at sanity test
time, and flakiness has been seen there.

This commit changes the code generation process to include
the git hash of the submodule at the time make_grpcio_tools.py
is invoked and stores it in the generated file and instead of
doing the whole process at test time, the check_grpcio_tools.py
sanity test simply checks the submodule version at test time
and verifies it against the version included in the file by
make_grpcio_tools.py thus removing the bazel dependency
at test time and increasing test robustness and speed.

@grpc-testing
Copy link
Copy Markdown

****************************************************************

libgrpc.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

****************************************************************

libgrpc.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

1 similar comment
@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

Copy link
Copy Markdown
Contributor

@kpayson64 kpayson64 left a comment

Choose a reason for hiding this comment

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

Nice Fix! Just one suggestion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given that this is a python file, does it make sense to just have the commit hash be a global variable, and then you can import this file and check it

Copy link
Copy Markdown
Contributor Author

@mehrdada mehrdada Nov 20, 2017

Choose a reason for hiding this comment

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

I tried doing that first, but the challenge was importing the file with its path being read from a variable, and it seemed different things worked differently in various python versions and the existing test relied on opening the raw file content for reading. This approach sounded like more robust across python versions. If we want to do that, we should probably go about hardcoding the module path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. If we need to add a hack to have it imported, I'm fine with it as is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PTAL. I made it a variable but verify its presence as a raw string, not by parsing Python.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still LGTM

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] No significant performance differences

1 similar comment
@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

****************************************************************

libgrpc.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



The `make_grpcio_tools.py` rube-goldberg machinery relies on
`bazel` to extract the list of files required to compile the
`grpcio-tools` package that are provided by the `protobuf`
submodule.  In order to ensure that list is up to date,
`check_grpcio_tools.py` sanity check does the same `bazel`
query, and checks the full contents against the already
existing list in the repository.  This has the downside of
requiring `bazel` to run that particular check at sanity test
time, and flakiness has been seen there.

This commit changes the code generation process to include
the git hash of the submodule at the time `make_grpcio_tools.py`
is invoked and stores it in the generated file and instead of
doing the whole process at test time, the `check_grpcio_tools.py`
sanity test simply checks the submodule version at test time
and verifies it against the version included in the file by
`make_grpcio_tools.py` thus removing the `bazel` dependency
at test time and increasing test robustness and speed.
@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

****************************************************************

libgrpc.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] No significant performance differences

1 similar comment
@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] No significant performance differences

@mehrdada mehrdada merged commit 61ea3e2 into grpc:master Nov 20, 2017
@mehrdada mehrdada deleted the fix-check_grpcio_tools branch November 20, 2017 21:50
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants