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-6859] align teardown with setup calls also for empty streaming … #8443

Merged
merged 1 commit into from May 3, 2019

Conversation

adude3141
Copy link
Contributor

…batches

This PR aligns teardown with setup calls. Currently, for empty batches in streaming for DoFns setup is called, but teardown isn't. [1]

This PR removes the call to setup. An alternative implementation could be to add

diff --git a/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java b/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java
index 830778fe95..97a4c288d9 100644
--- a/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java
+++ b/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java
@@ -58,6 +58,7 @@ class SparkProcessContext<FnInputT, FnOutputT, OutputT> {
 
     // skip if partition is empty.
     if (!partition.hasNext()) {
+      DoFnInvokers.invokerFor(doFn).invokeTeardown();
       return new ArrayList<>();
     }

This was implemented before, but the call to teardown was dropped and afterwards the call to setup was moved on some refactoring so that this issue was accidentally introduced.

[1] https://issues.apache.org/jira/browse/BEAM-6859


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.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java 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 --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable 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.

@adude3141
Copy link
Contributor Author

R: @echauchot

@echauchot
Copy link
Contributor

Thanks for this fix @adude3141

@echauchot
Copy link
Contributor

Run Spark ValidatesRunner

Copy link
Contributor

@echauchot echauchot left a comment

Choose a reason for hiding this comment

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

LGTM, waiting for the validates runner tests to merge the PR

@echauchot echauchot merged commit 0606ba8 into apache:master May 3, 2019
@adude3141 adude3141 deleted the BEAM-6859 branch May 3, 2019 15:40
@adude3141
Copy link
Contributor Author

Thx for your review, @echauchot

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