public abstract class AbstractScheduler
extends java.lang.Object
AbstractScheduler.MesosScheduler object.| Modifier and Type | Field and Description |
|---|---|
protected ConfigStore<ServiceSpec> |
configStore |
protected SchedulerConfig |
schedulerConfig |
protected StateStore |
stateStore |
protected java.util.concurrent.ExecutorService |
statusExecutor
Executor for handling TaskStatus updates in
Scheduler#statusUpdate(SchedulerDriver, Protos.TaskStatus). |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractScheduler(StateStore stateStore,
ConfigStore<ServiceSpec> configStore,
SchedulerConfig schedulerConfig)
Creates a new AbstractScheduler given a
StateStore. |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitOffersProcessed()
All offers must have been presented to resourceOffers() before calling this.
|
AbstractScheduler |
disableApiServer()
Skips the creation of the API server and marks it as "started".
|
AbstractScheduler |
disableThreading()
Forces the Scheduler to run in a synchronous/single-threaded mode for tests.
|
java.util.Optional<Scheduler> |
getMesosScheduler()
Returns a Mesos API
Scheduler object to be registered with Mesos, or an empty Optional if Mesos
registration should not be performed. |
java.util.Collection<Plan> |
getPlans()
Returns the plans defined for this scheduler.
|
abstract java.util.Collection<java.lang.Object> |
getResources()
Returns a list of API resources to be served by the scheduler to the local cluster.
|
protected abstract PlanCoordinator |
initialize(SchedulerDriver driver)
Performs any additional Scheduler initialization after registration has completed.
|
protected abstract void |
processOffers(SchedulerDriver driver,
java.util.List<Protos.Offer> offers,
java.util.Collection<Step> steps)
The abstract scheduler will periodically call this method with a list of available offers, which may be empty.
|
protected abstract void |
processStatusUpdate(Protos.TaskStatus status)
Handles a task status update which was received from Mesos.
|
AbstractScheduler |
setOfferQueueSize(int queueSize)
Overrides the Scheduler's offer queue size.
|
AbstractScheduler |
start()
Starts any internal threads to be used by the service.
|
protected final StateStore stateStore
protected final ConfigStore<ServiceSpec> configStore
protected final SchedulerConfig schedulerConfig
protected final java.util.concurrent.ExecutorService statusExecutor
Scheduler#statusUpdate(SchedulerDriver, Protos.TaskStatus).protected AbstractScheduler(StateStore stateStore, ConfigStore<ServiceSpec> configStore, SchedulerConfig schedulerConfig)
StateStore.public AbstractScheduler start()
public java.util.Optional<Scheduler> getMesosScheduler()
Scheduler object to be registered with Mesos, or an empty Optional if Mesos
registration should not be performed.public void awaitOffersProcessed()
throws java.lang.InterruptedException
java.lang.InterruptedException - if waiting for offers to be processed is interruptedjava.lang.IllegalStateException - if offers were not processed in a reasonable amount of timepublic AbstractScheduler disableApiServer()
start().public AbstractScheduler disableThreading()
start().public AbstractScheduler setOfferQueueSize(int queueSize)
start()ed.queueSize - the queue size to use, zero for infinitepublic java.util.Collection<Plan> getPlans()
public abstract java.util.Collection<java.lang.Object> getResources()
initialize(SchedulerDriver) has been called.protected abstract PlanCoordinator initialize(SchedulerDriver driver) throws java.lang.Exception
SchedulerDriver may be used to talk to Mesos. Returns a PlanCoordinator which will be used to
select candidate workloads.java.lang.Exceptionprotected abstract void processOffers(SchedulerDriver driver,
java.util.List<Protos.Offer> offers,
java.util.Collection<Step> steps)
protected abstract void processStatusUpdate(Protos.TaskStatus status)
throws java.lang.Exception
java.lang.Exception