-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[#31403] Python wrapper to download, use, or build and run prism. #31583
Conversation
Needs tests, and since I'm not a Python expert, I don't want to calcify what I have with tests until I get confirmation I don't need a full refactor. Much of this was cribbed from the existing code in flink_runner, job_server, and subprocess_server. I should be able to unit test the various bits of construction logic. I do need to find the guidance on executing the unit tests. cc: @damondouglas (for the Java equivalent) @robertwb (for python SDK) |
Assigning reviewers. If you would like to opt out of this review, comment R: @jrmccluskey for label python. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First review pass, a few python style notes. I think this would benefit from some type hints for clarity too.
'%s/apache_beam-%s-prism-%s-%s.zip' % | ||
(root_tag, self._version, opsys, arch)) | ||
|
||
def path_to_binary(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: argument validation using fields set in __init__()
is generally better to do in the init function rather than in a function accepting no args later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted, I'm happy to change it if you feel strongly, but this one is to keep consistent with what the FlinkRunner wrapper does it. I think it's technically since the jar version is in a different level of inheritence though.
Happy to change it either way.
return ( | ||
'https://github.com/apache/beam/releases/download/' | ||
'%s/apache_beam-%s-prism-%s-%s.zip' % | ||
(root_tag, self._version, opsys, arch)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lostluck As an example for 2.56.0
what is root_tag
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, which you've found the answer to, but otherwise:
In particular it's the tag used in the URL for the GitHub release page. eg. the untagged-dadf35fc62aedc91ebcb
in
https://github.com/apache/beam/releases/tag/untagged-dadf35fc62aedc91ebcb
or the v2.56.0 in https://github.com/apache/beam/releases/tag/v2.56.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note though that because that "untagged" version is a draft release, it's not possible to download binaries from it unless we wanted to do GitHub auth token shenanigans. We're more likely to not use draft Releases and only use the Pre-Release designation instead to work around that for validation.
b8641ea
to
3123ee0
Compare
RFAL. I think the linter and formatter should be automatically happy now. Otherwise, I've also added the initial version of the test suite handler. Not currently expected to pass, but also nothing should be running it since it won't have the pipeline options yet. |
Apparently my local version of yapf configured against the project's config, disagrees with one formatting choice the cloud check is making. sigh |
I appreciate the detailed comments and suggestions! But I am not a Python expert. I have no idea what's being requested in some cases, or whether it makes any difference or not. Please make no assumptions that the code here represents expert Python code, that is there intentionally. Most of the comments are hitting differences in the newer style of Python Beam is adopting, vs the style from the code I copied. I'm very happy to take concrete code suggestions, but I can't engage with suggestions that require me to hunt for context I don't know about. |
155d777
to
72ffed5
Compare
Adds Prism as a runner for the Python SDK.
--prism_beam_version_override
--prism_location
flag that provides a location of an appropriate zip or binary for the local platform, or the root github release page for a version, to use the download logic. The latter of these should also override the Beam version to match the artifact, but will ultimately select the right platform to acquire.Resolves #31403
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.