Skip to content

Update PortableTimersExecutionTest to use PAssert, to prevent a concurrency issue, collecting the pipeline results - #7214

Merged
mxm merged 2 commits into
apache:masterfrom
ajamato:java_sdk_metrics_enqueuing_receiver_fixup_flink_test
Dec 6, 2018
Merged

mxm merged 2 commits into
apache:masterfrom
ajamato:java_sdk_metrics_enqueuing_receiver_fixup_flink_test

Conversation

@ajamato

@ajamato ajamato commented Dec 5, 2018

Copy link
Copy Markdown

…rrency issue collecting the test results.

Please add a meaningful description for your change here


Follow this checklist to help us incorporate your contribution quickly and easily:

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

It will help us expedite review of your Pull Request if you tag someone (e.g. @username) to look at it.

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
Python Build Status --- Build Status
Build Status
Build Status --- --- ---

@ajamato
ajamato force-pushed the java_sdk_metrics_enqueuing_receiver_fixup_flink_test branch from a4617b6 to a466104 Compare December 5, 2018 21:14
@ajamato

ajamato commented Dec 5, 2018

Copy link
Copy Markdown
Author

@mxm @lukecwik

.apply(ParDo.of(collectResults));
PCollection<KV<String, Integer>> output =
pipeline.apply(Impulse.create()).apply(ParDo.of(inputFn)).apply(ParDo.of(testFn));
PAssert.that(output).containsInAnyOrder(expectedOutput);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 to use PAssert to verify result of a Pipeline.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@mxm mxm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @ajamato. That makes the test much cleaner. Left some minor comments inline.

jobInvocation.start();
long timeout = System.currentTimeMillis() + 60 * 1000;
long timeout = System.currentTimeMillis() + 2 * 60 * 1000;
while (jobInvocation.getState() != Enum.DONE && System.currentTimeMillis() < timeout) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To further improve this test: We can remove the timeout related logic here. The test already has a timeout set above.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

while (jobInvocation.getState() != Enum.DONE && System.currentTimeMillis() < timeout) {
Thread.sleep(1000);
}
assertThat(jobInvocation.getState(), is(Enum.DONE));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can also remove this line if we remove the timeout because the while loop will only return when it is done.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

.apply(ParDo.of(collectResults));
PCollection<KV<String, Integer>> output =
pipeline.apply(Impulse.create()).apply(ParDo.of(inputFn)).apply(ParDo.of(testFn));
PAssert.that(output).containsInAnyOrder(expectedOutput);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@ajamato

ajamato commented Dec 6, 2018

Copy link
Copy Markdown
Author

@mxm I made the change that you suggested above. Would you please merge this once the presubmit finishes.

Thanks again.

@mxm

mxm commented Dec 6, 2018

Copy link
Copy Markdown
Contributor

Thank you @ajamato! Will merge when I have green light.

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.

3 participants