use of mesos.internal.Messages.FrameworkToExecutorMessage in project jesos by groupon.
the class LocalExecutorMessageProcessor method frameworkToExecutor.
@Subscribe
public void frameworkToExecutor(final FrameworkToExecutorMessageEnvelope 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 FrameworkToExecutorMessage 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.frameworkMessage(executorDriver, message.getData().toByteArray());
}
@Override
public String toString() {
return "callback for frameworkMessage()";
}
};
}
});
}
use of mesos.internal.Messages.FrameworkToExecutorMessage in project jesos by groupon.
the class InternalSchedulerDriver method sendFrameworkMessage.
@Override
public Status sendFrameworkMessage(final ExecutorID executorId, final SlaveID slaveId, final byte[] data) {
checkNotNull(executorId, "executorId is null");
checkNotNull(slaveId, "slaveId is null");
checkNotNull(data, "data is null");
if (!context.isStateMachine(DRIVER_RUNNING)) {
return context.getStateMachine();
}
final FrameworkToExecutorMessage message = FrameworkToExecutorMessage.newBuilder().setFrameworkId(context.getFrameworkId()).setExecutorId(executorId).setSlaveId(slaveId).setData(ByteString.copyFrom(data)).build();
// directly to the slave, otherwise to the master and let the master sort it out.
if (context.containsSlave(message.getSlaveId())) {
final UPID slave = context.getSlaveUPID(message.getSlaveId());
eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), slave, message));
} else {
eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));
}
return context.getStateMachine();
}
Aggregations