Updated the comment for launching tasks and accepting offers.

If the task does not pass validation,
its resources are considered declined.

Review: https://reviews.apache.org/r/45039/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b717226f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b717226f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b717226f

Branch: refs/heads/master
Commit: b717226f48c0c072d54c92265a925a608990df1b
Parents: 2116615
Author: Alexander Rukletsov <ruklet...@gmail.com>
Authored: Wed Apr 6 10:08:34 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Apr 6 10:08:34 2016 +0200

----------------------------------------------------------------------
 docs/app-framework-development-guide.md         | 31 ++++++++++------
 include/mesos/scheduler.hpp                     | 31 ++++++++++------
 .../src/org/apache/mesos/SchedulerDriver.java   | 31 ++++++++++------
 .../interface/src/mesos/interface/__init__.py   | 39 ++++++++++++--------
 4 files changed, 80 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b717226f/docs/app-framework-development-guide.md
----------------------------------------------------------------------
diff --git a/docs/app-framework-development-guide.md 
b/docs/app-framework-development-guide.md
index 1d8bebd..c5badd0 100644
--- a/docs/app-framework-development-guide.md
+++ b/docs/app-framework-development-guide.md
@@ -180,14 +180,17 @@ virtual Status run();
 // framework via Scheduler::resourceOffers callback, asynchronously.
 virtual Status requestResources(const std::vector<Request>& requests);
 
-// Launches the given set of tasks. 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).
-// Available resources are aggregated when multiple offers are
-// provided. Note that all offers must belong to the same slave.
-// Invoking this function with an empty collection of tasks declines
-// offers in their entirety (see Scheduler::declineOffer).
+// Launches the given set of tasks. Any remaining resources (i.e.,
+// those that are not used by the launched tasks or their executors)
+// will be considered declined. Note that this includes resources
+// used by tasks that the framework attempted to launch but failed
+// (with `TASK_ERROR`) due to a malformed task description. The
+// specified filters are applied on all unused resources (see
+// mesos.proto for a description of Filters). Available resources
+// are aggregated when multiple offers are provided. Note that all
+// offers must belong to the same slave. Invoking this function with
+// an empty collection of tasks declines offers in their entirety
+// (see Scheduler::declineOffer).
 virtual Status launchTasks(
     const std::vector<OfferID>& offerIds,
     const std::vector<TaskInfo>& tasks,
@@ -202,11 +205,15 @@ virtual Status killTask(const TaskID& taskId);
 
 // Accepts the given offers and performs a sequence of operations on
 // those accepted offers. See Offer.Operation in mesos.proto for the
-// set of available operations. Available resources are aggregated
+// set of available operations. Any remaining resources (i.e., those
+// that are not used by the launched tasks or their executors) will
+// be considered declined. Note that this includes resources used by
+// tasks that the framework attempted to launch but failed (with
+// `TASK_ERROR`) due to a malformed task description. The specified
+// filters are applied on all unused resources (see mesos.proto for
+// a description of Filters). Available resources are aggregated
 // when multiple offers are provided. Note that all offers must
-// belong to the same slave. Any unused resources will be considered
-// declined. The specified filters are applied on all unused
-// resources (see mesos.proto for a description of Filters).
+// belong to the same slave.
 virtual Status acceptOffers(
     const std::vector<OfferID>& offerIds,
     const std::vector<Offer::Operation>& operations,

http://git-wip-us.apache.org/repos/asf/mesos/blob/b717226f/include/mesos/scheduler.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/scheduler.hpp b/include/mesos/scheduler.hpp
index 14c7ff9..5b153d2 100644
--- a/include/mesos/scheduler.hpp
+++ b/include/mesos/scheduler.hpp
@@ -216,14 +216,17 @@ public:
   // framework via Scheduler::resourceOffers callback, asynchronously.
   virtual Status requestResources(const std::vector<Request>& requests) = 0;
 
-  // Launches the given set of tasks. 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).
-  // Available resources are aggregated when multiple offers are
-  // provided. Note that all offers must belong to the same slave.
-  // Invoking this function with an empty collection of tasks declines
-  // offers in their entirety (see Scheduler::declineOffer).
+  // Launches the given set of tasks. Any remaining resources (i.e.,
+  // those that are not used by the launched tasks or their executors)
+  // will be considered declined. Note that this includes resources
+  // used by tasks that the framework attempted to launch but failed
+  // (with TASK_ERROR) due to a malformed task description. The
+  // specified filters are applied on all unused resources (see
+  // mesos.proto for a description of Filters). Available resources
+  // are aggregated when multiple offers are provided. Note that all
+  // offers must belong to the same slave. Invoking this function with
+  // an empty collection of tasks declines offers in their entirety
+  // (see Scheduler::declineOffer).
   virtual Status launchTasks(
       const std::vector<OfferID>& offerIds,
       const std::vector<TaskInfo>& tasks,
@@ -244,11 +247,15 @@ public:
 
   // Accepts the given offers and performs a sequence of operations on
   // those accepted offers. See Offer.Operation in mesos.proto for the
-  // set of available operations. Available resources are aggregated
+  // set of available operations. Any remaining resources (i.e., those
+  // that are not used by the launched tasks or their executors) will
+  // be considered declined. Note that this includes resources used by
+  // tasks that the framework attempted to launch but failed (with
+  // TASK_ERROR) due to a malformed task description. The specified
+  // filters are applied on all unused resources (see mesos.proto for
+  // a description of Filters). Available resources are aggregated
   // when multiple offers are provided. Note that all offers must
-  // belong to the same slave. Any unused resources will be considered
-  // declined. The specified filters are applied on all unused
-  // resources (see mesos.proto for a description of Filters).
+  // belong to the same slave.
   virtual Status acceptOffers(
       const std::vector<OfferID>& offerIds,
       const std::vector<Offer::Operation>& operations,

http://git-wip-us.apache.org/repos/asf/mesos/blob/b717226f/src/java/src/org/apache/mesos/SchedulerDriver.java
----------------------------------------------------------------------
diff --git a/src/java/src/org/apache/mesos/SchedulerDriver.java 
b/src/java/src/org/apache/mesos/SchedulerDriver.java
index bf866f5..3f03e91 100644
--- a/src/java/src/org/apache/mesos/SchedulerDriver.java
+++ b/src/java/src/org/apache/mesos/SchedulerDriver.java
@@ -115,14 +115,17 @@ public interface SchedulerDriver {
   Status requestResources(Collection<Request> requests);
 
   /**
-   * 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 {@link #declineOffer}).
+   * Launches the given set of tasks. Any remaining resources (i.e.,
+   * those that are not used by the launched tasks or their executors)
+   * will be considered declined. Note that this includes resources
+   * used by tasks that the framework attempted to launch but failed
+   * (with TASK_ERROR) due to a malformed task description. The
+   * specified filters are applied on all unused resources (see
+   * mesos.proto for a description of Filters). Available resources
+   * are aggregated when multiple offers are provided. Note that all
+   * offers must belong to the same slave. Invoking this function with
+   * an empty collection of tasks declines offers in their entirety
+   * (see {@link #declineOffer}).
    *
    * @param offerIds    The collection of offer IDs.
    * @param tasks       The collection of tasks to be launched.
@@ -195,11 +198,15 @@ public interface SchedulerDriver {
   /**
    * Accepts the given offers and performs a sequence of operations on
    * those accepted offers. See Offer.Operation in mesos.proto for the
-   * set of available operations. Available resources are aggregated
+   * set of available operations. Any remaining resources (i.e., those
+   * that are not used by the launched tasks or their executors) will
+   * be considered declined. Note that this includes resources used by
+   * tasks that the framework attempted to launch but failed (with
+   * TASK_ERROR) due to a malformed task description. The specified
+   * filters are applied on all unused resources (see mesos.proto for
+   * a description of Filters). Available resources are aggregated
    * when multiple offers are provided. Note that all offers must
-   * belong to the same slave. Any unused resources will be considered
-   * declined. The specified filters are applied on all unused
-   * resources (see mesos.proto for a description of Filters).
+   * belong to the same slave.
    *
    * @param offerIds    The collection of offer IDs.
    * @param operations  The collection of offer operations to perform.

http://git-wip-us.apache.org/repos/asf/mesos/blob/b717226f/src/python/interface/src/mesos/interface/__init__.py
----------------------------------------------------------------------
diff --git a/src/python/interface/src/mesos/interface/__init__.py 
b/src/python/interface/src/mesos/interface/__init__.py
index 232890d..1da76eb 100644
--- a/src/python/interface/src/mesos/interface/__init__.py
+++ b/src/python/interface/src/mesos/interface/__init__.py
@@ -184,15 +184,18 @@ class SchedulerDriver(object):
 
   def launchTasks(self, offerIds, tasks, filters=None):
     """
-      Launches the given set of tasks. 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). Available resources are
-      aggregated when multiple offers are provided. Note that all offers
-      must belong to the same slave. Invoking this function with an empty
-      collection of tasks declines the offers in entirety (see
-      Scheduler.declineOffer). Note that passing a single offer is also
-      supported.
+      Launches the given set of tasks. Any remaining resources (i.e.,
+      those that are not used by the launched tasks or their executors)
+      will be considered declined. Note that this includes resources
+      used by tasks that the framework attempted to launch but failed
+      (with TASK_ERROR) due to a malformed task description. The
+      specified filters are applied on all unused resources (see
+      mesos.proto for a description of Filters). Available resources
+      are aggregated when multiple offers are provided. Note that all
+      offers must belong to the same slave. Invoking this function with
+      an empty collection of tasks declines offers in their entirety
+      (see Scheduler.declineOffer). Note that passing a single offer
+      is also supported.
     """
 
   def killTask(self, taskId):
@@ -206,13 +209,17 @@ class SchedulerDriver(object):
 
   def acceptOffers(self, offerIds, operations, filters=None):
     """
-      Accepts the given offers and performs a sequence of operations
-      on those accepted offers. See Offer.Operation in mesos.proto for
-      the set of available operations. Available resources are
-      aggregated when multiple offers are provided. Note that all
-      offers must belong to the same slave. Any unused resources will
-      be considered declined. The specified filters are applied on all
-      unused resources (see mesos.proto for a description of Filters).
+      Accepts the given offers and performs a sequence of operations on
+      those accepted offers. See Offer.Operation in mesos.proto for the
+      set of available operations. Any remaining resources (i.e., those
+      that are not used by the launched tasks or their executors) will
+      be considered declined. Note that this includes resources used by
+      tasks that the framework attempted to launch but failed (with
+      TASK_ERROR) due to a malformed task description. The specified
+      filters are applied on all unused resources (see mesos.proto for
+      a description of Filters). Available resources are aggregated
+      when multiple offers are provided. Note that all offers must
+      belong to the same slave.
     """
 
   def declineOffer(self, offerId, filters=None):

Reply via email to