Java Code Examples for org.apache.mesos.Protos.Status#DRIVER_RUNNING
The following examples show how to use
org.apache.mesos.Protos.Status#DRIVER_RUNNING .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MesosDriverHealthCheck.java From myriad with Apache License 2.0 | 5 votes |
@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); }
Example 2
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 5 votes |
@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; }
Example 3
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 5 votes |
@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; }
Example 4
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 5 votes |
@Override public Status join() { try { stopped.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return Status.DRIVER_RUNNING; }
Example 5
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 5 votes |
@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; }
Example 6
Source File: MesosBatchManager.java From oodt with Apache License 2.0 | 5 votes |
@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; }
Example 7
Source File: TaskTerminator.java From myriad with Apache License 2.0 | 5 votes |
@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); } }
Example 8
Source File: TaskTerminator.java From incubator-myriad with Apache License 2.0 | 5 votes |
/** * 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); } } } }
Example 9
Source File: MesosDriverHealthCheck.java From incubator-myriad with Apache License 2.0 | 5 votes |
@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); } }
Example 10
Source File: SimulatedLocalMesosSchedulerDriver.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Override public Status reconcileTasks(Collection<Protos.TaskStatus> statuses) { checkDriverInRunningState(); if (statuses.isEmpty()) { simulatedCloud.reconcileKnownTasks(); } else { simulatedCloud.reconcileTasks(statuses.stream().map(s -> s.getTaskId().getValue()).collect(Collectors.toSet())); } return Status.DRIVER_RUNNING; }
Example 11
Source File: MyriadDriverManager.java From incubator-myriad with Apache License 2.0 | 4 votes |
private boolean isRunning() { return this.driver != null && this.driverStatus == Status.DRIVER_RUNNING; }
Example 12
Source File: SimulatedLocalMesosSchedulerDriver.java From titus-control-plane with Apache License 2.0 | 4 votes |
public boolean isRunning() { return statusRef.get() == Status.DRIVER_RUNNING; }
Example 13
Source File: MyriadDriverManager.java From myriad with Apache License 2.0 | 4 votes |
private boolean isRunning() { return this.driver != null && this.driverStatus == Status.DRIVER_RUNNING; }
Example 14
Source File: SimulatedLocalMesosSchedulerDriver.java From titus-control-plane with Apache License 2.0 | 4 votes |
@Override public Status declineOffer(Protos.OfferID offerId) { checkDriverInRunningState(); simulatedCloud.declineOffer(offerId.getValue()); return Status.DRIVER_RUNNING; }
Example 15
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 4 votes |
@Override public Status stop() { stopped.countDown(); MoreExecutors.shutdownAndAwaitTermination(executor, 1, TimeUnit.SECONDS); return Status.DRIVER_RUNNING; }
Example 16
Source File: SimulatedLocalMesosSchedulerDriver.java From titus-control-plane with Apache License 2.0 | 4 votes |
@Override public Status killTask(Protos.TaskID taskId) { checkDriverInRunningState(); simulatedCloud.killTask(taskId.getValue()); return Status.DRIVER_RUNNING; }
Example 17
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 4 votes |
@Override public Status run() { assertNotStopped(); return Status.DRIVER_RUNNING; }
Example 18
Source File: SimulatedLocalMesosSchedulerDriver.java From titus-control-plane with Apache License 2.0 | 4 votes |
@Override public Status launchTasks(Collection<Protos.OfferID> offerIds, Collection<Protos.TaskInfo> tasks, Protos.Filters filters) { checkDriverInRunningState(); simulatedCloud.launchTasks(offerIds.stream().map(Protos.OfferID::getValue).collect(Collectors.toList()), tasks); return Status.DRIVER_RUNNING; }
Example 19
Source File: SimulatedLocalMesosSchedulerDriver.java From titus-control-plane with Apache License 2.0 | 4 votes |
@Override public Status run() { start(); return Status.DRIVER_RUNNING; }