You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Draining a pipeline with source from PeriodicImpulse never ends. This happens for both Java and Python sdk.
In contrast, similar functionality GenericSequence which existing in Java supports drain.
Code snippets:
public class PeriodicImpulseTest {
public static void main(String[] argv) {
PipelineOptions options = PipelineOptionsFactory.fromArgs(argv).withValidation().as(PipelineOptions.class);
Pipeline p = Pipeline.create(options);
PCollection<Void> result =
p.apply(PeriodicImpulse.create().withInterval(Duration.millis(500)))
.apply(Reshuffle.viaRandomKey())
.apply(ParDo.of(new DoFn<Instant, Void>() {
@ProcessElement
public void processElement(DoFn<Instant, Void>.ProcessContext c){
System.out.println(c.element());
}}
));
assertThat(result.isBounded(), equalTo(IsBounded.UNBOUNDED));
p.run().waitUntilFinish();
}
}
Successful implementation using GenerateSequence:
public class GenerateSequenceTest {
public static void main(String[] argv) {
PipelineOptions options = PipelineOptionsFactory.fromArgs(argv).withValidation().as(PipelineOptions.class);
Pipeline p = Pipeline.create(options);
PCollection<Long> input = p.apply(GenerateSequence.from(0).withRate(1,
Duration.standardSeconds(1)));
input.apply(ParDo.of(new DoFn<Long, Void>() {
@ProcessElement
public void processElement(DoFn<Long, Void>.ProcessContext c){
System.out.println(c.element());
}}
));
p.run();
}
}
Issue Priority
Priority: 2
Issue Component
Component: sdk-java-core
The text was updated successfully, but these errors were encountered:
What happened?
Draining a pipeline with source from PeriodicImpulse never ends. This happens for both Java and Python sdk.
In contrast, similar functionality GenericSequence which existing in Java supports drain.
Code snippets:
Successful implementation using GenerateSequence:
Issue Priority
Priority: 2
Issue Component
Component: sdk-java-core
The text was updated successfully, but these errors were encountered: