Search in sources :

Example 1 with RunTaskMessage

use of mesos.internal.Messages.RunTaskMessage in project jesos by groupon.

the class LocalExecutorMessageProcessor method runTask.

@Subscribe
public void runTask(final RunTaskMessageEnvelope envelope) {
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");
    if (context.isStateMachine(DRIVER_ABORTED)) {
        LOG.warn("driver is aborted!");
        return;
    }
    final RunTaskMessage message = envelope.getMessage();
    final TaskInfo task = message.getTask();
    checkState(!tasks.containsKey(task.getTaskId()), "Task %s already started!", task.getTaskId().getValue());
    tasks.put(task.getTaskId(), task);
    eventBus.post(new ExecutorCallback() {

        @Override
        public Runnable getCallback(final Executor executor, final ExecutorDriver executorDriver) {
            return new Runnable() {

                @Override
                public void run() {
                    executor.launchTask(executorDriver, task);
                }

                @Override
                public String toString() {
                    return "callback for launchTask()";
                }
            };
        }
    });
}
Also used : TaskInfo(org.apache.mesos.Protos.TaskInfo) Executor(org.apache.mesos.Executor) RunTaskMessage(mesos.internal.Messages.RunTaskMessage) ExecutorDriver(org.apache.mesos.ExecutorDriver) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)1 RunTaskMessage (mesos.internal.Messages.RunTaskMessage)1 Executor (org.apache.mesos.Executor)1 ExecutorDriver (org.apache.mesos.ExecutorDriver)1 TaskInfo (org.apache.mesos.Protos.TaskInfo)1