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


Java Status.DRIVER_RUNNING属性代码示例

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


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

示例1: start

@Override
public Status start() {
  assertNotStopped();

  Futures.getUnchecked(schedulerFuture).registered(this,
      FrameworkID.newBuilder().setValue("local").build(),
      MasterInfo.getDefaultInstance());

  eventBus.post(new Started());

  executor.scheduleAtFixedRate(
      () -> {
        List<Offer> allOffers;
        synchronized (sentOffers) {
          synchronized (idleOffers) {
            sentOffers.putAll(idleOffers);
            allOffers = ImmutableList.copyOf(idleOffers.values());
            idleOffers.clear();
          }
        }

        if (allOffers.isEmpty()) {
          LOG.info("All offers consumed, suppressing offer cycle.");
        } else {
          Futures.getUnchecked(schedulerFuture).resourceOffers(this, allOffers);
        }
      },
      1,
      5,
      TimeUnit.SECONDS);

  return Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:33,代码来源:FakeMaster.java

示例2: join

@Override
public Status join() {
  try {
    stopped.await();
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  return Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:9,代码来源:FakeMaster.java

示例3: launchTasks

@Override
public Status launchTasks(Collection<OfferID> offerIds, Collection<TaskInfo> tasks) {
  assertNotStopped();

  OfferID id = Iterables.getOnlyElement(offerIds);
  Offer offer = sentOffers.remove(id);
  checkState(offer != null, "Offer " + id + " is invalid.");

  final TaskInfo task = Iterables.getOnlyElement(tasks);
  synchronized (activeTasks) {
    checkState(
        !activeTasks.containsKey(task.getTaskId()),
        "Task " + task.getTaskId() + " already exists.");
    activeTasks.put(task.getTaskId(), new Task(offer, task));
  }

  executor.schedule(
      () -> Futures.getUnchecked(schedulerFuture).statusUpdate(
          this,
          TaskStatus.newBuilder()
              .setTaskId(task.getTaskId())
              .setState(TaskState.TASK_RUNNING)
              .build()),
      1,
      TimeUnit.SECONDS);

  return Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:28,代码来源:FakeMaster.java

示例4: killTask

@Override
public Status killTask(TaskID taskId) {
  assertNotStopped();

  Task task = activeTasks.remove(taskId);
  checkState(task != null, "Task " + taskId + " not found.");
  idleOffers.put(task.getOffer().getId(), task.getOffer());

  Futures.getUnchecked(schedulerFuture).statusUpdate(this, TaskStatus.newBuilder()
      .setTaskId(taskId)
      .setState(TaskState.TASK_FINISHED)
      .build());

  return Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:15,代码来源:FakeMaster.java

示例5: check

@Override
protected Result check() throws Exception {
  Status driverStatus = driverManager.getDriverStatus();
  if (Status.DRIVER_RUNNING == driverStatus) {
    return Result.healthy();
  } else {
    return Result.unhealthy("Driver status: " + driverStatus);
  }
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:9,代码来源:MesosDriverHealthCheck.java

示例6: run

/**
 * Encapsulates logic that retrieves the collection of killable tasks from the
 * SchedulerState object. If a task is in pending state, the task is simply 
 * removed from SchedulerState. Any tasks in a running state were not successfully
 * killed by Mesos or the callback failed, so the another kill attempt is made.
 */
@Override
public void run() { 
  //If there are 1..n killable tasks, proceed; otherwise, simply return
  if (CollectionUtils.isNotEmpty(schedulerState.getKillableTaskIds())) {
    /*
     * Clone the killable task collection, iterate through all tasks, and 
     * process any pending and/or non-pending tasks
     */
    Set<TaskID> killableTasks = Sets.newHashSet(schedulerState.getKillableTaskIds());
    Status driverStatus = driverManager.getDriverStatus();

    //TODO (hokiegeek2) Can the DriverManager be restarted? If not, should the ResourceManager stop?
    if (Status.DRIVER_RUNNING != driverStatus) {
      LOGGER.warn("Cannot kill tasks because Mesos Driver is not running. Status: {}", driverStatus);
      return;
    }

    for (TaskID taskIdToKill : killableTasks) {
      LOGGER.info("Received task kill request for task: {}", taskIdToKill);
      if (isPendingTask(taskIdToKill)) {
        handlePendingTask(taskIdToKill);
      } else {
        handleNonPendingTask(taskIdToKill);
      }
    }
  }
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:33,代码来源:TaskTerminator.java

示例7: check

@Override
protected Result check() throws Exception {
	Status driverStatus = driverManager.getDriverStatus();
	if (Status.DRIVER_RUNNING == driverStatus)
		return Result.healthy();
	else
		return Result.unhealthy("Driver status: " + driverStatus);
}
 
开发者ID:eBay,项目名称:myriad,代码行数:8,代码来源:MesosDriverHealthCheck.java

示例8: run

@Override
public void run() {
	Set<String> killableTasks = schedulerState.getKillableTasks();

	if (CollectionUtils.isEmpty(killableTasks)) {
		return;
	}

	Status driverStatus = driverManager.getDriverStatus();
	if (Status.DRIVER_RUNNING != driverStatus) {
		LOGGER.warn(
				"Cannot kill tasks, as driver is not running. Status: {}",
				driverStatus);
		return;
	}

	Iterator<String> iterator = killableTasks.iterator();

	while (iterator.hasNext()) {
		String taskIdToKill = iterator.next();
		NodeTask task = this.schedulerState.getTask(taskIdToKill);
		TaskID mesosTaskId = task.getMesosTaskId();
		Status status = this.driverManager.kill(mesosTaskId);
		this.schedulerState.removeTask(taskIdToKill);
		Preconditions.checkState(status == Status.DRIVER_RUNNING);
	}
}
 
开发者ID:eBay,项目名称:myriad,代码行数:27,代码来源:TaskTerminator.java

示例9: killJob

@Override
public boolean killJob(String jobId, ResourceNode node) {
    TaskID id = (TaskID)map.get(jobId);
    driver.killTask(id);
    Status status = driver.killTask(id);
    if (status != Status.DRIVER_RUNNING)
        throw new MesosFrameworkException("Mesos Schedule Driver is dead: "+status.toString());
    return true;
}
 
开发者ID:apache,项目名称:oodt,代码行数:9,代码来源:MesosBatchManager.java

示例10: canKillTask

private boolean canKillTask() {
  return currentStatus == Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:3,代码来源:SingularityDriverManager.java

示例11: isStoppable

private boolean isStoppable() {
  return currentStatus == Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:3,代码来源:SingularityDriverManager.java

示例12: stop

@Override
public Status stop() {
  stopped.countDown();
  MoreExecutors.shutdownAndAwaitTermination(executor, 1, TimeUnit.SECONDS);
  return Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:6,代码来源:FakeMaster.java

示例13: run

@Override
public Status run() {
  assertNotStopped();
  return Status.DRIVER_RUNNING;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:5,代码来源:FakeMaster.java

示例14: isRunning

private boolean isRunning() {
  return this.driver != null && this.driverStatus == Status.DRIVER_RUNNING;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:3,代码来源:MyriadDriverManager.java

示例15: isRunning

private boolean isRunning() {
	return this.driver != null
			&& this.driverStatus == Status.DRIVER_RUNNING;
}
 
开发者ID:eBay,项目名称:myriad,代码行数:4,代码来源:MyriadDriverManager.java


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