Documentation ¶
Overview ¶
Package executor includes the interfaces of the mesos executor and the mesos executor driver, as well as an implementation of the driver.
Index ¶
- type Executor
- type ExecutorDriver
- type MesosExecutorDriver
- func (driver *MesosExecutorDriver) Abort() (mesosproto.Status, error)
- func (driver *MesosExecutorDriver) Connected() bool
- func (driver *MesosExecutorDriver) Join() (mesosproto.Status, error)
- func (driver *MesosExecutorDriver) Run() (mesosproto.Status, error)
- func (driver *MesosExecutorDriver) SendFrameworkMessage(data string) (mesosproto.Status, error)
- func (driver *MesosExecutorDriver) SendStatusUpdate(taskStatus *mesosproto.TaskStatus) (mesosproto.Status, error)
- func (driver *MesosExecutorDriver) Start() (mesosproto.Status, error)
- func (driver *MesosExecutorDriver) Status() mesosproto.Status
- func (driver *MesosExecutorDriver) Stop() (mesosproto.Status, error)
- func (driver *MesosExecutorDriver) Stopped() bool
- type MockedExecutor
- func (e *MockedExecutor) Disconnected(ExecutorDriver)
- func (e *MockedExecutor) Error(ExecutorDriver, string)
- func (e *MockedExecutor) FrameworkMessage(ExecutorDriver, string)
- func (e *MockedExecutor) KillTask(ExecutorDriver, *mesosproto.TaskID)
- func (e *MockedExecutor) LaunchTask(ExecutorDriver, *mesosproto.TaskInfo)
- func (e *MockedExecutor) Registered(ExecutorDriver, *mesosproto.ExecutorInfo, *mesosproto.FrameworkInfo, ...)
- func (e *MockedExecutor) Reregistered(ExecutorDriver, *mesosproto.SlaveInfo)
- func (e *MockedExecutor) Shutdown(ExecutorDriver)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor interface { /** * Invoked once the executor driver has been able to successfully * connect with Mesos. In particular, a scheduler can pass some * data to its executors through the FrameworkInfo.ExecutorInfo's * data field. */ Registered(ExecutorDriver, *mesosproto.ExecutorInfo, *mesosproto.FrameworkInfo, *mesosproto.SlaveInfo) /** * Invoked when the executor re-registers with a restarted slave. */ Reregistered(ExecutorDriver, *mesosproto.SlaveInfo) /** * Invoked when the executor becomes "disconnected" from the slave * (e.g., the slave is being restarted due to an upgrade). */ Disconnected(ExecutorDriver) /** * Invoked when a task has been launched on this executor (initiated * via SchedulerDriver.LaunchTasks). Note that this task can be realized * with a goroutine, an external process, or some simple computation, however, * no other callbacks will be invoked on this executor until this * callback has returned. */ LaunchTask(ExecutorDriver, *mesosproto.TaskInfo) /** * Invoked when a task running within this executor has been killed * (via SchedulerDriver.KillTask). 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. */ KillTask(ExecutorDriver, *mesosproto.TaskID) /** * Invoked when a framework message has arrived for this * executor. These messages are best effort; do not expect a * framework message to be retransmitted in any reliable fashion. */ FrameworkMessage(ExecutorDriver, string) /** * Invoked when the executor should terminate all of its currently * running tasks. Note that after Mesos has determined that an * executor has terminated, any tasks that the executor did not send * terminal status updates for (e.g., TASK_KILLED, TASK_FINISHED, * TASK_FAILED, etc) a TASK_LOST status update will be created. */ Shutdown(ExecutorDriver) /** * Invoked when a fatal error has occured with the executor and/or * executor driver. The driver will be aborted BEFORE invoking this * callback. */ Error(ExecutorDriver, string) }
*
- Executor callback interface to be implemented by frameworks' executors. Note
- that only one callback will be invoked at a time, so it is not
- recommended that you block within a callback because it may cause a
- deadlock. *
- Each callback includes an instance to the executor driver that was
- used to run this executor. The driver 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 pointer to the driver itself.
type ExecutorDriver ¶
type ExecutorDriver interface { /** * Starts the executor driver. This needs to be called before any * other driver calls are made. */ Start() (mesosproto.Status, error) /** * Stops the executor driver. */ Stop() (mesosproto.Status, error) /** * Aborts the driver so that no more callbacks can be made to the * executor. The semantics of abort and stop have deliberately been * separated so that code can detect an aborted driver (i.e., via * the return status of ExecutorDriver.Join, see below), and * instantiate and start another driver if desired (from within the * same process ... although this functionality is currently not * supported for executors). */ Abort() (mesosproto.Status, error) /** * Waits for the driver to be stopped or aborted, possibly * blocking the calling goroutine indefinitely. The return status of * this function can be used to determine if the driver was aborted * (see package mesosproto for a description of Status). */ Join() (mesosproto.Status, error) /** * Starts and immediately joins (i.e., blocks on) the driver. */ Run() (mesosproto.Status, error) /** * Sends a status update to the framework scheduler, retrying as * necessary until an acknowledgement has been received or the * executor is terminated (in which case, a TASK_LOST status update * will be sent). See Scheduler.StatusUpdate for more information * about status update acknowledgements. */ SendStatusUpdate(*mesosproto.TaskStatus) (mesosproto.Status, error) /** * Sends a message to the framework scheduler. These messages are * best effort; do not expect a framework message to be * retransmitted in any reliable fashion. */ SendFrameworkMessage(string) (mesosproto.Status, error) }
*
- ExecutorDriver interface for connecting an executor to Mesos. This
- interface is used both to manage the executor's lifecycle (start
- it, stop it, or wait for it to finish) and to interact with Mesos
- (e.g., send status updates, send framework messages, etc.).
- A driver method is expected to fail-fast and return an error when possible.
- Other internal errors (or remote error) that occur asynchronously are handled
- using the the Executor.Error() callback.
type MesosExecutorDriver ¶
type MesosExecutorDriver struct {
// contains filtered or unexported fields
}
MesosExecutorDriver is a implementation of the ExecutorDriver.
func NewMesosExecutorDriver ¶
func NewMesosExecutorDriver(exec Executor) (*MesosExecutorDriver, error)
NewMesosExecutorDriver creates a new mesos executor driver.
func (*MesosExecutorDriver) Abort ¶
func (driver *MesosExecutorDriver) Abort() (mesosproto.Status, error)
Abort aborts the driver by sending an 'abortEvent' to the event loop, and receives the result from the response channel.
func (*MesosExecutorDriver) Connected ¶
func (driver *MesosExecutorDriver) Connected() bool
func (*MesosExecutorDriver) Join ¶
func (driver *MesosExecutorDriver) Join() (mesosproto.Status, error)
Join waits for the driver by sending a 'joinEvent' to the event loop, and wait on a channel for the notification of driver termination.
func (*MesosExecutorDriver) Run ¶
func (driver *MesosExecutorDriver) Run() (mesosproto.Status, error)
Run starts the driver and calls Join() to wait for stop request.
func (*MesosExecutorDriver) SendFrameworkMessage ¶
func (driver *MesosExecutorDriver) SendFrameworkMessage(data string) (mesosproto.Status, error)
SendFrameworkMessage sends the framework message by sending a 'sendFrameworkMessageEvent' to the event loop, and receives the result from the response channel.
func (*MesosExecutorDriver) SendStatusUpdate ¶
func (driver *MesosExecutorDriver) SendStatusUpdate(taskStatus *mesosproto.TaskStatus) (mesosproto.Status, error)
SendStatusUpdate sends status updates to the slave.
func (*MesosExecutorDriver) Start ¶
func (driver *MesosExecutorDriver) Start() (mesosproto.Status, error)
Start starts the executor driver
func (*MesosExecutorDriver) Status ¶
func (driver *MesosExecutorDriver) Status() mesosproto.Status
------------------------- Accessors ----------------------- //
func (*MesosExecutorDriver) Stop ¶
func (driver *MesosExecutorDriver) Stop() (mesosproto.Status, error)
Stop stops the driver by sending a 'stopEvent' to the event loop, and receives the result from the response channel.
func (*MesosExecutorDriver) Stopped ¶
func (driver *MesosExecutorDriver) Stopped() bool
type MockedExecutor ¶
MockedExecutor is used for testing the executor driver.
func NewMockedExecutor ¶
func NewMockedExecutor() *MockedExecutor
NewMockedExecutor returns a mocked executor.
func (*MockedExecutor) Disconnected ¶
func (e *MockedExecutor) Disconnected(ExecutorDriver)
Disconnected implements the Disconnected handler.
func (*MockedExecutor) Error ¶
func (e *MockedExecutor) Error(ExecutorDriver, string)
Error implements the Error handler.
func (*MockedExecutor) FrameworkMessage ¶
func (e *MockedExecutor) FrameworkMessage(ExecutorDriver, string)
FrameworkMessage implements the FrameworkMessage handler.
func (*MockedExecutor) KillTask ¶
func (e *MockedExecutor) KillTask(ExecutorDriver, *mesosproto.TaskID)
KillTask implements the KillTask handler.
func (*MockedExecutor) LaunchTask ¶
func (e *MockedExecutor) LaunchTask(ExecutorDriver, *mesosproto.TaskInfo)
LaunchTask implements the LaunchTask handler.
func (*MockedExecutor) Registered ¶
func (e *MockedExecutor) Registered(ExecutorDriver, *mesosproto.ExecutorInfo, *mesosproto.FrameworkInfo, *mesosproto.SlaveInfo)
Registered implements the Registered handler.
func (*MockedExecutor) Reregistered ¶
func (e *MockedExecutor) Reregistered(ExecutorDriver, *mesosproto.SlaveInfo)
Reregistered implements the Reregistered handler.
func (*MockedExecutor) Shutdown ¶
func (e *MockedExecutor) Shutdown(ExecutorDriver)
Shutdown implements the Shutdown handler.