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

[prism] Dev prism builds for python and Python Direct Runner fallbacks. #32876

Merged
merged 11 commits into from
Oct 21, 2024

Conversation

lostluck
Copy link
Contributor

@lostluck lostluck commented Oct 18, 2024

This change does two tasks:

  • Enables Python SDK developers to have prism automatically build and run locally using local changes to Prism when using PrismRunner.
  • Sets Prism to be attempted to be used in the Python DirectRunner in some circumstances.

The main change is to the prism_runner behavior when the SDK reports a .dev version.
In that case:

  • Try to go install github.com/apache/beam/sdks/v2/go/cmd/prism to the binary cache directory.
  • If that doesn't succeed, inspect the output for module errors
    • If there are no module errors, then the local version of prism couldn't compile, OR go isn't installed. Either way, this is a developer addressable error.
    • If there are module errors, then those modules don't have access to a version of Beam Go, so instead install the latest released version of prism.
      • This can be avoided by having a go.work file set up to direct Beam to a local version of the beam repo. This will be documented in a forthcoming SDK Development guide.

Arguably independently, is Attempt To Use Prism in the direct runner.

  • This currently only happens if we can't use the FnAPI runner.
  • If Prism fails on receiving the job, on job submission, then fallback to the DirectRunner instead.

Other changes are a refactor to reverse a few if blocks and return earlier, improving readability and reducing indentations.

Part of #32564

Fixes #32877.


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 or the workflows README to see a list of phrases to trigger workflows.

Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @damccorm for label python.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

@lostluck
Copy link
Contributor Author

I discovered the root of my problem was using a newer yapf than Beam does, (0.40, instead of 0.29), so now I can have the formatting enabled on save, which will help! Local Linting on the other hand eludes me. I'm fortunately not tickling that as often.

@lostluck lostluck merged commit 3767eda into apache:master Oct 21, 2024
91 checks passed
@lostluck lostluck deleted the gapPrism branch October 21, 2024 22:55
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.

Python Runner Wrapper to execute a job against Prism (via Go being available) for dev versions
2 participants