use of org.apache.mesos.Protos.ExecutorInfo in project incubator-myriad by apache.
the class ByteBufferSupportTest method testExecutorInfoToFromByteBuffer.
public void testExecutorInfoToFromByteBuffer() throws Exception {
ExecutorInfo info = getExecutorInfo();
ByteBuffer bb = ByteBufferSupport.toByteBuffer(task);
ExecutorInfo bInfo = ByteBufferSupport.toExecutorInfo(bb);
assertEquals(info.getClass().getName(), bInfo.getClass().getName());
}
use of org.apache.mesos.Protos.ExecutorInfo in project dcos-commons by mesosphere.
the class TaskPackingUtils method unpack.
/**
* This method reverses the work done in {@link TaskPackingUtils#pack(TaskInfo)} such that the original TaskInfo is
* regenerated. If the provided {@link TaskInfo} doesn't appear to have packed data then this operation does
* nothing.
*
* @see #pack(TaskInfo)
*/
public static TaskInfo unpack(TaskInfo taskInfo) {
if (!taskInfo.hasData() || !taskInfo.hasExecutor()) {
return taskInfo;
} else {
TaskInfo.Builder taskBuilder = TaskInfo.newBuilder(taskInfo);
ExecutorInfo pkgExecutorInfo;
try {
pkgExecutorInfo = ExecutorInfo.parseFrom(taskInfo.getData());
} catch (InvalidProtocolBufferException e) {
// ExecutorInfo. Let's assume this means that the TaskInfo isn't packed and return it as-is.
return taskInfo;
}
if (pkgExecutorInfo.hasCommand()) {
taskBuilder.setCommand(pkgExecutorInfo.getCommand());
}
if (pkgExecutorInfo.hasData()) {
taskBuilder.setData(pkgExecutorInfo.getData());
} else {
taskBuilder.clearData();
}
return taskBuilder.build();
}
}
use of org.apache.mesos.Protos.ExecutorInfo in project elastic-job by dangdangdotcom.
the class TaskExecutorTest method assertRegisteredWithoutData.
@Test
public void assertRegisteredWithoutData() {
// CHECKSTYLE:OFF
HashMap<String, String> data = new HashMap<>(4, 1);
// CHECKSTYLE:ON
data.put("event_trace_rdb_driver", "org.h2.Driver");
data.put("event_trace_rdb_url", "jdbc:h2:mem:test_executor");
data.put("event_trace_rdb_username", "sa");
data.put("event_trace_rdb_password", "");
ExecutorInfo executorInfo = ExecutorInfo.newBuilder().setExecutorId(Protos.ExecutorID.newBuilder().setValue("test_executor")).setCommand(Protos.CommandInfo.getDefaultInstance()).setData(ByteString.copyFrom(SerializationUtils.serialize(data))).build();
taskExecutor.registered(executorDriver, executorInfo, frameworkInfo, slaveInfo);
}
Aggregations