You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2018/07/10 15:59:52 UTC

[2/2] mesos git commit: Improved logging for offers and inverse offers.

Improved logging for offers and inverse offers.

Log offer IDs and inverse offer IDs when sending out offers and
inverse offers so it is easier to match them to their ACCEPT or DECLINE
calls and removals.

Also log at `VLOG(2)` level which resources are offered.

NOTE: It is possible to enable `VLOG(2)` logs just for `master.cpp` by
setting the following env variable when starting the master:
`GLOG_vmodule=master=2`.

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


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

Branch: refs/heads/master
Commit: fc5fcfd05520b1459b883e088250bf527a6a564e
Parents: e4ea236
Author: Gastón Kleiman <ga...@mesosphere.io>
Authored: Tue Jul 10 08:06:32 2018 -0700
Committer: Greg Mann <gr...@gmail.com>
Committed: Tue Jul 10 08:20:24 2018 -0700

----------------------------------------------------------------------
 src/master/master.cpp | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fc5fcfd0/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index e14f7de..487ee34 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -9417,6 +9417,9 @@ void Master::offer(
   // and a single allocation role.
   ResourceOffersMessage message;
 
+  // We keep track of the offer IDs so that we can log them.
+  vector<OfferID> offerIds;
+
   foreachkey (const string& role, resources) {
     foreachpair (const SlaveID& slaveId,
                  const Resources& offered,
@@ -9562,6 +9565,13 @@ void Master::offer(
       // Add the offer *AND* the corresponding slave's PID.
       message.add_offers()->MergeFrom(offer_);
       message.add_pids(slave->pid);
+
+      offerIds.push_back(offer_.id());
+
+      VLOG(2) << "Sending offer " << offer_.id()
+              << " containing resources " << offered
+              << " on agent " << *slave
+              << " to framework " << *framework;
     }
   }
 
@@ -9569,8 +9579,7 @@ void Master::offer(
     return;
   }
 
-  LOG(INFO) << "Sending " << message.offers().size()
-            << " offers to framework " << *framework;
+  LOG(INFO) << "Sending offers " << offerIds << " to framework " << *framework;
 
   framework->send(message);
 }
@@ -9672,8 +9681,13 @@ void Master::inverseOffer(
     return;
   }
 
-  LOG(INFO) << "Sending " << message.inverse_offers().size()
-            << " inverse offers to framework " << *framework;
+  vector<OfferID> inverseOfferIds;
+  foreach (const InverseOffer& inverseOffer, message.inverse_offers()) {
+    inverseOfferIds.push_back(inverseOffer.id());
+  }
+
+  LOG(INFO) << "Sending inverse offers " << inverseOfferIds << " to framework "
+            << *framework;
 
   framework->send(message);
 }