Search in sources :

Example 1 with DeterministicTaskPartitioner

use of edu.iu.dsc.tws.examples.utils.partitioners.DeterministicTaskPartitioner in project twister2 by DSC-SPIDAL.

the class BTPartitionKeyedExample method buildTaskGraph.

@Override
public ComputeGraphBuilder buildTaskGraph() {
    List<Integer> taskStages = jobParameters.getTaskStages();
    int sourceParallelism = taskStages.get(0);
    int sinkParallelism = taskStages.get(1);
    MessageType keyType = MessageTypes.INTEGER;
    MessageType dataType = MessageTypes.INTEGER_ARRAY;
    String edge = "edge";
    BaseSource g = new SourceTask(edge, true);
    ICompute r = new BKeyedPartitionSinkTask();
    computeGraphBuilder.addSource(SOURCE, g, sourceParallelism);
    computeConnection = computeGraphBuilder.addCompute(SINK, r, sinkParallelism);
    computeConnection.keyedPartition(SOURCE).viaEdge(edge).withKeyType(keyType).withTaskPartitioner(new DeterministicTaskPartitioner()).withDataType(dataType);
    return computeGraphBuilder;
}
Also used : BaseSource(edu.iu.dsc.tws.api.compute.nodes.BaseSource) DeterministicTaskPartitioner(edu.iu.dsc.tws.examples.utils.partitioners.DeterministicTaskPartitioner) ICompute(edu.iu.dsc.tws.api.compute.nodes.ICompute) MessageType(edu.iu.dsc.tws.api.comms.messaging.types.MessageType)

Aggregations

MessageType (edu.iu.dsc.tws.api.comms.messaging.types.MessageType)1 BaseSource (edu.iu.dsc.tws.api.compute.nodes.BaseSource)1 ICompute (edu.iu.dsc.tws.api.compute.nodes.ICompute)1 DeterministicTaskPartitioner (edu.iu.dsc.tws.examples.utils.partitioners.DeterministicTaskPartitioner)1