use of edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan in project twister2 by DSC-SPIDAL.
the class RoundRobinTaskSchedulerTest method testUniqueSchedules2.
@Test
public void testUniqueSchedules2() {
int parallel = 256;
ComputeGraph graph = createGraph(parallel);
RoundRobinTaskScheduler scheduler = new RoundRobinTaskScheduler();
scheduler.initialize(Config.newBuilder().build());
WorkerPlan workerPlan = createWorkPlan(parallel);
TaskSchedulePlan plan1 = scheduler.schedule(graph, workerPlan);
WorkerPlan workerPlan2 = createWorkPlan2(parallel);
for (int i = 0; i < 1000; i++) {
TaskSchedulePlan plan2 = scheduler.schedule(graph, workerPlan2);
Assert.assertEquals(plan1.getContainers().size(), plan2.getContainers().size());
Map<Integer, WorkerSchedulePlan> map2 = plan2.getContainersMap();
for (WorkerSchedulePlan workerSchedulePlan : plan1.getContainers()) {
WorkerSchedulePlan p2 = map2.get(workerSchedulePlan.getContainerId());
Assert.assertTrue(containerEquals(workerSchedulePlan, p2));
}
}
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan in project twister2 by DSC-SPIDAL.
the class RoundRobinTaskSchedulerTest method testUniqueSchedules.
@Test
public void testUniqueSchedules() {
int parallel = 256;
ComputeGraph graph = createGraph(parallel);
RoundRobinTaskScheduler scheduler = new RoundRobinTaskScheduler();
scheduler.initialize(Config.newBuilder().build());
WorkerPlan workerPlan = createWorkPlan(parallel);
for (int i = 0; i < 1; i++) {
TaskSchedulePlan plan1 = scheduler.schedule(graph, workerPlan);
TaskSchedulePlan plan2 = scheduler.schedule(graph, workerPlan);
Assert.assertEquals(plan1.getContainers().size(), plan2.getContainers().size());
Map<Integer, WorkerSchedulePlan> map2 = plan2.getContainersMap();
for (WorkerSchedulePlan workerSchedulePlan : plan1.getContainers()) {
WorkerSchedulePlan p2 = map2.get(workerSchedulePlan.getContainerId());
Assert.assertTrue(containerEquals(workerSchedulePlan, p2));
}
}
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan in project twister2 by DSC-SPIDAL.
the class DataLocalityBatchTaskSchedulerTest method testUniqueSchedules1.
@Test
public void testUniqueSchedules1() {
int parallel = 4;
int workers = 2;
ComputeGraph graph = createGraph(parallel);
DataLocalityBatchTaskScheduler scheduler = new DataLocalityBatchTaskScheduler();
Config config = getConfig();
scheduler.initialize(config);
generateData(config);
WorkerPlan workerPlan = createWorkPlan(workers);
TaskSchedulePlan plan1 = scheduler.schedule(graph, workerPlan);
WorkerPlan workerPlan2 = createWorkPlan2(workers);
for (int i = 0; i < 10; i++) {
TaskSchedulePlan plan2 = scheduler.schedule(graph, workerPlan2);
Assert.assertEquals(plan1.getContainers().size(), plan2.getContainers().size());
Map<Integer, WorkerSchedulePlan> containersMap = plan2.getContainersMap();
for (Map.Entry<Integer, WorkerSchedulePlan> entry : containersMap.entrySet()) {
WorkerSchedulePlan workerSchedulePlan = entry.getValue();
Set<TaskInstancePlan> containerPlanTaskInstances = workerSchedulePlan.getTaskInstances();
Assert.assertEquals(containerPlanTaskInstances.size() / graph.getTaskVertexSet().size(), TaskSchedulerContext.defaultTaskInstancesPerContainer(config));
}
}
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan in project twister2 by DSC-SPIDAL.
the class DataLocalityTaskSchedulerTest method testUniqueSchedules1.
@Test
public void testUniqueSchedules1() {
int parallel = 2;
int workers = 2;
ComputeGraph graph = createGraph(parallel);
DataLocalityStreamingTaskScheduler scheduler = new DataLocalityStreamingTaskScheduler();
Config config = getConfig();
scheduler.initialize(config, 1);
generateData(config);
WorkerPlan workerPlan = createWorkPlan(workers);
TaskSchedulePlan plan1 = scheduler.schedule(graph, workerPlan);
WorkerPlan workerPlan2 = createWorkPlan2(workers);
for (int i = 0; i < 10; i++) {
TaskSchedulePlan plan2 = scheduler.schedule(graph, workerPlan2);
Assert.assertEquals(plan1.getContainers().size(), plan2.getContainers().size());
Map<Integer, WorkerSchedulePlan> containersMap = plan2.getContainersMap();
for (Map.Entry<Integer, WorkerSchedulePlan> entry : containersMap.entrySet()) {
WorkerSchedulePlan workerSchedulePlan = entry.getValue();
Set<TaskInstancePlan> containerPlanTaskInstances = workerSchedulePlan.getTaskInstances();
Assert.assertEquals(containerPlanTaskInstances.size(), TaskSchedulerContext.defaultTaskInstancesPerContainer(config));
}
}
}
use of edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan in project twister2 by DSC-SPIDAL.
the class DataLocalityTaskSchedulerTest method testUniqueSchedules3.
@Test
public void testUniqueSchedules3() {
int parallel = 10;
int workers = 3;
ComputeGraph graph = createGraphWithComputeTaskAndConstraints(parallel);
DataLocalityStreamingTaskScheduler scheduler = new DataLocalityStreamingTaskScheduler();
Config config = getConfig();
scheduler.initialize(config, 1);
generateData(config);
WorkerPlan workerPlan = createWorkPlan(workers);
TaskSchedulePlan plan1 = scheduler.schedule(graph, workerPlan);
Assert.assertNotNull(plan1);
Map<Integer, WorkerSchedulePlan> containersMap = plan1.getContainersMap();
for (Map.Entry<Integer, WorkerSchedulePlan> entry : containersMap.entrySet()) {
WorkerSchedulePlan workerSchedulePlan = entry.getValue();
Set<TaskInstancePlan> containerPlanTaskInstances = workerSchedulePlan.getTaskInstances();
Assert.assertEquals(containerPlanTaskInstances.size(), Integer.parseInt(graph.getGraphConstraints().get(Context.TWISTER2_MAX_TASK_INSTANCES_PER_WORKER)));
}
}
Aggregations