Search in sources :

Example 1 with WorkerPlan

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);
}
Also used : JobMasterAPI(edu.iu.dsc.tws.proto.jobmaster.JobMasterAPI) ArrayList(java.util.ArrayList) Worker(edu.iu.dsc.tws.api.compute.schedule.elements.Worker) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)

Example 2 with WorkerPlan

use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.

the class TaskExecutor method plan.

/**
 * Create an execution plan from the given graph
 *
 * @param graph task graph
 * @return the data set
 */
public ExecutionPlan plan(ComputeGraph graph) {
    TaskScheduler taskScheduler = new TaskScheduler();
    taskScheduler.initialize(config);
    WorkerPlan workerPlan = createWorkerPlan();
    TaskSchedulePlan taskSchedulePlan = taskScheduler.schedule(graph, workerPlan);
    ExecutionPlanBuilder executionPlanBuilder = new ExecutionPlanBuilder(workerID, workerInfoList, communicator, this.checkpointingClient);
    return executionPlanBuilder.build(config, graph, taskSchedulePlan);
}
Also used : TaskSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan) ExecutionPlanBuilder(edu.iu.dsc.tws.executor.core.ExecutionPlanBuilder) TaskScheduler(edu.iu.dsc.tws.tsched.taskscheduler.TaskScheduler) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)

Example 3 with WorkerPlan

use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.

the class TaskUtils method createWorkerPlan.

public static WorkerPlan createWorkerPlan(List<JobMasterAPI.WorkerInfo> workerInfoList) {
    List<Worker> workers = new ArrayList<>();
    for (JobMasterAPI.WorkerInfo workerInfo : workerInfoList) {
        Worker w = new Worker(workerInfo.getWorkerID());
        workers.add(w);
    }
    return new WorkerPlan(workers);
}
Also used : JobMasterAPI(edu.iu.dsc.tws.proto.jobmaster.JobMasterAPI) ArrayList(java.util.ArrayList) Worker(edu.iu.dsc.tws.api.compute.schedule.elements.Worker) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)

Example 4 with WorkerPlan

use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.

the class TaskUtils method execute.

public static void execute(Config config, int workerID, ComputeGraph graph, IWorkerController workerController) {
    RoundRobinTaskScheduler roundRobinTaskScheduler = new RoundRobinTaskScheduler();
    roundRobinTaskScheduler.initialize(config);
    List<JobMasterAPI.WorkerInfo> workerList = null;
    try {
        workerList = workerController.getAllWorkers();
    } catch (TimeoutException timeoutException) {
        LOG.log(Level.SEVERE, timeoutException.getMessage(), timeoutException);
        return;
    }
    WorkerPlan workerPlan = createWorkerPlan(workerList);
    TaskSchedulePlan taskSchedulePlan = roundRobinTaskScheduler.schedule(graph, workerPlan);
    TWSChannel network = Network.initializeChannel(config, workerController);
    ExecutionPlanBuilder executionPlanBuilder = new ExecutionPlanBuilder(workerID, workerList, new Communicator(config, network), workerController.getCheckpointingClient());
    ExecutionPlan plan = executionPlanBuilder.build(config, graph, taskSchedulePlan);
    ExecutorFactory executor = new ExecutorFactory(config, workerID, network);
    executor.getExecutor(config, plan, graph.getOperationMode()).execute();
}
Also used : TaskSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan) Communicator(edu.iu.dsc.tws.api.comms.Communicator) TWSChannel(edu.iu.dsc.tws.api.comms.channel.TWSChannel) ExecutionPlan(edu.iu.dsc.tws.api.compute.executor.ExecutionPlan) ExecutionPlanBuilder(edu.iu.dsc.tws.executor.core.ExecutionPlanBuilder) ExecutorFactory(edu.iu.dsc.tws.executor.threading.ExecutorFactory) RoundRobinTaskScheduler(edu.iu.dsc.tws.tsched.streaming.roundrobin.RoundRobinTaskScheduler) TimeoutException(edu.iu.dsc.tws.api.exceptions.TimeoutException) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)

Example 5 with WorkerPlan

use of edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan in project twister2 by DSC-SPIDAL.

the class TaskUtils method executeBatch.

public static void executeBatch(Config config, int workerID, ComputeGraph graph, IWorkerController workerController) {
    RoundRobinTaskScheduler roundRobinTaskScheduler = new RoundRobinTaskScheduler();
    roundRobinTaskScheduler.initialize(config);
    WorkerPlan workerPlan = null;
    List<JobMasterAPI.WorkerInfo> workerList = null;
    try {
        workerList = workerController.getAllWorkers();
    } catch (TimeoutException timeoutException) {
        LOG.log(Level.SEVERE, timeoutException.getMessage(), timeoutException);
        return;
    }
    workerPlan = createWorkerPlan(workerList);
    TaskSchedulePlan taskSchedulePlan = roundRobinTaskScheduler.schedule(graph, workerPlan);
    TWSChannel network = Network.initializeChannel(config, workerController);
    ExecutionPlanBuilder executionPlanBuilder = new ExecutionPlanBuilder(workerID, workerList, new Communicator(config, network), workerController.getCheckpointingClient());
    ExecutionPlan plan = executionPlanBuilder.build(config, graph, taskSchedulePlan);
    ExecutorFactory executor = new ExecutorFactory(config, workerID, network);
    executor.getExecutor(config, plan, graph.getOperationMode()).execute();
}
Also used : TaskSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan) Communicator(edu.iu.dsc.tws.api.comms.Communicator) TWSChannel(edu.iu.dsc.tws.api.comms.channel.TWSChannel) ExecutionPlan(edu.iu.dsc.tws.api.compute.executor.ExecutionPlan) ExecutionPlanBuilder(edu.iu.dsc.tws.executor.core.ExecutionPlanBuilder) ExecutorFactory(edu.iu.dsc.tws.executor.threading.ExecutorFactory) RoundRobinTaskScheduler(edu.iu.dsc.tws.tsched.streaming.roundrobin.RoundRobinTaskScheduler) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan) TimeoutException(edu.iu.dsc.tws.api.exceptions.TimeoutException)

Aggregations

WorkerPlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)36 TaskSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan)28 ComputeGraph (edu.iu.dsc.tws.api.compute.graph.ComputeGraph)24 TaskSchedulerClassTest (edu.iu.dsc.tws.tsched.utils.TaskSchedulerClassTest)23 Test (org.junit.Test)23 WorkerSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerSchedulePlan)20 TaskInstancePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskInstancePlan)18 Map (java.util.Map)18 Config (edu.iu.dsc.tws.api.config.Config)11 Worker (edu.iu.dsc.tws.api.compute.schedule.elements.Worker)8 DataLocalityBatchTaskScheduler (edu.iu.dsc.tws.tsched.batch.datalocalityaware.DataLocalityBatchTaskScheduler)4 ExecutionPlanBuilder (edu.iu.dsc.tws.executor.core.ExecutionPlanBuilder)3 DataLocalityStreamingTaskScheduler (edu.iu.dsc.tws.tsched.streaming.datalocalityaware.DataLocalityStreamingTaskScheduler)3 Communicator (edu.iu.dsc.tws.api.comms.Communicator)2 TWSChannel (edu.iu.dsc.tws.api.comms.channel.TWSChannel)2 TaskSchedulerException (edu.iu.dsc.tws.api.compute.exceptions.TaskSchedulerException)2 ExecutionPlan (edu.iu.dsc.tws.api.compute.executor.ExecutionPlan)2 Path (edu.iu.dsc.tws.api.data.Path)2 TimeoutException (edu.iu.dsc.tws.api.exceptions.TimeoutException)2 Twister2RuntimeException (edu.iu.dsc.tws.api.exceptions.Twister2RuntimeException)2