Navigation Menu

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

[BEAM-5605] Add support for channel splitting to the gRPC read "source" and propagate "split" calls to the downstream receiver #10501

Merged
merged 3 commits into from Jan 13, 2020

Conversation

lukecwik
Copy link
Member

@lukecwik lukecwik commented Jan 3, 2020

This code mirrors the logic/implementation within Python.

To be able to propagate the split call to the downstream receiver, I collapsed all the harness FnDataReceiver types into two existing implementations and one new implementation.
The previous hierarchy was:

element counting receiver -> time counting receiver -> multiplexing receiver (possibly the original receiver)

The current implementation combined the element counting, time counting and multiplexing into the MultiplexingMetricTrackingFnDataReceiver while for the singleton case into the MetricTrackingFnDataReceiver.

To propagate splits, a SplittingMetricTrackingFnDataReceiver was created that extends the MetricTrackingFnDataReceiver. Note, like in Python, there is currently no support for splitting a multiplexed consumer.


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

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

…e" and propagate "split" calls to the downstream receiver

This code mirrors the logic/implementation within https://github.com/apache/beam/blob/16757ef9a6da4d0ac218c6c4d6b19e2a49ccca45/sdks/python/apache_beam/runners/worker/bundle_processor.py#L206

To be able to propagate the split call to the downstream receiver, I collapsed all the harness FnDataReceiver types into two existing implementations and one new implementations.
The previous hierarchy was:
element counting receiver -> time counting receiver -> multiplexing receiver (possibly the original receiver)

The current implementation combined the element counting, time counting and multiplexing into the MultiplexingMetricTrackingFnDataReceiver while for the singleton case into the MetricTrackingFnDataReceiver.
To propagate splits, a SplittingMetricTrackingFnDataReceiver was created that extends the MetricTrackingFnDataReceiver. Note, like in Python, there is currently no support for splitting as in https://github.com/apache/beam/blob/c167d8ef99b21148bcab7c37538a6ef2f64864c7/sdks/python/apache_beam/runners/worker/operations.py#L133
@lukecwik
Copy link
Member Author

lukecwik commented Jan 3, 2020

R: @boyuanzz @robertwb

@lukecwik lukecwik force-pushed the splittabledofn branch 3 times, most recently from d0eb6dd to d541573 Compare January 7, 2020 00:21
@lukecwik
Copy link
Member Author

lukecwik commented Jan 7, 2020

Run Java PreCommit

@lukecwik lukecwik changed the title [BEAM-3684] Add support for channel splitting to the gRPC read "source" and propagate "split" calls to the downstream receiver [BEAM-5605] Add support for channel splitting to the gRPC read "source" and propagate "split" calls to the downstream receiver Jan 8, 2020
Copy link
Contributor

@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.

Thanks, looks good to me.

@@ -131,6 +137,11 @@
private final BeamFnDataClient beamFnDataClient;
private final Coder<WindowedValue<OutputT>> coder;

private final Object splittingLock = new Object();
// 0-based count of the number of elements
Copy link
Contributor

Choose a reason for hiding this comment

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

0 based index of the current element being processed(?).

private final Object splittingLock = new Object();
// 0-based count of the number of elements
private long index = -1;
// 0-based count of the number of elements
Copy link
Contributor

Choose a reason for hiding this comment

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

0-based index of the first element to not process. (Or is this the last element to process?)

Copy link
Member Author

Choose a reason for hiding this comment

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

first element to not process.

totalBufferSize = stopIndex;
}

// In the case where we have yet to process an element, set the current element progress to 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be an else clause below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Its logically the same where the else clause is the default based upon what we initialize.


// Compute the amount of "remaining" work that we know of.
double remainder = totalBufferSize - index - currentElementProgress;
// Compute the fraction of work that we should "keep".
Copy link
Contributor

Choose a reason for hiding this comment

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

Compute the number of elements that we should "keep."

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@lukecwik
Copy link
Member Author

Run Java PreCommit

1 similar comment
@lukecwik
Copy link
Member Author

Run Java PreCommit

@lukecwik lukecwik merged commit 35bf2bd into apache:master Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants