Repository: mesos Updated Branches: refs/heads/master 461c521d4 -> 63f1c2ec8
Added QUIESCE call interface to the scheduler. Review: https://reviews.apache.org/r/37532 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3a1f2d36 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3a1f2d36 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3a1f2d36 Branch: refs/heads/master Commit: 3a1f2d36f8de0cacc085a828bd9bbc1f2a78f747 Parents: 461c521 Author: Guangya Liu <[email protected]> Authored: Fri Sep 18 16:13:18 2015 -0700 Committer: Vinod Kone <[email protected]> Committed: Fri Sep 18 16:13:18 2015 -0700 ---------------------------------------------------------------------- include/mesos/scheduler.hpp | 6 +++++ include/mesos/scheduler/scheduler.proto | 1 + src/master/master.cpp | 15 +++++++++++++ src/master/master.hpp | 2 ++ src/sched/sched.cpp | 33 ++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/3a1f2d36/include/mesos/scheduler.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/scheduler.hpp b/include/mesos/scheduler.hpp index ee198b6..071f448 100644 --- a/include/mesos/scheduler.hpp +++ b/include/mesos/scheduler.hpp @@ -268,6 +268,10 @@ public: // those filtered slaves. virtual Status reviveOffers() = 0; + // Inform Mesos master to stop sending offers to the framework. The + // scheduler should call reviveOffers() to resume getting offers. + virtual Status quiesceOffers() = 0; + // Acknowledges the status update. This should only be called // once the status update is processed durably by the scheduler. // Not that explicit acknowledgements must be requested via the @@ -416,6 +420,8 @@ public: virtual Status reviveOffers(); + virtual Status quiesceOffers(); + virtual Status acknowledgeStatusUpdate( const TaskStatus& status); http://git-wip-us.apache.org/repos/asf/mesos/blob/3a1f2d36/include/mesos/scheduler/scheduler.proto ---------------------------------------------------------------------- diff --git a/include/mesos/scheduler/scheduler.proto b/include/mesos/scheduler/scheduler.proto index 19f548d..89ddc10 100644 --- a/include/mesos/scheduler/scheduler.proto +++ b/include/mesos/scheduler/scheduler.proto @@ -174,6 +174,7 @@ message Call { RECONCILE = 9; // See 'Reconcile' below. MESSAGE = 10; // See 'Message' below. REQUEST = 11; // See 'Request' below. + QUIESCE = 12; // Inform master to stop sending offers to the framework. // TODO(benh): Consider adding an 'ACTIVATE' and 'DEACTIVATE' for // already subscribed frameworks as a way of stopping offers from http://git-wip-us.apache.org/repos/asf/mesos/blob/3a1f2d36/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index 3b390d7..7ae4ef8 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -1781,6 +1781,10 @@ void Master::receive( request(framework, call.request()); break; + case scheduler::Call::QUIESCE: + quiesce(framework); + break; + default: // Should be caught during call validation above. LOG(FATAL) << "Unexpected " << call.type() << " call" @@ -2597,6 +2601,17 @@ void Master::request( } +void Master::quiesce(Framework* framework) +{ + CHECK_NOTNULL(framework); + + LOG(INFO) << "Processing QUIESCE call for framework " << *framework; + + //TODO(gyliu513): Add quiesce logic here. + LOG(WARNING) << "Not implemented yet, ignoring the QUIESCE call."; +} + + void Master::launchTasks( const UPID& from, const FrameworkID& frameworkId, http://git-wip-us.apache.org/repos/asf/mesos/blob/3a1f2d36/src/master/master.hpp ---------------------------------------------------------------------- diff --git a/src/master/master.hpp b/src/master/master.hpp index d48ef7c..6805177 100644 --- a/src/master/master.hpp +++ b/src/master/master.hpp @@ -829,6 +829,8 @@ private: Framework* framework, const scheduler::Call::Request& request); + void quiesce(Framework* framework); + bool elected() const { return leader.isSome() && leader.get() == info_; http://git-wip-us.apache.org/repos/asf/mesos/blob/3a1f2d36/src/sched/sched.cpp ---------------------------------------------------------------------- diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp index a1723f3..84c2edb 100644 --- a/src/sched/sched.cpp +++ b/src/sched/sched.cpp @@ -1242,6 +1242,23 @@ protected: send(master.get().pid(), call); } + void quiesceOffers() + { + if (!connected) { + VLOG(1) << "Ignoring quiesce offers message as master is disconnected"; + return; + } + + Call call; + + CHECK(framework.has_id()); + call.mutable_framework_id()->CopyFrom(framework.id()); + call.set_type(Call::QUIESCE); + + CHECK_SOME(master); + send(master.get().pid(), call); + } + void acknowledgeStatusUpdate( const TaskStatus& status) { @@ -1934,6 +1951,22 @@ Status MesosSchedulerDriver::reviveOffers() } +Status MesosSchedulerDriver::quiesceOffers() +{ + synchronized (mutex) { + if (status != DRIVER_RUNNING) { + return status; + } + + CHECK(process != NULL); + + dispatch(process, &SchedulerProcess::quiesceOffers); + + return status; + } +} + + Status MesosSchedulerDriver::acknowledgeStatusUpdate( const TaskStatus& taskStatus) {
