本文整理汇总了Java中org.apache.mesos.Protos.TaskInfo.hasExecutor方法的典型用法代码示例。如果您正苦于以下问题:Java TaskInfo.hasExecutor方法的具体用法?Java TaskInfo.hasExecutor怎么用?Java TaskInfo.hasExecutor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mesos.Protos.TaskInfo
的用法示例。
在下文中一共展示了TaskInfo.hasExecutor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pack
import org.apache.mesos.Protos.TaskInfo; //导入方法依赖的package包/类
/**
* Packs the TaskInfo in preparation for sending it to the Executor. For a description of how the packing works
* (and why it exists), see the class-level javadoc.
*
* @see #unpack(TaskInfo)
*/
public static TaskInfo pack(TaskInfo taskInfo) {
if (!taskInfo.hasExecutor()) {
return taskInfo;
} else {
ExecutorInfo.Builder executorInfoBuilder = ExecutorInfo.newBuilder()
.setExecutorId(ExecutorID.newBuilder().setValue(COMMAND_DATA_PACKAGE_EXECUTORID));
if (taskInfo.hasCommand()) {
executorInfoBuilder.setCommand(taskInfo.getCommand());
}
if (taskInfo.hasData()) {
executorInfoBuilder.setData(taskInfo.getData());
}
return TaskInfo.newBuilder(taskInfo)
.setData(executorInfoBuilder.build().toByteString())
.clearCommand()
.build();
}
}
示例2: clearReservationIds
import org.apache.mesos.Protos.TaskInfo; //导入方法依赖的package包/类
private static TaskInfo clearReservationIds(TaskInfo taskInfo) {
TaskInfo.Builder taskInfoBuilder = TaskInfo.newBuilder(taskInfo)
.clearResources()
.addAllResources(clearReservationIds(taskInfo.getResourcesList()));
if (taskInfo.hasExecutor()) {
taskInfoBuilder.getExecutorBuilder()
.clearResources()
.addAllResources(clearReservationIds(taskInfoBuilder.getExecutor().getResourcesList()));
}
return taskInfoBuilder.build();
}
示例3: unpack
import org.apache.mesos.Protos.TaskInfo; //导入方法依赖的package包/类
/**
* 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) {
// In practice this shouldn't happen. This TaskInfo has a data field, but it doesn't parse as an
// 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();
}
}