You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/11/14 00:14:49 UTC

mesos git commit: Handled the resource conversion for new operations in master.

Repository: mesos
Updated Branches:
  refs/heads/master a595bcbf7 -> 776bfab96


Handled the resource conversion for new operations in master.

When a terminal status update for an offer operaiton is received, we
need to apply the conversion for the offer operation to the master's
view about the total resources of the corresponding agent.

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


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

Branch: refs/heads/master
Commit: 776bfab969c4df6d1ecea67f8a5aedf1ec3bed83
Parents: a595bcb
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Nov 13 16:14:39 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Nov 13 16:14:39 2017 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/776bfab9/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 59a5339..6c452bd 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -9748,6 +9748,12 @@ void Master::updateOfferOperation(
   CHECK(operation->has_slave_id())
     << "External resource provider is not supported yet";
 
+  // The slave owns the OfferOperation object and cannot be nullptr.
+  // TODO(jieyu): Revisit this once we introduce support for external
+  // resource provider.
+  Slave* slave = slaves.registered.get(operation->slave_id());
+  CHECK_NOTNULL(slave);
+
   switch (operation->latest_status().state()) {
     // Terminal state, and the conversion is successful.
     case OFFER_OPERATION_FINISHED: {
@@ -9766,6 +9772,8 @@ void Master::updateOfferOperation(
           converted,
           None());
 
+      slave->apply({ResourceConversion(consumed, converted)});
+
       break;
     }
 
@@ -9791,12 +9799,6 @@ void Master::updateOfferOperation(
     }
   }
 
-  // The slave owns the OfferOperation object and cannot be nullptr.
-  // TODO(jieyu): Revisit this once we introduce support for external
-  // resource provider.
-  Slave* slave = slaves.registered.get(operation->slave_id());
-  CHECK_NOTNULL(slave);
-
   slave->recoverResources(operation);
 
   Framework* framework = operation->has_framework_id()