use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.
the class DataLocalityTaskSchedulerTest method createWorkPlan2.
private WorkerPlan createWorkPlan2(int workers) {
WorkerPlan plan = new WorkerPlan();
for (int i = workers - 1; i >= 0; i--) {
Worker w = new Worker(i);
w.addProperty("bandwidth", 1000.0);
w.addProperty("latency", 0.1);
plan.addWorker(w);
}
return plan;
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.
the class BatchTaskSchedulerTest method testUniqueSchedules6.
@Test
public void testUniqueSchedules6() {
int parallel = 200;
int workers = 400;
ComputeGraph[] graph = new ComputeGraph[3];
Arrays.setAll(graph, i -> createGraphWithDifferentParallelism(parallel, "graph" + i));
BatchTaskScheduler scheduler = new BatchTaskScheduler();
scheduler.initialize(Config.newBuilder().build());
WorkerPlan workerPlan = createWorkPlan(workers);
Map<String, TaskSchedulePlan> plan1 = scheduler.schedule(workerPlan, graph[0], graph[1]);
for (Map.Entry<String, TaskSchedulePlan> taskSchedulePlanEntry : plan1.entrySet()) {
TaskSchedulePlan plan2 = taskSchedulePlanEntry.getValue();
Map<Integer, WorkerSchedulePlan> containersMap = plan2.getContainersMap();
int index = 0;
for (Map.Entry<Integer, WorkerSchedulePlan> entry : containersMap.entrySet()) {
WorkerSchedulePlan workerSchedulePlan = entry.getValue();
Set<TaskInstancePlan> containerPlanTaskInstances = workerSchedulePlan.getTaskInstances();
index++;
if (index <= parallel) {
Assert.assertEquals(containerPlanTaskInstances.size(), workers / parallel);
} else {
Assert.assertEquals(containerPlanTaskInstances.size(), 0);
}
}
}
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.
the class BatchTaskSchedulerTest method testUniqueSchedules4.
@Test
public void testUniqueSchedules4() {
int parallel = 400;
int workers = 200;
ComputeGraph[] graph = new ComputeGraph[3];
Arrays.setAll(graph, i -> createGraph(parallel, "graph" + i));
BatchTaskScheduler scheduler = new BatchTaskScheduler();
scheduler.initialize(Config.newBuilder().build());
WorkerPlan workerPlan = createWorkPlan(workers);
Map<String, TaskSchedulePlan> taskSchedulePlanMap = scheduler.schedule(workerPlan, graph[0], graph[1], graph[2]);
for (Map.Entry<String, TaskSchedulePlan> taskSchedulePlanEntry : taskSchedulePlanMap.entrySet()) {
TaskSchedulePlan taskSchedulePlan = taskSchedulePlanEntry.getValue();
Map<Integer, WorkerSchedulePlan> containersMap = taskSchedulePlan.getContainersMap();
for (Map.Entry<Integer, WorkerSchedulePlan> entry : containersMap.entrySet()) {
WorkerSchedulePlan workerSchedulePlan = entry.getValue();
Set<TaskInstancePlan> containerPlanTaskInstances = workerSchedulePlan.getTaskInstances();
Assert.assertEquals(containerPlanTaskInstances.size(), (parallel / workers) * graph[0].getTaskVertexSet().size());
}
}
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.
the class TaskSchedulerTest method createWorkPlan.
private WorkerPlan createWorkPlan(int workers) {
WorkerPlan plan = new WorkerPlan();
for (int i = 0; i < workers; i++) {
Worker w = new Worker(i);
w.addProperty("bandwidth", 1000.0);
w.addProperty("latency", 0.1);
plan.addWorker(w);
}
return plan;
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.
the class TaskExecutor method createWorkerPlan.
private WorkerPlan createWorkerPlan() {
List<Worker> workers = new ArrayList<>();
for (JobMasterAPI.WorkerInfo workerInfo : workerInfoList) {
Worker w = new Worker(workerInfo.getWorkerID());
workers.add(w);
}
return new WorkerPlan(workers);
}
Aggregations