Search in sources :

Example 1 with ExecutorToFrameworkMessage

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

the class LocalSchedulerMessageProcessor method frameworkFrameworkMessage.

@Subscribe
public void frameworkFrameworkMessage(final ExecutorToFrameworkMessageEnvelope envelope) {
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");
    final UPID sender = envelope.getSender();
    if (!driverIsConnected(sender)) {
        return;
    }
    final ExecutorToFrameworkMessage executorToFrameworkMessage = envelope.getMessage();
    eventBus.post(new SchedulerCallback() {

        @Override
        public Runnable getCallback(final Scheduler scheduler, final SchedulerDriver schedulerDriver) {
            return new Runnable() {

                @Override
                public void run() {
                    scheduler.frameworkMessage(schedulerDriver, executorToFrameworkMessage.getExecutorId(), executorToFrameworkMessage.getSlaveId(), executorToFrameworkMessage.getData().toByteArray());
                }
            };
        }
    });
}
Also used : UPID(com.groupon.mesos.util.UPID) ExecutorToFrameworkMessage(mesos.internal.Messages.ExecutorToFrameworkMessage) Scheduler(org.apache.mesos.Scheduler) SchedulerDriver(org.apache.mesos.SchedulerDriver) Subscribe(com.google.common.eventbus.Subscribe)

Example 2 with ExecutorToFrameworkMessage

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

the class InternalExecutorDriver method sendFrameworkMessage.

@Override
public Status sendFrameworkMessage(final byte[] data) {
    checkNotNull(data, "data is null");
    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }
    final ExecutorToFrameworkMessage message = ExecutorToFrameworkMessage.newBuilder().setSlaveId(context.getSlaveId()).setFrameworkId(context.getFrameworkId()).setExecutorId(context.getExecutorId()).setData(ByteString.copyFrom(data)).build();
    eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getSlaveUPID(), message));
    return context.getStateMachine();
}
Also used : RemoteMessageEnvelope(com.groupon.mesos.executor.ExecutorMessageEnvelope.RemoteMessageEnvelope) ExecutorToFrameworkMessage(mesos.internal.Messages.ExecutorToFrameworkMessage)

Aggregations

ExecutorToFrameworkMessage (mesos.internal.Messages.ExecutorToFrameworkMessage)2 Subscribe (com.google.common.eventbus.Subscribe)1 RemoteMessageEnvelope (com.groupon.mesos.executor.ExecutorMessageEnvelope.RemoteMessageEnvelope)1 UPID (com.groupon.mesos.util.UPID)1 Scheduler (org.apache.mesos.Scheduler)1 SchedulerDriver (org.apache.mesos.SchedulerDriver)1