use of edu.iu.dsc.tws.comms.stream.SKeyedGather in project twister2 by DSC-SPIDAL.
the class SKeyedGatherExample method compute.
@Override
protected void compute(WorkerEnvironment workerEnv) {
LogicalPlanBuilder logicalPlanBuilder = LogicalPlanBuilder.plan(jobParameters.getSources(), jobParameters.getTargets(), workerEnv).withFairDistribution();
keyedGather = new SKeyedGather(workerEnv.getCommunicator(), logicalPlanBuilder, MessageTypes.OBJECT, MessageTypes.OBJECT, new GatherBulkReceiver(), new LoadBalanceSelector());
Set<Integer> sourceTasks = logicalPlanBuilder.getSourcesOnThisWorker();
for (int t : sourceTasks) {
finishedSources.put(t, false);
}
if (sourceTasks.size() == 0) {
sourcesDone = true;
}
Set<Integer> sinkTasks = logicalPlanBuilder.getTargetsOnThisWorker();
LOG.log(Level.INFO, String.format("Worker[%d], Source Tasks %s , Sink Tasks %s", workerId, sourceTasks, sinkTasks));
// now initialize the workers
for (int t : sourceTasks) {
// the map thread where data is produced
MapWorker mapWorker = new MapWorker(t);
mapWorker.setTimingForLowestTargetOnly(true);
Thread mapThread = new Thread(mapWorker);
mapThread.start();
}
}
Aggregations