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


Java Protos.ExecutorInfo方法代码示例

本文整理汇总了Java中org.apache.mesos.Protos.ExecutorInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Protos.ExecutorInfo方法的具体用法?Java Protos.ExecutorInfo怎么用?Java Protos.ExecutorInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.mesos.Protos的用法示例。


在下文中一共展示了Protos.ExecutorInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSimpleShutdown

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testSimpleShutdown() {
    final Protos.ExecutorInfo executorInfo = getTestExecutorInfo();
    customExecutor.registered(mockExecutorDriver, executorInfo, null, null);

    final Protos.TaskInfo taskInfo = Protos.TaskInfo
            .newBuilder()
            .setName(TEST)
            .setTaskId(Protos.TaskID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setSlaveId(Protos.SlaveID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setExecutor(executorInfo)
            .setData(createCommandInfo().toByteString())
            .build();


    customExecutor.launchTask(mockExecutorDriver, taskInfo);

    customExecutor.shutdown(mockExecutorDriver);
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:20,代码来源:CustomExecutorTest.java

示例2: testSimpleKill

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testSimpleKill() {
    final Protos.ExecutorInfo executorInfo = getTestExecutorInfo();

    customExecutor.registered(mockExecutorDriver, executorInfo, null, null);

    final Protos.TaskInfo taskInfo = Protos.TaskInfo
            .newBuilder()
            .setName(TEST)
            .setTaskId(Protos.TaskID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setSlaveId(Protos.SlaveID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setExecutor(executorInfo)
            .setData(createCommandInfo().toByteString())
            .build();


    customExecutor.launchTask(mockExecutorDriver, taskInfo);

    customExecutor.killTask(mockExecutorDriver, taskInfo.getTaskId());
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:21,代码来源:CustomExecutorTest.java

示例3: LaunchOfferRecommendation

import org.apache.mesos.Protos; //导入方法依赖的package包/类
public LaunchOfferRecommendation(
        Offer offer,
        TaskInfo originalTaskInfo,
        Protos.ExecutorInfo executorInfo,
        boolean shouldLaunch,
        boolean useDefaultExecutor) {
    this.offer = offer;
    this.shouldLaunch = shouldLaunch;
    this.useDefaultExecutor = useDefaultExecutor;

    TaskInfo.Builder taskBuilder = originalTaskInfo.toBuilder();
    if (!shouldLaunch) {
        new TaskLabelWriter(taskBuilder).setTransient();
        taskBuilder.getTaskIdBuilder().setValue("");
    }

    taskBuilder.setSlaveId(offer.getSlaveId());

    this.taskInfo = taskBuilder.build();
    this.executorInfo = executorInfo;
    this.operation = getLaunchOperation();
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:23,代码来源:LaunchOfferRecommendation.java

示例4: testRegisterAndReRegister

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testRegisterAndReRegister() {
    final Protos.ExecutorInfo executorInfo = getTestExecutorInfo();

    final String localhost = "localhost";
    final Protos.SlaveInfo oldSlaveInfo = Protos.SlaveInfo
            .newBuilder()
            .setId(Protos.SlaveID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setHostname(localhost)
            .build();

    customExecutor.registered(mockExecutorDriver, executorInfo, null, oldSlaveInfo);

    final Protos.SlaveInfo newSlaveInfo = Protos.SlaveInfo
            .newBuilder()
            .setId(Protos.SlaveID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setHostname(localhost)
            .build();

    customExecutor.reregistered(mockExecutorDriver, newSlaveInfo);
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:22,代码来源:CustomExecutorTest.java

示例5: registered

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void registered(final ExecutorDriver executorDriver, final Protos.ExecutorInfo executorInfo, final Protos.FrameworkInfo frameworkInfo, final Protos.SlaveInfo slaveInfo) {
    if (!executorInfo.getData().isEmpty()) {
        Map<String, String> data = SerializationUtils.deserialize(executorInfo.getData().toByteArray());
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setDriverClassName(data.get("event_trace_rdb_driver"));
        dataSource.setUrl(data.get("event_trace_rdb_url"));
        dataSource.setPassword(data.get("event_trace_rdb_password"));
        dataSource.setUsername(data.get("event_trace_rdb_username"));
        jobEventBus = new JobEventBus(new JobEventRdbConfiguration(dataSource));
    }
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:13,代码来源:TaskExecutor.java

示例6: registered

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void registered(ExecutorDriver driver, Protos.ExecutorInfo executorInfo, Protos.FrameworkInfo frameworkInfo, Protos.SlaveInfo slaveInfo) {
    final String[] bootConfig = executorInfo.getData().toStringUtf8().split(";");
    this.dcosAuthToken = nullOnEmpty(bootConfig[0]);
    this.metricsContainersEnabled = Boolean.parseBoolean(bootConfig[1]);
    slaveId = slaveInfo.getId().getValue();
    System.out.println("HumioExecutor.registered");
}
 
开发者ID:humio,项目名称:dcos2humio,代码行数:9,代码来源:HumioExecutor.java

示例7: getExpectedExecutorResources

import org.apache.mesos.Protos; //导入方法依赖的package包/类
private Collection<Resource> getExpectedExecutorResources(Protos.ExecutorInfo executorInfo) {
    String executorCpuId = executorInfo.getResourcesList().stream()
            .filter(r -> r.getName().equals("cpus"))
            .map(ResourceUtils::getResourceId)
            .filter(o -> o.isPresent())
            .map(o -> o.get())
            .findFirst()
            .get();
    String executorMemId = executorInfo.getResourcesList().stream()
            .filter(r -> r.getName().equals("mem"))
            .map(ResourceUtils::getResourceId)
            .filter(o -> o.isPresent())
            .map(o -> o.get())
            .findFirst()
            .get();
    String executorDiskId = executorInfo.getResourcesList().stream()
            .filter(r -> r.getName().equals("disk"))
            .map(ResourceUtils::getResourceId)
            .filter(o -> o.isPresent())
            .map(o -> o.get())
            .findFirst()
            .get();

    Resource expectedExecutorCpu = ResourceTestUtils.getReservedCpus(0.1, executorCpuId);
    Resource expectedExecutorMem = ResourceTestUtils.getReservedMem(32, executorMemId);
    Resource expectedExecutorDisk = ResourceTestUtils.getReservedDisk(256, executorDiskId);

    return new ArrayList<>(Arrays.asList(expectedExecutorCpu, expectedExecutorMem, expectedExecutorDisk));
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:30,代码来源:OfferEvaluatorPortsTest.java

示例8: testRegisterExecutor

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testRegisterExecutor() throws Exception {
    Protos.ExecutorInfo executorInfo = testBeginning.registerExecutor(System.getenv("EXECUTOR_PATH"));
    Protos.ExecutorInfo mExecutorInfo = testBeginning.getTaskExecutor();

    // Only really care about location of executor
    assertTrue(mExecutorInfo.getCommand().getValue().equals(executorInfo.getCommand().getValue()));
}
 
开发者ID:mesos-magellan,项目名称:faleiro,代码行数:9,代码来源:MagellanJobTest.java

示例9: normalizeCassandraTaskInfo

import org.apache.mesos.Protos; //导入方法依赖的package包/类
private Protos.TaskInfo normalizeCassandraTaskInfo(CassandraDaemonTask daemonTask) {
    Protos.TaskInfo daemonTaskInfo = daemonTask.getTaskInfo();
    Protos.ExecutorInfo expectedExecutorInfo = Protos.ExecutorInfo.newBuilder(daemonTaskInfo.getExecutor())
            .setExecutorId(Protos.ExecutorID.newBuilder().setValue(""))
            .build();
    daemonTaskInfo = Protos.TaskInfo.newBuilder(daemonTaskInfo)
            .setTaskId(Protos.TaskID.newBuilder().setValue(""))
            .setExecutor(expectedExecutorInfo)
            .build();
    return daemonTaskInfo;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:12,代码来源:CassandraDaemonTaskTest.java

示例10: registered

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void registered(
        ExecutorDriver driver,
        Protos.ExecutorInfo executorInfo,
        Protos.FrameworkInfo frameworkInfo,
        Protos.SlaveInfo agentInfo) {
    LOGGER.info("Registered executor: {}", TextFormat.shortDebugString(executorInfo));
    executorService.submit(launchedTaskStore.getMonitor());
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:10,代码来源:CustomExecutor.java

示例11: testFailingTask

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testFailingTask() throws Exception {
    final ExecutorDriver mockExecutorDriver = Mockito.mock(ExecutorDriver.class);

    final Protos.ExecutorInfo executorInfo = Protos.ExecutorInfo.newBuilder()
            .setName(EXECUTOR_NAME)
            .setExecutorId(CommonIdUtils.toExecutorId(EXECUTOR_NAME))
            .setCommand(Protos.CommandInfo.newBuilder().setValue(""))
            .build();

    final Protos.TaskInfo taskInfo = Protos.TaskInfo.newBuilder()
            .setName(TASK_NAME)
            .setTaskId(CommonIdUtils.toTaskId(TASK_NAME))
            .setSlaveId(SlaveID.newBuilder().setValue("ignored"))
            .setCommand(Protos.CommandInfo.newBuilder().setValue("exit 1"))
            .setExecutor(executorInfo)
            .build();

    final ProcessTask processTask = ProcessTask.create(mockExecutorDriver, taskInfo);
    Assert.assertFalse(processTask.isAlive());
    processTask.run();
    Assert.assertFalse(processTask.isAlive());

    // Wait for processTask to run: TASK_RUNNING + TASK_FAILED
    ArgumentCaptor<Protos.TaskStatus> captor = ArgumentCaptor.forClass(Protos.TaskStatus.class);
    Mockito.verify(mockExecutorDriver, times(2)).sendStatusUpdate(captor.capture());
    List<Protos.TaskStatus> statuses = captor.getAllValues();
    Assert.assertEquals(2, statuses.size());
    Assert.assertEquals(Protos.TaskState.TASK_RUNNING, statuses.get(0).getState());
    Assert.assertEquals(Protos.TaskState.TASK_FAILED, statuses.get(1).getState());
    Assert.assertFalse(processTask.isAlive());
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:33,代码来源:ProcessTaskTest.java

示例12: expect

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void expect(ClusterState state, SchedulerDriver mockDriver) throws AssertionError {
    Set<Protos.ExecutorInfo> executors = taskNames.stream()
            .map(name -> state.getLastLaunchedTask(name).getExecutor())
            .collect(Collectors.toSet());
    Assert.assertEquals(String.format(
            "Expected tasks to share a single matching executor, but had: %s",
            executors.stream().map(e -> TextFormat.shortDebugString(e)).collect(Collectors.toList())),
            1, executors.size());
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:11,代码来源:ServiceTest.java

示例13: isRunningExecutor

import org.apache.mesos.Protos; //导入方法依赖的package包/类
private static boolean isRunningExecutor(Protos.ExecutorInfo executorInfo, Protos.Offer offer) {
    for (Protos.ExecutorID execId : offer.getExecutorIdsList()) {
        if (execId.equals(executorInfo.getExecutorId())) {
            return true;
        }
    }

    return false;
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:10,代码来源:VolumeEvaluationStage.java

示例14: getEvaluationPipeline

import org.apache.mesos.Protos; //导入方法依赖的package包/类
public List<OfferEvaluationStage> getEvaluationPipeline(
        PodInstanceRequirement podInstanceRequirement,
        Collection<Protos.TaskInfo> allTasks,
        Map<String, Protos.TaskInfo> thisPodTasks,
        Optional<Protos.ExecutorInfo> executorInfo) throws IOException {

    boolean noLaunchedTasksExist = thisPodTasks.values().stream()
            .flatMap(taskInfo -> taskInfo.getResourcesList().stream())
            .map(resource -> ResourceUtils.getResourceId(resource))
            .filter(resourceId -> resourceId.isPresent())
            .map(Optional::get)
            .filter(resourceId -> !resourceId.isEmpty())
            .count() == 0;

    boolean allTasksFailed = thisPodTasks.values().stream()
            .allMatch(taskInfo -> FailureUtils.isPermanentlyFailed(taskInfo));

    final String description;
    final boolean shouldGetNewRequirement;
    if (podInstanceRequirement.getRecoveryType().equals(RecoveryType.PERMANENT) || allTasksFailed) {
        description = "failed";
        shouldGetNewRequirement = true;
    } else if (noLaunchedTasksExist) {
        description = "new";
        shouldGetNewRequirement = true;
    } else {
        description = "existing";
        shouldGetNewRequirement = false;
    }
    logger.info("Generating requirement for {} pod '{}' containing tasks: {}.",
            description,
            podInstanceRequirement.getPodInstance().getName(),
            podInstanceRequirement.getTasksToLaunch());

    // Only create a TLS Evaluation Stage builder if the service actually uses TLS certs.
    // This avoids performing TLS cert generation in cases where the cluster may not support it (e.g. DC/OS Open).
    boolean anyTasksWithTLS = podInstanceRequirement.getPodInstance().getPod().getTasks().stream()
            .anyMatch(taskSpec -> !taskSpec.getTransportEncryption().isEmpty());
    Optional<TLSEvaluationStage.Builder> tlsStageBuilder = anyTasksWithTLS
            ? Optional.of(new TLSEvaluationStage.Builder(serviceName, schedulerConfig))
            : Optional.empty();

    List<OfferEvaluationStage> evaluationPipeline = new ArrayList<>();
    if (shouldGetNewRequirement) {
        evaluationPipeline.add(new ExecutorEvaluationStage(Optional.empty()));
        evaluationPipeline.addAll(getNewEvaluationPipeline(podInstanceRequirement, allTasks, tlsStageBuilder));
    } else {
        evaluationPipeline.add(new ExecutorEvaluationStage(getExecutorInfo(thisPodTasks.values())));
        evaluationPipeline.addAll(getExistingEvaluationPipeline(
                podInstanceRequirement, thisPodTasks, allTasks, executorInfo.get(), tlsStageBuilder));
    }

    return evaluationPipeline;
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:55,代码来源:OfferEvaluator.java

示例15: getExecutorInfo

import org.apache.mesos.Protos; //导入方法依赖的package包/类
public static Protos.ExecutorInfo getExecutorInfo(Protos.Resource resource) {
    return getExecutorInfo(Arrays.asList(resource));
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:4,代码来源:TaskTestUtils.java


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