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

Move CombineValues override to non portable overrides #25106

Merged
merged 11 commits into from
Jan 23, 2023

Conversation

damccorm
Copy link
Contributor

Right now, running the following pipeline on Dataflow:

import logging

import apache_beam as beam
from apache_beam.options.pipeline_options import DebugOptions

def merge(vals):
    out = ""
    for v in vals:
        out += v
    return out

def run():
    pipeline_options = DebugOptions() 
    pipeline_options.dataflow_job_file = "path/to/dump/proto"

    with beam.Pipeline(options=pipeline_options) as p:
        (p
            | beam.Create([("key1", "foo"), ("key2", "bar"), ("key1", "baz")])
            | beam.GroupByKey()
            | beam.CombineValues(merge)
        )


if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    run()

succeeds when use_runner_v2 is not included as an experiment, but fails when it is. This is because the translation being done generates an invalid graph for the use_runner_v2 case: a portable pipeline shouldn't be using the overridden combine here.

This fixes the problem by moving the override to only occur when use_runner_v2 is not included


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.

@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Merging #25106 (13c8538) into master (e379c23) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #25106      +/-   ##
==========================================
+ Coverage   73.11%   73.13%   +0.01%     
==========================================
  Files         735      735              
  Lines       98161    98161              
==========================================
+ Hits        71774    71787      +13     
+ Misses      25024    25011      -13     
  Partials     1363     1363              
Flag Coverage Δ
python 82.68% <ø> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
...on/apache_beam/runners/dataflow/dataflow_runner.py 81.88% <ø> (+0.14%) ⬆️
sdks/python/apache_beam/transforms/combiners.py 93.05% <0.00%> (-0.39%) ⬇️
...ks/python/apache_beam/runners/worker/sdk_worker.py 89.08% <0.00%> (-0.17%) ⬇️
...s/python/apache_beam/io/gcp/bigquery_file_loads.py 87.38% <0.00%> (+0.22%) ⬆️
sdks/python/apache_beam/pipeline.py 92.42% <0.00%> (+0.29%) ⬆️
...hon/apache_beam/runners/worker/bundle_processor.py 93.54% <0.00%> (+0.37%) ⬆️
sdks/python/apache_beam/internal/dill_pickler.py 84.89% <0.00%> (+0.71%) ⬆️
...che_beam/runners/interactive/interactive_runner.py 91.77% <0.00%> (+1.26%) ⬆️
sdks/python/apache_beam/io/source_test_utils.py 89.86% <0.00%> (+1.38%) ⬆️
... and 2 more

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

@damccorm
Copy link
Contributor Author

Run Python 3.9 PostCommit

@github-actions
Copy link
Contributor

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

R: @AnandInguva 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).

@damccorm
Copy link
Contributor Author

R: @lukecwik

@github-actions
Copy link
Contributor

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

Copy link
Member

@lukecwik lukecwik left a comment

Choose a reason for hiding this comment

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

Can we add the described scenario as a new ValidatesRunner test to prevent a regression in the future?

@damccorm
Copy link
Contributor Author

Run Python 3.8 PostCommit

@damccorm
Copy link
Contributor Author

Run Python Dataflow V2 ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python Dataflow ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python 3.8 PostCommit

@damccorm
Copy link
Contributor Author

Run Python Dataflow ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python Dataflow V2 ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python 3.8 PostCommit

@damccorm
Copy link
Contributor Author

Run Python Dataflow V2 ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python Dataflow ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python 3.8 PostCommit

@damccorm
Copy link
Contributor Author

Run Python Dataflow V2 ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python Dataflow ValidatesRunner

@AnandInguva
Copy link
Contributor

stop reviewer notifications

@damccorm
Copy link
Contributor Author

Run Python 3.8 PostCommit

@damccorm
Copy link
Contributor Author

Run Python Dataflow V2 ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python Dataflow ValidatesRunner


from . import combinevalues

class CombineValuesIT(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest making this a validates runner test like:

def test_flatten_pcollections(self):

in ptransform_test.py

@damccorm
Copy link
Contributor Author

Run Python Dataflow V2 ValidatesRunner

@damccorm
Copy link
Contributor Author

Run Python Dataflow ValidatesRunner

@github-actions github-actions bot removed the examples label Jan 23, 2023
Copy link
Member

@lukecwik lukecwik left a comment

Choose a reason for hiding this comment

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

LGTM

sdks/python/apache_beam/transforms/combiners_test.py Outdated Show resolved Hide resolved
@damccorm damccorm merged commit 6029a57 into master Jan 23, 2023
@damccorm damccorm deleted the users/damccorm/combine branch January 23, 2023 20:41
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.

3 participants