public interface Executor
Each callback includes a reference to the executor driver that was
used to run this executor. The reference will not change for the
duration of an executor (i.e., from the point you do
ExecutorDriver.start()
to the point that
ExecutorDriver.join()
returns).
This is intended for convenience so that an executor
doesn't need to store a reference to the driver itself.
Modifier and Type | Method and Description |
---|---|
void |
disconnected(ExecutorDriver driver)
Invoked when the executor becomes "disconnected" from the slave
(e.g., the slave is being restarted due to an upgrade).
|
void |
error(ExecutorDriver driver,
java.lang.String message)
Invoked when a fatal error has occurred with the executor and/or
executor driver.
|
void |
frameworkMessage(ExecutorDriver driver,
byte[] data)
Invoked when a framework message has arrived for this
executor.
|
void |
killTask(ExecutorDriver driver,
Protos.TaskID taskId)
Invoked when a task running within this executor has been killed
(via
SchedulerDriver.killTask(org.apache.mesos.Protos.TaskID) ). |
void |
launchTask(ExecutorDriver driver,
Protos.TaskInfo task)
Invoked when a task has been launched on this executor (initiated
via
SchedulerDriver.launchTasks(java.util.Collection<org.apache.mesos.Protos.OfferID>, java.util.Collection<org.apache.mesos.Protos.TaskInfo>, org.apache.mesos.Protos.Filters) . |
void |
registered(ExecutorDriver driver,
Protos.ExecutorInfo executorInfo,
Protos.FrameworkInfo frameworkInfo,
Protos.SlaveInfo slaveInfo)
Invoked once the executor driver has been able to successfully
connect with Mesos.
|
void |
reregistered(ExecutorDriver driver,
Protos.SlaveInfo slaveInfo)
Invoked when the executor reregisters with a restarted slave.
|
void |
shutdown(ExecutorDriver driver)
Invoked when the executor should terminate all of its currently
running tasks.
|
void registered(ExecutorDriver driver, Protos.ExecutorInfo executorInfo, Protos.FrameworkInfo frameworkInfo, Protos.SlaveInfo slaveInfo)
Protos.ExecutorInfo.getData()
field.driver
- The executor driver that was registered and connected
to the Mesos cluster.executorInfo
- Describes information about the executor that was
registered.frameworkInfo
- Describes the framework that was registered.slaveInfo
- Describes the slave that will be used to launch
the tasks for this executor.ExecutorDriver
,
MesosSchedulerDriver
void reregistered(ExecutorDriver driver, Protos.SlaveInfo slaveInfo)
driver
- The executor driver that was reregistered with the
Mesos master.slaveInfo
- Describes the slave that will be used to launch
the tasks for this executor.ExecutorDriver
void disconnected(ExecutorDriver driver)
driver
- The executor driver that was disconnected.void launchTask(ExecutorDriver driver, Protos.TaskInfo task)
SchedulerDriver.launchTasks(java.util.Collection<org.apache.mesos.Protos.OfferID>, java.util.Collection<org.apache.mesos.Protos.TaskInfo>, org.apache.mesos.Protos.Filters)
. Note that this task can be
realized with a thread, a process, or some simple computation,
however, no other callbacks will be invoked on this executor
until this callback has returned.driver
- The executor driver that launched the task.task
- Describes the task that was launched.ExecutorDriver
,
Protos.TaskInfo
void killTask(ExecutorDriver driver, Protos.TaskID taskId)
SchedulerDriver.killTask(org.apache.mesos.Protos.TaskID)
). Note that no
status update will be sent on behalf of the executor, the executor is
responsible for creating a new TaskStatus (i.e., with TASK_KILLED)
and invoking ExecutorDriver.sendStatusUpdate(org.apache.mesos.Protos.TaskStatus)
.driver
- The executor driver that owned the task that was killed.taskId
- The ID of the task that was killed.ExecutorDriver
,
Protos.TaskID
void frameworkMessage(ExecutorDriver driver, byte[] data)
driver
- The executor driver that received the message.data
- The message payload.ExecutorDriver
void shutdown(ExecutorDriver driver)
driver
- The executor driver that should terminate.ExecutorDriver
void error(ExecutorDriver driver, java.lang.String message)
driver
- The executor driver that was aborted due this error.message
- The error message.ExecutorDriver