Search in sources :

Example 1 with Twister2BoundedSource

use of org.apache.beam.runners.twister2.translation.wrappers.Twister2BoundedSource in project twister2 by DSC-SPIDAL.

the class ReadSourceTranslatorBatch method translateNode.

@Override
public void translateNode(Read.Bounded<T> transform, Twister2BatchTranslationContext context) {
    BoundedSource<T> boundedSource = transform.getSource();
    Twister2BoundedSource<T> twister2BoundedSource = new Twister2BoundedSource<T>(boundedSource, context, context.getOptions());
    final TSetEnvironment tsetEnv = context.getEnvironment();
    // TODO: need to set paralliem value
    SourceTSet<WindowedValue<T>> sourceTSet = ((BatchEnvironment) tsetEnv).createSource(twister2BoundedSource, 1);
    PCollection<T> output = context.getOutput(transform);
    context.setOutputDataSet(output, sourceTSet);
}
Also used : Twister2BoundedSource(org.apache.beam.runners.twister2.translation.wrappers.Twister2BoundedSource) WindowedValue(org.apache.beam.sdk.util.WindowedValue) BatchEnvironment(edu.iu.dsc.tws.tset.env.BatchEnvironment) TSetEnvironment(edu.iu.dsc.tws.tset.env.TSetEnvironment)

Example 2 with Twister2BoundedSource

use of org.apache.beam.runners.twister2.translation.wrappers.Twister2BoundedSource in project beam by apache.

the class ReadSourceTranslatorBatch method translateNode.

@Override
public void translateNode(SplittableParDo.PrimitiveBoundedRead<T> transform, Twister2BatchTranslationContext context) {
    BoundedSource<T> boundedSource = transform.getSource();
    Twister2BoundedSource<T> twister2BoundedSource = new Twister2BoundedSource<T>(boundedSource, context, context.getOptions());
    final TSetEnvironment tsetEnv = context.getEnvironment();
    SourceTSet<WindowedValue<T>> sourceTSet = ((BatchTSetEnvironment) tsetEnv).createSource(twister2BoundedSource, context.getOptions().getParallelism());
    PCollection<T> output = context.getOutput(transform);
    context.setOutputDataSet(output, sourceTSet);
}
Also used : Twister2BoundedSource(org.apache.beam.runners.twister2.translation.wrappers.Twister2BoundedSource) BatchTSetEnvironment(edu.iu.dsc.tws.tset.env.BatchTSetEnvironment) WindowedValue(org.apache.beam.sdk.util.WindowedValue) TSetEnvironment(edu.iu.dsc.tws.tset.env.TSetEnvironment) BatchTSetEnvironment(edu.iu.dsc.tws.tset.env.BatchTSetEnvironment)

Aggregations

TSetEnvironment (edu.iu.dsc.tws.tset.env.TSetEnvironment)2 Twister2BoundedSource (org.apache.beam.runners.twister2.translation.wrappers.Twister2BoundedSource)2 WindowedValue (org.apache.beam.sdk.util.WindowedValue)2 BatchEnvironment (edu.iu.dsc.tws.tset.env.BatchEnvironment)1 BatchTSetEnvironment (edu.iu.dsc.tws.tset.env.BatchTSetEnvironment)1