use of edu.iu.dsc.tws.task.impl.ComputeGraphBuilder in project twister2 by DSC-SPIDAL.
the class RoundRobinTaskSchedulerTest method createGraphWithComputeTaskAndConstraints.
private ComputeGraph createGraphWithComputeTaskAndConstraints(int parallel) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource();
TaskSchedulerClassTest.TestCompute testCompute = new TaskSchedulerClassTest.TestCompute();
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink();
ComputeGraphBuilder computeGraphBuilder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
computeGraphBuilder.addSource("source", testSource, parallel);
ComputeConnection computeConnection = computeGraphBuilder.addCompute("compute", testCompute, parallel);
ComputeConnection sinkComputeConnection = computeGraphBuilder.addCompute("sink", testSink, parallel);
computeConnection.direct("source").viaEdge("cdirect-edge").withDataType(MessageTypes.OBJECT);
sinkComputeConnection.direct("compute").viaEdge("sdirect-edge").withDataType(MessageTypes.OBJECT);
computeGraphBuilder.setMode(OperationMode.STREAMING);
computeGraphBuilder.addGraphConstraints(Context.TWISTER2_MAX_TASK_INSTANCES_PER_WORKER, "24");
ComputeGraph taskGraph = computeGraphBuilder.build();
return taskGraph;
}
use of edu.iu.dsc.tws.task.impl.ComputeGraphBuilder in project twister2 by DSC-SPIDAL.
the class DataLocalityBatchTaskSchedulerTest method createGraphWithComputeTaskAndConstraints.
private ComputeGraph createGraphWithComputeTaskAndConstraints(int parallel) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource();
TaskSchedulerClassTest.TestCompute testCompute = new TaskSchedulerClassTest.TestCompute();
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink();
ComputeGraphBuilder builder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
builder.addSource("source", testSource, parallel);
ComputeConnection computeConnection = builder.addCompute("compute", testCompute, parallel);
ComputeConnection sinkConnection = builder.addCompute("sink", testSink, parallel);
computeConnection.direct("source").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
sinkConnection.direct("compute").viaEdge(Context.TWISTER2_DIRECT_EDGE).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.ComputeGraphBuilder 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.ComputeGraphBuilder 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.ComputeGraphBuilder 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;
}
Aggregations