Search in sources :

Example 1 with DataGenerator

use of edu.iu.dsc.tws.tsched.utils.DataGenerator in project twister2 by DSC-SPIDAL.

the class DataLocalityBatchTaskSchedulerTest method generateData.

private void generateData(Config config) {
    DataGenerator dataGenerator = new DataGenerator(config);
    dataGenerator.generate(new Path(String.valueOf(config.get(DataObjectConstants.DINPUT_DIRECTORY))), Integer.parseInt(String.valueOf(config.get(DataObjectConstants.DSIZE))), Integer.parseInt(String.valueOf(config.get(DataObjectConstants.DIMENSIONS))));
}
Also used : Path(edu.iu.dsc.tws.api.data.Path) DataGenerator(edu.iu.dsc.tws.tsched.utils.DataGenerator)

Example 2 with DataGenerator

use of edu.iu.dsc.tws.tsched.utils.DataGenerator in project twister2 by DSC-SPIDAL.

the class DataLocalityBatchTaskSchedulerTest method testUniqueSchedules2.

@Test
public void testUniqueSchedules2() {
    int parallel = 4;
    int workers = 2;
    ComputeGraph graph = createGraphWithConstraints(parallel);
    DataLocalityBatchTaskScheduler scheduler = new DataLocalityBatchTaskScheduler();
    Config config = getConfig();
    scheduler.initialize(config, 1);
    generateData(config);
    DataGenerator dataGenerator = new DataGenerator(config);
    dataGenerator.generate(new Path(String.valueOf(config.get(DataObjectConstants.DINPUT_DIRECTORY))), 1000, 2);
    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();
        LOG.info("container plan instances and parallel:" + containerPlanTaskInstances.size() + "\t" + parallel);
        Assert.assertEquals(containerPlanTaskInstances.size(), parallel);
    }
}
Also used : Path(edu.iu.dsc.tws.api.data.Path) ComputeGraph(edu.iu.dsc.tws.api.compute.graph.ComputeGraph) Config(edu.iu.dsc.tws.api.config.Config) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan) TaskSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan) WorkerSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerSchedulePlan) TaskInstancePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskInstancePlan) DataGenerator(edu.iu.dsc.tws.tsched.utils.DataGenerator) DataLocalityBatchTaskScheduler(edu.iu.dsc.tws.tsched.batch.datalocalityaware.DataLocalityBatchTaskScheduler) Map(java.util.Map) Test(org.junit.Test) TaskSchedulerClassTest(edu.iu.dsc.tws.tsched.utils.TaskSchedulerClassTest)

Example 3 with DataGenerator

use of edu.iu.dsc.tws.tsched.utils.DataGenerator in project twister2 by DSC-SPIDAL.

the class DataLocalityBatchTaskSchedulerTest method testUniqueSchedules3.

@Test
public void testUniqueSchedules3() {
    int parallel = 4;
    int workers = 2;
    ComputeGraph graph = createGraphWithComputeTaskAndConstraints(parallel);
    DataLocalityBatchTaskScheduler scheduler = new DataLocalityBatchTaskScheduler();
    Config config = getConfig();
    scheduler.initialize(config, 1);
    generateData(config);
    DataGenerator dataGenerator = new DataGenerator(config);
    dataGenerator.generate(new Path(String.valueOf(config.get(DataObjectConstants.DINPUT_DIRECTORY))), 1000, 2);
    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();
        LOG.info("container plan instances and parallel:" + containerPlanTaskInstances.size() + "\t" + workers * graph.getTaskVertexSet().size());
        Assert.assertEquals(containerPlanTaskInstances.size(), workers * graph.getTaskVertexSet().size());
    }
}
Also used : Path(edu.iu.dsc.tws.api.data.Path) ComputeGraph(edu.iu.dsc.tws.api.compute.graph.ComputeGraph) Config(edu.iu.dsc.tws.api.config.Config) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan) TaskSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan) WorkerSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerSchedulePlan) TaskInstancePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskInstancePlan) DataGenerator(edu.iu.dsc.tws.tsched.utils.DataGenerator) DataLocalityBatchTaskScheduler(edu.iu.dsc.tws.tsched.batch.datalocalityaware.DataLocalityBatchTaskScheduler) Map(java.util.Map) Test(org.junit.Test) TaskSchedulerClassTest(edu.iu.dsc.tws.tsched.utils.TaskSchedulerClassTest)

Example 4 with DataGenerator

use of edu.iu.dsc.tws.tsched.utils.DataGenerator in project twister2 by DSC-SPIDAL.

the class DataLocalityTaskSchedulerTest method generateData.

private void generateData(Config config) {
    DataGenerator dataGenerator = new DataGenerator(config);
    dataGenerator.generate(new Path(String.valueOf(config.get(DataObjectConstants.DINPUT_DIRECTORY))), Integer.parseInt(String.valueOf(config.get(DataObjectConstants.DSIZE))), Integer.parseInt(String.valueOf(config.get(DataObjectConstants.DIMENSIONS))));
}
Also used : Path(edu.iu.dsc.tws.api.data.Path) DataGenerator(edu.iu.dsc.tws.tsched.utils.DataGenerator)

Aggregations

Path (edu.iu.dsc.tws.api.data.Path)4 DataGenerator (edu.iu.dsc.tws.tsched.utils.DataGenerator)4 ComputeGraph (edu.iu.dsc.tws.api.compute.graph.ComputeGraph)2 TaskInstancePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskInstancePlan)2 TaskSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan)2 WorkerPlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)2 WorkerSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerSchedulePlan)2 Config (edu.iu.dsc.tws.api.config.Config)2 DataLocalityBatchTaskScheduler (edu.iu.dsc.tws.tsched.batch.datalocalityaware.DataLocalityBatchTaskScheduler)2 TaskSchedulerClassTest (edu.iu.dsc.tws.tsched.utils.TaskSchedulerClassTest)2 Map (java.util.Map)2 Test (org.junit.Test)2