Search in sources :

Example 1 with SKeyedGather

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();
    }
}
Also used : SKeyedGather(edu.iu.dsc.tws.comms.stream.SKeyedGather) LogicalPlanBuilder(edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder) LoadBalanceSelector(edu.iu.dsc.tws.comms.selectors.LoadBalanceSelector)

Aggregations

LoadBalanceSelector (edu.iu.dsc.tws.comms.selectors.LoadBalanceSelector)1 SKeyedGather (edu.iu.dsc.tws.comms.stream.SKeyedGather)1 LogicalPlanBuilder (edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder)1