本文整理汇总了Java中org.apache.mesos.Protos.TaskID方法的典型用法代码示例。如果您正苦于以下问题:Java Protos.TaskID方法的具体用法?Java Protos.TaskID怎么用?Java Protos.TaskID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mesos.Protos
的用法示例。
在下文中一共展示了Protos.TaskID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPods
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private Set<PodInstance> getPods(Collection<Protos.TaskID> taskIds) {
Set<PodInstance> podInstances = new HashSet<>();
for (Protos.TaskID taskId : taskIds) {
try {
Optional<Protos.TaskInfo> taskInfo = stateStore.fetchTask(CommonIdUtils.toTaskName(taskId));
if (taskInfo.isPresent()) {
PodInstance podInstance = TaskUtils.getPodInstance(configStore, taskInfo.get());
podInstances.add(podInstance);
}
} catch (TaskException e) {
logger.error("Failed to fetch/store Task for taskId: " + taskId + " with exception:", e);
}
}
return podInstances;
}
示例2: testTaskIpIsNotOverwrittenByEmptyOnUpdate
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testTaskIpIsNotOverwrittenByEmptyOnUpdate() throws InterruptedException {
List<Protos.TaskID> taskIds = install();
// Verify the TaskIP (TaskInfo, strictly speaking) has been stored in the StateStore.
Assert.assertTrue(StateStoreUtils.getTaskStatusFromProperty(
stateStore, TASK_A_POD_NAME + "-0-" + TASK_A_NAME).isPresent());
Assert.assertTrue(StateStoreUtils.getTaskStatusFromProperty(
stateStore, TASK_B_POD_NAME + "-0-" + TASK_B_NAME).isPresent());
Protos.TaskStatus update = Protos.TaskStatus.newBuilder(
getTaskStatus(taskIds.get(0), Protos.TaskState.TASK_STAGING))
.setContainerStatus(Protos.ContainerStatus.newBuilder()
.addNetworkInfos(Protos.NetworkInfo.newBuilder()))
.build();
defaultScheduler.getMesosScheduler().get()
.statusUpdate(mockSchedulerDriver, update);
// Verify the TaskStatus was NOT updated.
Assert.assertEquals(TASK_IP,
StateStoreUtils.getTaskStatusFromProperty(stateStore, TASK_A_POD_NAME + "-0-" + TASK_A_NAME).get()
.getContainerStatus().getNetworkInfos(0).getIpAddresses(0).getIpAddress());
}
示例3: shutdown
import org.apache.mesos.Protos; //导入方法依赖的package包/类
/**
* 停止任务调度.
*
* @param taskID 任务主键
*/
public static void shutdown(final Protos.TaskID taskID) {
Scheduler scheduler = RUNNING_SCHEDULERS.remove(taskID.getValue());
if (null != scheduler) {
try {
scheduler.shutdown();
} catch (final SchedulerException ex) {
throw new JobSystemException(ex);
}
}
}
示例4: Worker
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private Worker(Protos.TaskID taskID, ResourceProfile profile,
Option<Protos.SlaveID> slaveID, Option<String> hostname, WorkerState state) {
this.taskID = requireNonNull(taskID, "taskID");
this.profile = requireNonNull(profile, "profile");
this.slaveID = requireNonNull(slaveID, "slaveID");
this.hostname = requireNonNull(hostname, "hostname");
this.state = requireNonNull(state, "state");
}
示例5: getTaskIds
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private static Set<Protos.TaskID> getTaskIds(Collection<OfferRecommendation> recommendations) {
return recommendations.stream()
.filter(recommendation -> recommendation instanceof LaunchOfferRecommendation)
.map(recommendation -> ((LaunchOfferRecommendation) recommendation).getStoreableTaskInfo())
.filter(taskInfo -> !taskInfo.getTaskId().getValue().equals(""))
.map(taskInfo -> taskInfo.getTaskId())
.collect(Collectors.toSet());
}
示例6: getTaskInfo
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private Protos.TaskInfo getTaskInfo(Protos.SlaveID slaveID, final TaskAssignmentResult result) {
ProcessorTask t = (ProcessorTask) result.getRequest();
Protos.TaskID pTaskId = Protos.TaskID.newBuilder().setValue(t.getId()).build();
// DockerInfo docker = DockerInfo.newBuilder()
// .setImage(t.getProcessor().docker)
// .build();
//
// ContainerInfo container = ContainerInfo.newBuilder()
// .setDocker(docker)
// .setType(ContainerInfo.Type.DOCKER)
// .build();
ExecutorID eid = ExecutorID.newBuilder().setValue(t.getId()).build();
CommandInfo ci = CommandInfo.newBuilder().setValue(configuration.executorCommand).build();
ExecutorInfo executor = ExecutorInfo.newBuilder().setExecutorId(eid).setFrameworkId(frameworkId)
// .setContainer(container)
.setCommand(ci).build();
ByteString data = ByteString.copyFromUtf8(t.getMessage());
Label processorLabel = Label.newBuilder().setKey("processor").setValue(t.getProcessor().toJson())
.build();
Label messageLabel = Label.newBuilder().setKey("message").setValueBytes(data).build();
Labels labels = Labels.newBuilder().addLabels(processorLabel).addLabels(messageLabel).build();
return Protos.TaskInfo.newBuilder().setName("task " + pTaskId.getValue()).setTaskId(pTaskId).setSlaveId(slaveID)
.setLabels(labels).setData(data)
.addResources(Protos.Resource.newBuilder().setName("cpus").setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(t.getCPUs())))
.addResources(Protos.Resource.newBuilder().setName("mem").setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(t.getMemory())))
// .setContainer(container)
// .setCommand(Protos.CommandInfo.newBuilder().setShell(false))
.setExecutor(executor).build();
}
示例7: createLaunchableMesosWorker
import org.apache.mesos.Protos; //导入方法依赖的package包/类
/**
* Creates a launchable task for Fenzo to process.
*/
private LaunchableMesosWorker createLaunchableMesosWorker(Protos.TaskID taskID, ResourceProfile resourceProfile) {
// create the specific TM parameters from the resource profile and some defaults
MesosTaskManagerParameters params = new MesosTaskManagerParameters(
resourceProfile.getCpuCores() < 1.0 ? taskManagerParameters.cpus() : resourceProfile.getCpuCores(),
taskManagerParameters.containerType(),
taskManagerParameters.containerImageName(),
new ContaineredTaskManagerParameters(
ResourceProfile.UNKNOWN.equals(resourceProfile) ? taskManagerParameters.containeredParameters().taskManagerTotalMemoryMB() : resourceProfile.getMemoryInMB(),
ResourceProfile.UNKNOWN.equals(resourceProfile) ? taskManagerParameters.containeredParameters().taskManagerHeapSizeMB() : resourceProfile.getHeapMemoryInMB(),
ResourceProfile.UNKNOWN.equals(resourceProfile) ? taskManagerParameters.containeredParameters().taskManagerDirectMemoryLimitMB() : resourceProfile.getDirectMemoryInMB(),
1,
new HashMap<>(taskManagerParameters.containeredParameters().taskManagerEnv())),
taskManagerParameters.containerVolumes(),
taskManagerParameters.constraints(),
taskManagerParameters.command(),
taskManagerParameters.bootstrapCommand(),
taskManagerParameters.getTaskManagerHostname()
);
LOG.debug("LaunchableMesosWorker parameters: {}", params);
LaunchableMesosWorker launchable =
new LaunchableMesosWorker(
artifactServer,
params,
taskManagerContainerSpec,
taskID,
mesosConfig);
return launchable;
}
示例8: generateStatus
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public static Protos.TaskStatus generateStatus(
Protos.TaskID taskID,
Protos.TaskState taskState) {
return Protos.TaskStatus.newBuilder()
.setTaskId(taskID)
.setState(taskState)
.build();
}
示例9: LaunchableMesosWorker
import org.apache.mesos.Protos; //导入方法依赖的package包/类
/**
* Construct a launchable Mesos worker.
* @param resolver The resolver for retrieving artifacts (e.g. jars, configuration)
* @param params the TM parameters such as memory, cpu to acquire.
* @param containerSpec an abstract container specification for launch time.
* @param taskID the taskID for this worker.
*/
public LaunchableMesosWorker(
MesosArtifactResolver resolver,
MesosTaskManagerParameters params,
ContainerSpecification containerSpec,
Protos.TaskID taskID,
MesosConfiguration mesosConfiguration) {
this.resolver = Preconditions.checkNotNull(resolver);
this.containerSpec = Preconditions.checkNotNull(containerSpec);
this.params = Preconditions.checkNotNull(params);
this.taskID = Preconditions.checkNotNull(taskID);
this.mesosConfiguration = Preconditions.checkNotNull(mesosConfiguration);
this.taskRequest = new Request();
}
示例10: killTask
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void killTask(final ExecutorDriver executorDriver, final Protos.TaskID taskID) {
executorDriver.sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskID).setState(Protos.TaskState.TASK_KILLED).build());
DaemonTaskScheduler.shutdown(taskID);
}
示例11: killTask
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void killTask(ExecutorDriver driver, Protos.TaskID taskId) {
System.out.println("HumioExecutor.killTask");
runningFlag.set(false);
processes.forEach(ProcessLauncher::stop);
}
示例12: testValidToTaskName
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testValidToTaskName() throws Exception {
Protos.TaskID validTaskId = Protos.TaskID.newBuilder().setValue(testTaskName + "__id").build();
Assert.assertEquals(testTaskName, CommonIdUtils.toTaskName(validTaskId));
}
示例13: getTaskId
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private static Protos.TaskID getTaskId(String value) {
return Protos.TaskID.newBuilder().setValue(value).build();
}
示例14: getTaskId
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private Protos.TaskID getTaskId(String id)
{
return Protos.TaskID.newBuilder()
.setValue(id).build();
}
示例15: TaskKillStep
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public TaskKillStep(Protos.TaskID taskID, TaskKiller taskKiller) {
super("kill-task-" + taskID.getValue(), Status.PENDING);
this.taskKiller = taskKiller;
this.taskID = taskID;
}