This is an automated email from the ASF dual-hosted git repository.

asekretenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit d4678d33b223fec5d48007f8246f1ed1cda5e90d
Author: Andrei Sekretenko <asekrete...@apache.org>
AuthorDate: Mon Oct 12 15:42:50 2020 +0200

    Added suppressed roles to `allocator/offer_constraints_debug` endpoint.
    
    This simplifies debugging frameworks that use offer constraints.
    
    For example, in case a framework is not receiving offers for a role,
    getting a suppressed roles snapshot simultaneously with agent
    filtering results helps to figure out whether the framework is
    mis-specifying offer constraints, or just wrongly suppresses a role.
    
    Review: https://reviews.apache.org/r/72954
---
 src/master/allocator/mesos/hierarchical.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/master/allocator/mesos/hierarchical.cpp 
b/src/master/allocator/mesos/hierarchical.cpp
index 41a4924..b7cb240 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -3231,26 +3231,32 @@ static string OFFER_CONSTRAINTS_DEBUG_HELP()
         "Evaluates current framework offer constraints and returns results."),
     process::DESCRIPTION(
         "This endpoint evaluates for each role of each framework a list",
-        "of agents excluded from allocation by offer constraints.",
+        "of agents excluded from allocation by offer constraints,",
+        "and also reports the current set of framework's suppressed roles",
         "",
         "Example:",
         "```",
         "{\"frameworks\": {",
         "   \"0f4c63a9-be1e-4a90-9e11-d7bf0aa6c8ad-0017\": {",
+        "     \"suppressed_roles\": [\"role2\"]",
         "     \"excluded_by_attribute_constraints\": {",
         "       \"role1\": [",
         "         \"0b1e7d60-dfbc-44c9-8222-48b57eca8637-S123\",",
         "         \"654af69c-80f7-45ad-bcb3-c7c917f1811b-S045\"],",
         "       \"role2\": [] }},",
         "   \"b0377da6-090d-4338-9e2e-bf6cf0f309b7-0011\": {",
+        "     \"suppressed_roles\": []",
         "     \"excluded_by_attribute_constraints\": { \"role1\": [] }}",
         "}}",
         "```",
         "In this example, two agents are excluded from allocation",
         "to the first framework (-0017) under the role \"role1\", no agents",
         "are excluded from allocation to this framework under \"role2\".",
+        "In addition, this framework has \"role2\" suppressed.",
         "The second framework (-0011) is also subscribed to \"role1\",",
-        "but has no agents excluded from allocation to \"role1\"."),
+        "but has no agents excluded from allocation to \"role1\";",
+        "this framework has no roles currently suppressed."
+        ),
     process::AUTHENTICATION(true),
     process::AUTHORIZATION(
         "This endpoint skips frameworks for which the user is not authorized"
@@ -3300,6 +3306,12 @@ process::http::Response 
HierarchicalAllocatorProcess::offerConstraintsDebug_(
   auto writeFrameworks = [&](JSON::ObjectWriter* writer) {
     for (const Framework* framework : approvedFrameworks) {
       auto writeFramework = [&](JSON::ObjectWriter* writer) {
+        writer->field("suppressed_roles", [&](JSON::ArrayWriter* writer) {
+          for (const string& role : framework->suppressedRoles) {
+            writer->element(role);
+          }
+        });
+
         writer->field(
             "excluded_by_attribute_constraints",
             [&](JSON::ObjectWriter* writer) {

Reply via email to