Search in sources :

Example 1 with Communicator

use of edu.iu.dsc.tws.api.comms.Communicator in project twister2 by DSC-SPIDAL.

the class CDFWRuntime method execute.

/**
 * execute
 */
public boolean execute() {
    Any msg;
    while (true) {
        msg = executeMessageQueue.peek();
        if (msg == null) {
            if (scaleUpRequest.get()) {
                communicator.close();
                List<JobMasterAPI.WorkerInfo> workerInfoList = initSynch(controller);
                // create the channel
                LOG.info("Existing workers calling barrier");
                channel = Network.initializeChannel(config, controller);
                String persistent = null;
                // create the communicator
                communicator = new Communicator(config, channel, persistent);
                taskExecutor = new TaskExecutor(config, workerId, workerInfoList, communicator, null);
            }
            scaleUpRequest.set(false);
            // scaleDownRequest.set(false);
            continue;
        }
        msg = executeMessageQueue.poll();
        if (msg.is(CDFWJobAPI.ExecuteMessage.class)) {
            if (handleExecuteMessage(msg)) {
                return false;
            }
        } else if (msg.is(CDFWJobAPI.CDFWJobCompletedMessage.class)) {
            LOG.log(Level.INFO, workerId + "Received CDFW job completed message. Leaving execution " + "loop");
            break;
        }
    }
    LOG.log(Level.INFO, workerId + " Execution Completed");
    return true;
}
Also used : Communicator(edu.iu.dsc.tws.api.comms.Communicator) TaskExecutor(edu.iu.dsc.tws.task.impl.TaskExecutor) CDFWJobAPI(edu.iu.dsc.tws.proto.system.job.CDFWJobAPI) Any(com.google.protobuf.Any)

Example 2 with Communicator

use of edu.iu.dsc.tws.api.comms.Communicator 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 3 with Communicator

use of edu.iu.dsc.tws.api.comms.Communicator 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)

Example 4 with Communicator

use of edu.iu.dsc.tws.api.comms.Communicator in project twister2 by DSC-SPIDAL.

the class WordCountWorker method setupNetwork.

private void setupNetwork(IWorkerController controller) {
    TWSChannel twsChannel = Network.initializeChannel(config, controller);
    this.channel = new Communicator(config, twsChannel);
}
Also used : Communicator(edu.iu.dsc.tws.api.comms.Communicator) TWSChannel(edu.iu.dsc.tws.api.comms.channel.TWSChannel)

Example 5 with Communicator

use of edu.iu.dsc.tws.api.comms.Communicator in project twister2 by DSC-SPIDAL.

the class CDFWRuntime method reinitialize.

private boolean reinitialize() {
    communicator.close();
    List<JobMasterAPI.WorkerInfo> workerInfoList = null;
    try {
        workerInfoList = controller.getAllWorkers();
    } catch (TimeoutException timeoutException) {
        LOG.log(Level.SEVERE, timeoutException.getMessage(), timeoutException);
    }
    // create the channel
    channel = Network.initializeChannel(config, controller);
    String persistent = null;
    // create the communicator
    communicator = new Communicator(config, channel, persistent);
    taskExecutor = new TaskExecutor(config, workerId, workerInfoList, communicator, null);
    return true;
}
Also used : Communicator(edu.iu.dsc.tws.api.comms.Communicator) TaskExecutor(edu.iu.dsc.tws.task.impl.TaskExecutor) TimeoutException(edu.iu.dsc.tws.api.exceptions.TimeoutException)

Aggregations

Communicator (edu.iu.dsc.tws.api.comms.Communicator)5 TWSChannel (edu.iu.dsc.tws.api.comms.channel.TWSChannel)3 TimeoutException (edu.iu.dsc.tws.api.exceptions.TimeoutException)3 ExecutionPlan (edu.iu.dsc.tws.api.compute.executor.ExecutionPlan)2 TaskSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan)2 WorkerPlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)2 ExecutionPlanBuilder (edu.iu.dsc.tws.executor.core.ExecutionPlanBuilder)2 ExecutorFactory (edu.iu.dsc.tws.executor.threading.ExecutorFactory)2 TaskExecutor (edu.iu.dsc.tws.task.impl.TaskExecutor)2 RoundRobinTaskScheduler (edu.iu.dsc.tws.tsched.streaming.roundrobin.RoundRobinTaskScheduler)2 Any (com.google.protobuf.Any)1 CDFWJobAPI (edu.iu.dsc.tws.proto.system.job.CDFWJobAPI)1