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

Update gen_protos to work with new protobuf on os-x. #25914

Merged
merged 5 commits into from
Mar 22, 2023

Conversation

robertwb
Copy link
Contributor

Apparently the c-compiled protos are no longer available by default.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@robertwb robertwb requested a review from tvalentyn March 21, 2023 15:54
@robertwb
Copy link
Contributor Author

R: @AnandInguva

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

@robertwb
Copy link
Contributor Author

The failures in apache_beam.runners.interactive.sql.utils_test.OptionsFormTest.test_dataflow_options_form look irrelevant.

@robertwb
Copy link
Contributor Author

Run Python_Runners PreCommit

@robertwb
Copy link
Contributor Author

Run Python_Coverage PreCommit

Apparently the c-compiled protos are no longer available by default.
@tvalentyn
Copy link
Contributor

Run Python_Runners PreCommit

@tvalentyn
Copy link
Contributor

Run Python_Coverage PreCommit

_message.RepeatedCompositeContainer,
) # pylint: disable=c-extension-no-member
except ImportError:
from google.protobuf.internal import containers
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add a comment in which cases you expect else branch be used?

Copy link
Contributor

@AnandInguva AnandInguva Mar 22, 2023

Choose a reason for hiding this comment

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

Yes, that would be helpful. I haven't caught this error while i was using when PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb(which is default).
but when PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION==python(slow implementation of protobufs which we don't want to use) I was using except case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored this to be more explicit. Apparently the default implementation depends on the platform (and what wheels are shipped for it). Fast protos shouldn't matter here, and we are (as we should) verifying that we have a compiled implementation in our containers.

Copy link
Contributor

@tvalentyn tvalentyn left a comment

Choose a reason for hiding this comment

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

asked someone to look into broken build.

Copy link
Contributor Author

@robertwb robertwb left a comment

Choose a reason for hiding this comment

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

PTAL

_message.RepeatedCompositeContainer,
) # pylint: disable=c-extension-no-member
except ImportError:
from google.protobuf.internal import containers
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored this to be more explicit. Apparently the default implementation depends on the platform (and what wheels are shipped for it). Fast protos shouldn't matter here, and we are (as we should) verifying that we have a compiled implementation in our containers.

@tvalentyn
Copy link
Contributor

Backend: Wrote response {'code': 1, 'exc_type': 'AttributeError', 'exc_msg': "module 'google._upb.message' has no attribute 'RepeatedScalarFieldContainer'"} to /tmp/pep517_get_requires_for_build_sdist-xkfitq5.json

@tvalentyn
Copy link
Contributor

Would it be a problem if different implementations were used at pipeline submission vs runtime? Is this a scenario we may be facing (for example when one submits a pipeline from MacOS which presumably doesn't have the right wheels)?

"Unknown proto implementation: " + api_implementation.Type())
repeated_types = (
list,
impl.RepeatedScalarFieldContainer,
Copy link
Contributor

@AnandInguva AnandInguva Mar 22, 2023

Choose a reason for hiding this comment

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

RepeatedScalarContainer should be used when it is google.protobuf.pyext._message or google._upb import _message

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, good point. Fixed.

@robertwb
Copy link
Contributor Author

Regarding different implementations at compile vs. runtime, this is fine, as this code is just to do proto introspection to auto-generate the urn files to make type checkers more robust.

@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #25914 (67c19b1) into master (b5ce110) will decrease coverage by 0.01%.
The diff coverage is n/a.

❗ Current head 67c19b1 differs from pull request most recent head 8d1a5ec. Consider uploading reports for the commit 8d1a5ec to get more accurate results

@@            Coverage Diff             @@
##           master   #25914      +/-   ##
==========================================
- Coverage   71.41%   71.41%   -0.01%     
==========================================
  Files         778      778              
  Lines      102379   102435      +56     
==========================================
+ Hits        73112    73149      +37     
- Misses      27811    27830      +19     
  Partials     1456     1456              
Flag Coverage Δ
python 79.95% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 9 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@AnandInguva AnandInguva left a comment

Choose a reason for hiding this comment

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

LGTM. seems like there is a lint error.

@robertwb robertwb merged commit fcf51fb into apache:master Mar 22, 2023
@tvalentyn
Copy link
Contributor

yes, I understand this code is not relevant for job submission. My question is whether we should anticipate issues for some users of Mac OS b/c they will be using a different protobuf implementation.

@robertwb
Copy link
Contributor Author

robertwb commented Mar 23, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants