apache / beam

Apache Beam is a unified programming model for Batch and Streaming data processing.
https://beam.apache.org/
Apache License 2.0
7.89k stars 4.27k forks source link

Fixed the broken beam python on flink with PortableRunner #33061

Closed liferoad closed 1 week ago

liferoad commented 2 weeks ago

Tested this locally by building the beam-flink-runner container image and running the simple test.

Created flink-conf/flink-conf.yaml and the yaml file contains:

parallelism.default: 23
taskmanager.memory.network.fraction: 0.2
taskmanager.memory.network.max: 2gb

Then started the container:

docker run --net=host -v /path/flink-conf:/flink-conf beam-flink-runner

Simple test:

import apache_beam as beam

from apache_beam.options.pipeline_options import PipelineOptions

options = PipelineOptions([
    "--runner=PortableRunner",
    "--job_endpoint=localhost:8099",
    "--environment_type=LOOPBACK"
])

with beam.Pipeline(options=options) as pipeline:
  elements = pipeline | beam.Create([1, 2, 3, 4, 5])

  # Use Map to apply a function to each element
  elements | 'Print elements' >> beam.Map(print)

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

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.

github-actions[bot] commented 2 weeks ago

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

R: @damccorm for label website.

Available commands:

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

liferoad commented 4 days ago

Add a note here: no need to change the docker entrypoint. We can pass in --flink-conf-dir /flink-conf directly when calling docker run. See #33182