当前位置: 首页>>代码示例>>Java>>正文


Java Protos.TaskID方法代码示例

本文整理汇总了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;
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:17,代码来源:DefaultTaskFailureListener.java

示例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());
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:24,代码来源:DefaultSchedulerTest.java

示例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);
        }
    }
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:16,代码来源:DaemonTaskScheduler.java

示例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");
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:MesosWorkerStore.java

示例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());
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:9,代码来源:DeploymentStep.java

示例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();
}
 
开发者ID:WTIGER001,项目名称:Brigade,代码行数:41,代码来源:Framework.java

示例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;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:36,代码来源:MesosResourceManager.java

示例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();
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:9,代码来源:TaskTestUtils.java

示例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();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:LaunchableMesosWorker.java

示例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);
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:6,代码来源:TaskExecutor.java

示例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);
}
 
开发者ID:humio,项目名称:dcos2humio,代码行数:7,代码来源:HumioExecutor.java

示例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));
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:6,代码来源:TaskUtilsTest.java

示例13: getTaskId

import org.apache.mesos.Protos; //导入方法依赖的package包/类
private static Protos.TaskID getTaskId(String value) {
    return Protos.TaskID.newBuilder().setValue(value).build();
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:4,代码来源:CommonIdUtilsTest.java

示例14: getTaskId

import org.apache.mesos.Protos; //导入方法依赖的package包/类
private Protos.TaskID getTaskId(String id)
{
 return Protos.TaskID.newBuilder()
        .setValue(id).build();
}
 
开发者ID:yanglei99,项目名称:Mesos_Auto_Scale,代码行数:6,代码来源:FenzoScheduler.java

示例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;
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:6,代码来源:TaskKillStep.java


注:本文中的org.apache.mesos.Protos.TaskID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。