use of edu.iu.dsc.tws.examples.verification.VerificationException in project twister2 by DSC-SPIDAL.
the class TSetReduceExample method execute.
@Override
public void execute(WorkerEnvironment workerEnv) {
super.execute(workerEnv);
BatchEnvironment env = TSetEnvironment.initBatch(workerEnv);
// set the parallelism of source to task stage 0
int srcPara = jobParameters.getTaskStages().get(0);
int sinkPara = jobParameters.getTaskStages().get(1);
SourceTSet<int[]> source = env.createSource(new TestBaseSource(), srcPara).setName("Source");
ReduceTLink<int[]> reduce = source.reduce((t1, t2) -> {
int[] val = new int[t1.length];
for (int i = 0; i < t1.length; i++) {
val[i] = t1[i] + t2[i];
}
return val;
});
SinkTSet<int[]> sink = reduce.sink(value -> {
experimentData.setOutput(value);
LOG.info("Result : " + Arrays.toString(value));
try {
verify(OperationNames.REDUCE);
} catch (VerificationException e) {
LOG.info("Exception Message : " + e.getMessage());
}
return true;
});
env.run(sink);
}
Aggregations