本文整理汇总了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;
}
示例2: join
@Override
public Status join() {
try {
stopped.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return Status.DRIVER_RUNNING;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例10: canKillTask
private boolean canKillTask() {
return currentStatus == Status.DRIVER_RUNNING;
}
示例11: isStoppable
private boolean isStoppable() {
return currentStatus == Status.DRIVER_RUNNING;
}
示例12: stop
@Override
public Status stop() {
stopped.countDown();
MoreExecutors.shutdownAndAwaitTermination(executor, 1, TimeUnit.SECONDS);
return Status.DRIVER_RUNNING;
}
示例13: run
@Override
public Status run() {
assertNotStopped();
return Status.DRIVER_RUNNING;
}
示例14: isRunning
private boolean isRunning() {
return this.driver != null && this.driverStatus == Status.DRIVER_RUNNING;
}
示例15: isRunning
private boolean isRunning() {
return this.driver != null
&& this.driverStatus == Status.DRIVER_RUNNING;
}