Search in sources :

Example 1 with KillTaskMessage

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

the class LocalExecutorMessageProcessor method killTask.

@Subscribe
public void killTask(final KillTaskMessageEnvelope 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 KillTaskMessage message = envelope.getMessage();
    eventBus.post(new ExecutorCallback() {

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

                @Override
                public void run() {
                    executor.killTask(executorDriver, message.getTaskId());
                }

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

Example 2 with KillTaskMessage

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

the class InternalSchedulerDriver method killTask.

@Override
public Status killTask(final TaskID taskId) {
    checkNotNull(taskId, "taskId is null");
    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }
    final KillTaskMessage message = KillTaskMessage.newBuilder().setFrameworkId(context.getFrameworkId()).setTaskId(taskId).build();
    eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));
    return context.getStateMachine();
}
Also used : KillTaskMessage(mesos.internal.Messages.KillTaskMessage) RemoteMessageEnvelope(com.groupon.mesos.scheduler.SchedulerMessageEnvelope.RemoteMessageEnvelope)

Aggregations

KillTaskMessage (mesos.internal.Messages.KillTaskMessage)2 Subscribe (com.google.common.eventbus.Subscribe)1 RemoteMessageEnvelope (com.groupon.mesos.scheduler.SchedulerMessageEnvelope.RemoteMessageEnvelope)1 Executor (org.apache.mesos.Executor)1 ExecutorDriver (org.apache.mesos.ExecutorDriver)1