use of edu.iu.dsc.tws.task.impl.ComputeConnection in project twister2 by DSC-SPIDAL.
the class DataLocalityBatchTaskSchedulerTest method createGraphWithMultipleComputeTaskAndConstraints.
private ComputeGraph createGraphWithMultipleComputeTaskAndConstraints(int parallel) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource();
TaskSchedulerClassTest.TestCompute firstTestCompute = new TaskSchedulerClassTest.TestCompute();
TaskSchedulerClassTest.TestComputeChild secondTestCompute = new TaskSchedulerClassTest.TestComputeChild();
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink();
ComputeGraphBuilder builder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
builder.addSource("source", testSource, parallel);
ComputeConnection firstComputeConnection = builder.addCompute("firstcompute", firstTestCompute, parallel);
ComputeConnection secondComputeConnection = builder.addCompute("secondcompute", secondTestCompute, parallel);
ComputeConnection sinkConnection = builder.addCompute("sink", testSink, parallel);
firstComputeConnection.direct("source").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
secondComputeConnection.direct("source").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
sinkConnection.allreduce("firstcompute").viaEdge("freduce").withReductionFunction(new TaskSchedulerClassTest.Aggregator()).withDataType(MessageTypes.OBJECT);
sinkConnection.allreduce("secondcompute").viaEdge("sreduce").withReductionFunction(new TaskSchedulerClassTest.Aggregator()).withDataType(MessageTypes.OBJECT);
builder.setMode(OperationMode.BATCH);
builder.addGraphConstraints(Context.TWISTER2_MAX_TASK_INSTANCES_PER_WORKER, "2");
ComputeGraph graph = builder.build();
return graph;
}
use of edu.iu.dsc.tws.task.impl.ComputeConnection in project twister2 by DSC-SPIDAL.
the class DataLocalityTaskSchedulerTest method createGraphWithConstraints.
private ComputeGraph createGraphWithConstraints(int parallel) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource();
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink();
ComputeGraphBuilder computeGraphBuilder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
computeGraphBuilder.addSource("source", testSource, parallel);
ComputeConnection computeConnection = computeGraphBuilder.addCompute("sink", testSink, parallel);
computeConnection.direct("source").viaEdge("direct-edge").withDataType(MessageTypes.OBJECT);
computeGraphBuilder.setMode(OperationMode.STREAMING);
computeGraphBuilder.addGraphConstraints(Context.TWISTER2_MAX_TASK_INSTANCES_PER_WORKER, "10");
ComputeGraph taskGraph = computeGraphBuilder.build();
return taskGraph;
}
use of edu.iu.dsc.tws.task.impl.ComputeConnection in project twister2 by DSC-SPIDAL.
the class DataLocalityTaskSchedulerTest method createGraph.
private ComputeGraph createGraph(int parallel) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource();
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink();
ComputeGraphBuilder computeGraphBuilder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
computeGraphBuilder.addSource("source", testSource, parallel);
ComputeConnection computeConnection = computeGraphBuilder.addCompute("sink", testSink, parallel);
computeConnection.direct("source").viaEdge("direct-edge").withDataType(MessageTypes.OBJECT);
computeGraphBuilder.setMode(OperationMode.STREAMING);
ComputeGraph taskGraph = computeGraphBuilder.build();
return taskGraph;
}
use of edu.iu.dsc.tws.task.impl.ComputeConnection in project twister2 by DSC-SPIDAL.
the class BatchTaskSchedulerTest method createGraph.
private ComputeGraph createGraph(int parallel, String graphName) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource();
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink();
ComputeGraphBuilder builder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
builder.addSource("source", testSource, parallel);
ComputeConnection sinkConnection = builder.addCompute("sink", testSink, parallel);
sinkConnection.direct("source").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
builder.setMode(OperationMode.BATCH);
ComputeGraph graph = builder.build();
graph.setGraphName(graphName);
return graph;
}
use of edu.iu.dsc.tws.task.impl.ComputeConnection in project twister2 by DSC-SPIDAL.
the class BatchTaskSchedulerTest method createGraphWithDifferentParallelismInput.
private ComputeGraph createGraphWithDifferentParallelismInput(int parallel, String graphName, String... inputKey) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource(inputKey[0]);
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink(inputKey[0]);
ComputeGraphBuilder builder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
builder.addSource("source", testSource, parallel);
ComputeConnection sinkConnection = builder.addCompute("sink", testSink, parallel);
sinkConnection.direct("source").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
builder.setMode(OperationMode.BATCH);
ComputeGraph graph = builder.build();
graph.setGraphName(graphName);
return graph;
}
Aggregations