@Override public void finishBundle() { doFnRunner.finishBundle(); }
@Override public void finishBundle() { notReadyWindows = null; underlying.finishBundle(); } }
@Override public void finishBundle() { doFnRunner.finishBundle(); }
@Override public void finishBundle() { underlying.finishBundle(); }
/** * Finish bundle without checking for conditions. */ final void forceFinishBundle() { if (!bundleFinished) { bundleFinished = true; if (pushBackRunner == null) { doFnRunner.finishBundle(); } else { pushBackRunner.finishBundle(); } } }
/** * Checks whether it is time to finish the bundle and finish it. */ final void checkAndFinishBundle() { if (!bundleFinished) { if (currBundleCount >= bundleSize || System.currentTimeMillis() - prevBundleStartTime >= bundleMillis) { bundleFinished = true; if (pushBackRunner == null) { doFnRunner.finishBundle(); } else { pushBackRunner.finishBundle(); } } } }
@Override public void finishBundle() { try (Closeable ignored = MetricsEnvironment.scopedMetricsContainer(metricsContainer())) { delegate.finishBundle(); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void finishBundle() { try (Closeable ignored = MetricsEnvironment.scopedMetricsContainer(container.getMetricsContainer(stepName))) { delegate.finishBundle(); } catch (IOException e) { throw new RuntimeException(e); } // update metrics container.updateMetrics(stepName); }
@Override public void finishBundle() { try (Closeable ignored = MetricsEnvironment.scopedMetricsContainer(container.getMetricsContainer(stepName))) { delegate.finishBundle(); } catch (IOException e) { throw new RuntimeException(e); } // update metrics container.updateMetrics(stepName); }
@Override public void finishBundle() { try (Closeable ignored = MetricsEnvironment.scopedMetricsContainer(container.getMetricsContainer(stepName))) { delegate.finishBundle(); } catch (IOException e) { throw new RuntimeException(e); } // update metrics container.updateMetrics(); } }
@Test public void testFinishBundleExceptionsWrappedAsUserCodeException() { ThrowingDoFn fn = new ThrowingDoFn(); DoFnRunner<String, String> runner = new SimpleDoFnRunner<>( null, fn, NullSideInputReader.empty(), null, null, Collections.emptyList(), mockStepContext, null, Collections.emptyMap(), WindowingStrategy.of(new GlobalWindows())); thrown.expect(UserCodeException.class); thrown.expectCause(is(fn.exceptionToThrow)); runner.finishBundle(); }
doFnRunner.finishBundle();
doFnRunner.finishBundle();
@Test public void testLateDropping() throws Exception { MetricsContainerImpl container = new MetricsContainerImpl("any"); MetricsEnvironment.setCurrentContainer(container); timerInternals.advanceInputWatermark(new Instant(BoundedWindow.TIMESTAMP_MAX_VALUE)); timerInternals.advanceOutputWatermark(new Instant(BoundedWindow.TIMESTAMP_MAX_VALUE)); DoFn<KV<String, Integer>, Integer> fn = new MyDoFn(); DoFnRunner<KV<String, Integer>, Integer> runner = DoFnRunners.defaultStatefulDoFnRunner( fn, getDoFnRunner(fn), WINDOWING_STRATEGY, new StatefulDoFnRunner.TimeInternalsCleanupTimer(timerInternals, WINDOWING_STRATEGY), new StatefulDoFnRunner.StateInternalsStateCleaner<>( fn, stateInternals, (Coder) WINDOWING_STRATEGY.getWindowFn().windowCoder())); runner.startBundle(); IntervalWindow window = new IntervalWindow(new Instant(0), new Instant(0L + WINDOW_SIZE)); Instant timestamp = new Instant(0); runner.processElement( WindowedValue.of(KV.of("hello", 1), timestamp, window, PaneInfo.NO_FIRING)); long droppedValues = container .getCounter( MetricName.named( StatefulDoFnRunner.class, StatefulDoFnRunner.DROPPED_DUE_TO_LATENESS_COUNTER)) .getCumulative(); assertEquals(1L, droppedValues); runner.finishBundle(); }