kennknowles commented on a change in pull request #4153: [BEAM-3219]
DataflowRunner: delegate @Setup and @Teardown in stateful ParDo
URL: https://github.com/apache/beam/pull/4153#discussion_r153380128
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoLifecycleTest.java
##########
@@ -204,25 +224,63 @@ public void after() {
}
}
- @Test
- @Category(NeedsRunner.class)
- public void testTeardownCalledAfterExceptionInSetup() {
- ExceptionThrowingOldFn fn = new
ExceptionThrowingOldFn(MethodForException.SETUP);
- p
- .apply(Create.of(1, 2, 3))
- .apply(ParDo.of(fn));
- try {
- p.run();
- fail("Pipeline should have failed with an exception");
- } catch (Exception e) {
- assertThat(
- "Function should have been torn down after exception",
- ExceptionThrowingOldFn.teardownCalled.get(),
- is(true));
+ private static class CallSequenceEnforcingStatefulFn<K, V> extends
DoFn<KV<K, V>, KV<K, V>> {
Review comment:
Done. Confirmed that the test still fails without the fix and succeeds with
the fix, just for good measure.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services