org.apache.mesos
Interface SchedulerDriver

All Known Implementing Classes:
MesosSchedulerDriver

public interface SchedulerDriver

Abstract interface for connecting a scheduler to Mesos. This interface is used both to manage the scheduler's lifecycle (start it, stop it, or wait for it to finish) and to interact with Mesos (e.g., launch tasks, kill tasks, etc.).


Method Summary
 org.apache.mesos.Protos.Status abort()
          Aborts the driver so that no more callbacks can be made to the scheduler.
 org.apache.mesos.Protos.Status declineOffer(org.apache.mesos.Protos.OfferID offerId)
          Declines an offer in its entirety.
 org.apache.mesos.Protos.Status declineOffer(org.apache.mesos.Protos.OfferID offerId, org.apache.mesos.Protos.Filters filters)
          Declines an offer in its entirety and applies the specified filters on the resources (see mesos.proto for a description of Filters).
 org.apache.mesos.Protos.Status join()
          Waits for the driver to be stopped or aborted, possibly _blocking_ the current thread indefinitely.
 org.apache.mesos.Protos.Status killTask(org.apache.mesos.Protos.TaskID taskId)
          Kills the specified task.
 org.apache.mesos.Protos.Status launchTasks(Collection<org.apache.mesos.Protos.OfferID> offerIds, Collection<org.apache.mesos.Protos.TaskInfo> tasks)
          Launches the given set of tasks.
 org.apache.mesos.Protos.Status launchTasks(Collection<org.apache.mesos.Protos.OfferID> offerIds, Collection<org.apache.mesos.Protos.TaskInfo> tasks, org.apache.mesos.Protos.Filters filters)
          Launches the given set of tasks on a set of offers.
 org.apache.mesos.Protos.Status launchTasks(org.apache.mesos.Protos.OfferID offerId, Collection<org.apache.mesos.Protos.TaskInfo> tasks)
          Deprecated. Use launchTasks( Collection offerId, Collection tasks) instead.
 org.apache.mesos.Protos.Status launchTasks(org.apache.mesos.Protos.OfferID offerId, Collection<org.apache.mesos.Protos.TaskInfo> tasks, org.apache.mesos.Protos.Filters filters)
          Deprecated. Use launchTasks( Collection offerId, Collection tasks, Filters filters) instead.
 org.apache.mesos.Protos.Status reconcileTasks(Collection<org.apache.mesos.Protos.TaskStatus> statuses)
          Reconciliation of tasks causes the master to send status updates for tasks whose status differs from the status sent here.
 org.apache.mesos.Protos.Status requestResources(Collection<org.apache.mesos.Protos.Request> requests)
          Requests resources from Mesos (see mesos.proto for a description of Request and how, for example, to request resources from specific slaves).
 org.apache.mesos.Protos.Status reviveOffers()
          Removes all filters, previously set by the framework (via launchTasks(java.util.Collection, java.util.Collection, org.apache.mesos.Protos.Filters)).
 org.apache.mesos.Protos.Status run()
          Starts and immediately joins (i.e., blocks on) the driver.
 org.apache.mesos.Protos.Status sendFrameworkMessage(org.apache.mesos.Protos.ExecutorID executorId, org.apache.mesos.Protos.SlaveID slaveId, byte[] data)
          Sends a message from the framework to one of its executors.
 org.apache.mesos.Protos.Status start()
          Starts the scheduler driver.
 org.apache.mesos.Protos.Status stop()
          Stops the scheduler driver assuming no failover.
 org.apache.mesos.Protos.Status stop(boolean failover)
          Stops the scheduler driver.
 

Method Detail

start

org.apache.mesos.Protos.Status start()
Starts the scheduler driver. This needs to be called before any other driver calls are made.


stop

org.apache.mesos.Protos.Status stop(boolean failover)
Stops the scheduler driver. If the 'failover' flag is set to false then it is expected that this framework will never reconnect to Mesos and all of it's executors and tasks can be terminated. Otherwise, all executors and tasks will remain running (for some master specified failover timeout) allowing the scheduler to reconnect (possibly in the same process, or from a different process, for example, on a different machine).


stop

org.apache.mesos.Protos.Status stop()
Stops the scheduler driver assuming no failover.


abort

org.apache.mesos.Protos.Status abort()
Aborts the driver so that no more callbacks can be made to the scheduler. 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 join(), see below), and instantiate and start another driver if desired (from within the same process).


join

org.apache.mesos.Protos.Status join()
Waits for the driver to be stopped or aborted, possibly _blocking_ the current thread indefinitely. The return status of this function can be used to determine if the driver was aborted (see mesos.proto for a description of Status).


run

org.apache.mesos.Protos.Status run()
Starts and immediately joins (i.e., blocks on) the driver.


requestResources

org.apache.mesos.Protos.Status requestResources(Collection<org.apache.mesos.Protos.Request> requests)
Requests resources from Mesos (see mesos.proto for a description of Request and how, for example, to request resources from specific slaves). Any resources available are offered to the framework via Scheduler.resourceOffers(org.apache.mesos.SchedulerDriver, java.util.List) callback, asynchronously.


launchTasks

org.apache.mesos.Protos.Status launchTasks(Collection<org.apache.mesos.Protos.OfferID> offerIds,
                                           Collection<org.apache.mesos.Protos.TaskInfo> tasks,
                                           org.apache.mesos.Protos.Filters filters)
Launches the given set of tasks on a set of offers. Resources from offers are aggregated when more then one is provided. Note that all offers must belong to same slave. Any resources remaining (i.e., not used by the tasks or their executors) will be considered declined. The specified filters are applied on all unused resources (see mesos.proto for a description of Filters). Invoking this function with an empty collection of tasks declines offers in their entirety (see declineOffer(org.apache.mesos.Protos.OfferID, org.apache.mesos.Protos.Filters).


launchTasks

org.apache.mesos.Protos.Status launchTasks(Collection<org.apache.mesos.Protos.OfferID> offerIds,
                                           Collection<org.apache.mesos.Protos.TaskInfo> tasks)
Launches the given set of tasks. See above for details.


launchTasks

org.apache.mesos.Protos.Status launchTasks(org.apache.mesos.Protos.OfferID offerId,
                                           Collection<org.apache.mesos.Protos.TaskInfo> tasks,
                                           org.apache.mesos.Protos.Filters filters)
Deprecated. Use launchTasks( Collection offerId, Collection tasks, Filters filters) instead.


launchTasks

org.apache.mesos.Protos.Status launchTasks(org.apache.mesos.Protos.OfferID offerId,
                                           Collection<org.apache.mesos.Protos.TaskInfo> tasks)
Deprecated. Use launchTasks( Collection offerId, Collection tasks) instead.


killTask

org.apache.mesos.Protos.Status killTask(org.apache.mesos.Protos.TaskID taskId)
Kills the specified task. Note that attempting to kill a task is currently not reliable. If, for example, a scheduler fails over while it was attempting to kill a task it will need to retry in the future Likewise, if unregistered / disconnected, the request will be dropped (these semantics may be changed in the future).


declineOffer

org.apache.mesos.Protos.Status declineOffer(org.apache.mesos.Protos.OfferID offerId,
                                            org.apache.mesos.Protos.Filters filters)
Declines an offer in its entirety and applies the specified filters on the resources (see mesos.proto for a description of Filters). Note that this can be done at any time, it is not necessary to do this within the Scheduler.resourceOffers(org.apache.mesos.SchedulerDriver, java.util.List) callback.


declineOffer

org.apache.mesos.Protos.Status declineOffer(org.apache.mesos.Protos.OfferID offerId)
Declines an offer in its entirety. See above for details.


reviveOffers

org.apache.mesos.Protos.Status reviveOffers()
Removes all filters, previously set by the framework (via launchTasks(java.util.Collection, java.util.Collection, org.apache.mesos.Protos.Filters)). This enables the framework to receive offers from those filtered slaves.


sendFrameworkMessage

org.apache.mesos.Protos.Status sendFrameworkMessage(org.apache.mesos.Protos.ExecutorID executorId,
                                                    org.apache.mesos.Protos.SlaveID slaveId,
                                                    byte[] data)
Sends a message from the framework to one of its executors. These messages are best effort; do not expect a framework message to be retransmitted in any reliable fashion.


reconcileTasks

org.apache.mesos.Protos.Status reconcileTasks(Collection<org.apache.mesos.Protos.TaskStatus> statuses)
Reconciliation of tasks causes the master to send status updates for tasks whose status differs from the status sent here.



Copyright © 2014 The Apache Software Foundation. All Rights Reserved.