本文整理汇总了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();
}
}
示例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...");
}
}
}
示例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()
);
}