mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinodk...@apache.org
Subject [5/6] mesos git commit: Added Python Support for QuiesceOffers.
Date Fri, 18 Sep 2015 23:17:03 GMT
Added Python Support for QuiesceOffers.

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


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

Branch: refs/heads/master
Commit: dd3fbe815b0edb74fec4101776af2830f47f90d5
Parents: 9c20b5d
Author: Guangya Liu <gyliu513@gmail.com>
Authored: Fri Sep 18 16:15:55 2015 -0700
Committer: Vinod Kone <vinodkone@gmail.com>
Committed: Fri Sep 18 16:15:55 2015 -0700

----------------------------------------------------------------------
 .../interface/src/mesos/interface/__init__.py      |  6 ++++++
 .../mesos/native/mesos_scheduler_driver_impl.cpp   | 17 +++++++++++++++++
 .../mesos/native/mesos_scheduler_driver_impl.hpp   |  3 +++
 3 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3fbe81/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 686abb2..cd60ead 100644
--- a/src/python/interface/src/mesos/interface/__init__.py
+++ b/src/python/interface/src/mesos/interface/__init__.py
@@ -230,6 +230,12 @@ class SchedulerDriver(object):
       those filtered slaves.
     """
 
+  def quiesceOffers(self):
+    """
+      Inform Mesos master to stop sending offers to the framework. The
+      scheduler should call reviveOffers() to resume getting offers.
+    """
+
   def acknowledgeStatusUpdate(self, status):
     """
       Acknowledges the status update. This should only be called

http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3fbe81/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.cpp
----------------------------------------------------------------------
diff --git a/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.cpp b/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.cpp
index 609dfa3..10208b1 100644
--- a/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.cpp
+++ b/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.cpp
@@ -143,6 +143,11 @@ PyMethodDef MesosSchedulerDriverImpl_methods[] = {
     METH_NOARGS,
     "Remove all filters and ask Mesos for new offers"
   },
+  { "quiesceOffers",
+    (PyCFunction) MesosSchedulerDriverImpl_quiesceOffers,
+    METH_NOARGS,
+    "Set quiescent attribute as true for the Framework"
+  },
   { "acknowledgeStatusUpdate",
     (PyCFunction) MesosSchedulerDriverImpl_acknowledgeStatusUpdate,
     METH_VARARGS,
@@ -654,6 +659,18 @@ PyObject* MesosSchedulerDriverImpl_reviveOffers(MesosSchedulerDriverImpl*
self)
 }
 
 
+PyObject* MesosSchedulerDriverImpl_quiesceOffers(MesosSchedulerDriverImpl* self)
+{
+  if (self->driver == NULL) {
+    PyErr_Format(PyExc_Exception, "MesosSchedulerDriverImpl.driver is NULL");
+    return NULL;
+  }
+
+  Status status = self->driver->quiesceOffers();
+  return PyInt_FromLong(status); // Sets exception if creating long fails.
+}
+
+
 PyObject* MesosSchedulerDriverImpl_acknowledgeStatusUpdate(
     MesosSchedulerDriverImpl* self,
     PyObject* args)

http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3fbe81/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.hpp
----------------------------------------------------------------------
diff --git a/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.hpp b/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.hpp
index b1ad8e5..04e3190 100644
--- a/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.hpp
+++ b/src/python/native/src/mesos/native/mesos_scheduler_driver_impl.hpp
@@ -115,6 +115,9 @@ PyObject* MesosSchedulerDriverImpl_declineOffer(
 
 PyObject* MesosSchedulerDriverImpl_reviveOffers(MesosSchedulerDriverImpl* self);
 
+PyObject* MesosSchedulerDriverImpl_quiesceOffers(
+    MesosSchedulerDriverImpl* self);
+
 PyObject* MesosSchedulerDriverImpl_acknowledgeStatusUpdate(
     MesosSchedulerDriverImpl* self,
     PyObject* args);


Mime
View raw message