public interface Scheduler
Each callback includes a reference to the scheduler driver that was
used to run this scheduler. The reference will not change for the
duration of a scheduler (i.e., from the point you do SchedulerDriver.start()
to the point that SchedulerDriver.join()
returns). This is intended for convenience so
that a scheduler doesn't need to store a reference to the driver
itself.
Modifier and Type | Method and Description |
---|---|
void |
disconnected(SchedulerDriver driver)
Invoked when the scheduler becomes "disconnected" from the master
(e.g., the master fails and another is taking over).
|
void |
error(SchedulerDriver driver,
java.lang.String message)
Invoked when there is an unrecoverable error in the scheduler or
driver.
|
void |
executorLost(SchedulerDriver driver,
Protos.ExecutorID executorId,
Protos.SlaveID slaveId,
int status)
Invoked when an executor has exited/terminated.
|
void |
frameworkMessage(SchedulerDriver driver,
Protos.ExecutorID executorId,
Protos.SlaveID slaveId,
byte[] data)
Invoked when an executor sends a message.
|
void |
offerRescinded(SchedulerDriver driver,
Protos.OfferID offerId)
Invoked when an offer is no longer valid (e.g., the slave was
lost or another framework used resources in the offer).
|
void |
registered(SchedulerDriver driver,
Protos.FrameworkID frameworkId,
Protos.MasterInfo masterInfo)
Invoked when the scheduler successfully registers with a Mesos
master.
|
void |
reregistered(SchedulerDriver driver,
Protos.MasterInfo masterInfo)
Invoked when the scheduler reregisters with a newly elected Mesos master.
|
void |
resourceOffers(SchedulerDriver driver,
java.util.List<Protos.Offer> offers)
Invoked when resources have been offered to this framework.
|
void |
slaveLost(SchedulerDriver driver,
Protos.SlaveID slaveId)
Invoked when a slave has been determined unreachable (e.g.,
machine failure, network partition).
|
void |
statusUpdate(SchedulerDriver driver,
Protos.TaskStatus status)
Invoked when the status of a task has changed (e.g., a slave is
lost and so the task is lost, a task finishes and an executor
sends a status update saying so, etc).
|
void registered(SchedulerDriver driver, Protos.FrameworkID frameworkId, Protos.MasterInfo masterInfo)
driver
- The scheduler driver that was registered.frameworkId
- The framework ID generated by the master.masterInfo
- Info about the current master, including IP and port.SchedulerDriver
,
Protos.FrameworkID
,
Protos.MasterInfo
void reregistered(SchedulerDriver driver, Protos.MasterInfo masterInfo)
driver
- The driver that was reregistered.masterInfo
- The updated information about the elected master.SchedulerDriver
,
Protos.MasterInfo
void resourceOffers(SchedulerDriver driver, java.util.List<Protos.Offer> offers)
SchedulerDriver.launchTasks(java.util.Collection<org.apache.mesos.Protos.OfferID>, java.util.Collection<org.apache.mesos.Protos.TaskInfo>, org.apache.mesos.Protos.Filters)
) or (b)
those resources have been rescinded (see offerRescinded(org.apache.mesos.SchedulerDriver, org.apache.mesos.Protos.OfferID)
).
Note that resources may be concurrently offered to more than one
framework at a time (depending on the allocator being used). In
that case, the first framework to launch tasks using those
resources will be able to use them while the other frameworks
will have those resources rescinded (or if a framework has
already launched tasks with those resources then those tasks will
fail with a TASK_LOST status and a message saying as much).driver
- The driver that was used to run this scheduler.offers
- The resources offered to this framework.SchedulerDriver
,
Protos.Offer
void offerRescinded(SchedulerDriver driver, Protos.OfferID offerId)
resourceOffers(org.apache.mesos.SchedulerDriver, java.util.List<org.apache.mesos.Protos.Offer>)
).driver
- The driver that was used to run this scheduler.offerId
- The ID of the offer that was rescinded.SchedulerDriver
,
Protos.OfferID
void statusUpdate(SchedulerDriver driver, Protos.TaskStatus status)
driver
- The driver that was used to run this scheduler.status
- The status update, which includes the task ID and status.SchedulerDriver
,
Protos.TaskStatus
void frameworkMessage(SchedulerDriver driver, Protos.ExecutorID executorId, Protos.SlaveID slaveId, byte[] data)
driver
- The driver that received the message.executorId
- The ID of the executor that sent the message.slaveId
- The ID of the slave that launched the executor.data
- The message payload.SchedulerDriver
,
Protos.ExecutorID
,
Protos.SlaveID
void disconnected(SchedulerDriver driver)
driver
- The driver that was used to run this scheduler.SchedulerDriver
void slaveLost(SchedulerDriver driver, Protos.SlaveID slaveId)
driver
- The driver that was used to run this scheduler.slaveId
- The ID of the slave that was lost.SchedulerDriver
,
Protos.SlaveID
void executorLost(SchedulerDriver driver, Protos.ExecutorID executorId, Protos.SlaveID slaveId, int status)
driver
- The driver that was used to run this scheduler.executorId
- The ID of the executor that was lost.slaveId
- The ID of the slave that launched the executor.status
- The exit status of the executor.SchedulerDriver
,
Protos.ExecutorID
,
Protos.SlaveID
,
Protos.Status
void error(SchedulerDriver driver, java.lang.String message)
driver
- The driver that was used to run this scheduler.message
- The error message.SchedulerDriver