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


Java SchedulerDriver.stop方法代码示例

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


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

示例1: statusUpdate

import org.apache.mesos.SchedulerDriver; //导入方法依赖的package包/类
@Override public void statusUpdate(SchedulerDriver schedulerDriver, Protos.TaskStatus taskStatus) {
    LOGGER.info(
            "Status update : Task ID " + taskStatus.getTaskId().getValue() + "in state : " + taskStatus.getState()
                    .getValueDescriptor()
                    .getName());
    if (taskStatus.getState() == Protos.TaskState.TASK_FINISHED) {
        finishedTasks++;
        LOGGER.info("Finished tasks : " + finishedTasks);
        if (finishedTasks == totalTasks) {
            schedulerDriver.stop();
        }
    }

    if (taskStatus.getState() == Protos.TaskState.TASK_FAILED
            || taskStatus.getState() == Protos.TaskState.TASK_KILLED
            || taskStatus.getState() == Protos.TaskState.TASK_LOST) {
        LOGGER.error("Aborting because the task " + taskStatus.getTaskId().getValue() + " is in unexpected state : "
                + taskStatus.getState().getValueDescriptor().getName() + "with reason : " + taskStatus.getReason()
                .getValueDescriptor()
                .getName()
                + " from source : " + taskStatus.getSource().getValueDescriptor().getName() + " with message : "
                + taskStatus.getMessage());
        schedulerDriver.abort();
    }

}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:27,代码来源:PiScheduler.java

示例2: registered0

import org.apache.mesos.SchedulerDriver; //导入方法依赖的package包/类
private void registered0(SchedulerDriver driver, Protos.FrameworkID frameworkId, Protos.MasterInfo masterInfo) throws IOException {
    if (!validMesosVersion(masterInfo.getVersion())) {
        // TODO: if the master is in maintenance period, Retz does not abort but sleep and retry later?
        driver.abort();
        return;
    }

    String newMaster = new StringBuilder()
            .append(masterInfo.getHostname())
            .append(":")
            .append(masterInfo.getPort())
            .toString();

    LOG.info("Connected to master {} version={}; Framework ID: {}",
            newMaster, masterInfo.getVersion(), frameworkId.getValue());
    this.master = Optional.of(newMaster);
    StatusCache.updateMaster(newMaster);
    frameworkInfo = frameworkInfo.toBuilder().setId(frameworkId).build();

    Optional<String> oldFrameworkId = Database.getInstance().getFrameworkId();
    if (oldFrameworkId.isPresent()) {
        if (oldFrameworkId.get().equals(frameworkId.getValue())) {
            // framework exists. nothing to do
            LOG.info("Framework id={} existed in past. Recovering any running jobs...", frameworkId.getValue());
            reconcileAllRunningJobs(driver);
        } else {
            LOG.error("Old different framework ({}) exists (!= {}). Quitting",
                    oldFrameworkId.get(), frameworkId.getValue());
            driver.stop();
        }
    } else {
        if (!Database.getInstance().setFrameworkId(frameworkId.getValue())) {
            LOG.warn("Failed to remember frameworkID...");
        }
    }
}
 
开发者ID:retz,项目名称:retz,代码行数:37,代码来源:RetzScheduler.java

示例3: statusUpdate

import org.apache.mesos.SchedulerDriver; //导入方法依赖的package包/类
@Override
public void statusUpdate(SchedulerDriver driver, Protos.TaskStatus taskStatus) {

    final String taskId = taskStatus.getTaskId().getValue();

    loggerWrapper.taskStatus = taskStatus;

    loggerWrapper.debug("Status update task " + taskId + "  is in state " + taskStatus.getState());

    switch (taskStatus.getState()) {
        case TASK_RUNNING:
            pendingInstances.remove(taskId);
            runningInstances.add(taskId);
            break;
        case TASK_FAILED:
        case TASK_LOST:
        case TASK_KILLED:
            pendingInstances.remove(taskId);
            runningInstances.remove(taskId);

            driver.stop(false);
            break;
        case TASK_FINISHED:
            pendingInstances.remove(taskId);
            runningInstances.remove(taskId);

            driver.stop(false);
            break;
    }

    loggerWrapper.debug(
            "Number of instances: pending=" + pendingInstances.size() + ", running=" + runningInstances.size()
    );
}
 
开发者ID:farmapromlab,项目名称:rundeck-mesos-plugin,代码行数:35,代码来源:DockerScheduler.java


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