You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by as...@apache.org on 2020/10/13 16:04:07 UTC

[mesos] branch master updated (301902b -> d4678d3)

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

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


    from 301902b  Ignored the directoy `/dev/nvidia-caps` when globing Nvidia GPU devices.
     new 8d3a76f  Made the offer constraints filter non-optional inside the allocator.
     new d4678d3  Added suppressed roles to `allocator/offer_constraints_debug` endpoint.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/master/allocator/mesos/hierarchical.cpp | 33 +++++++++++++++++------------
 src/master/allocator/mesos/hierarchical.hpp |  2 +-
 2 files changed, 20 insertions(+), 15 deletions(-)


[mesos] 02/02: Added suppressed roles to `allocator/offer_constraints_debug` endpoint.

Posted by as...@apache.org.
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 <as...@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) {


[mesos] 01/02: Made the offer constraints filter non-optional inside the allocator.

Posted by as...@apache.org.
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 8d3a76f4261f8d249504de5330ce86ba07a17f56
Author: Andrei Sekretenko <as...@apache.org>
AuthorDate: Mon Oct 12 15:42:50 2020 +0200

    Made the offer constraints filter non-optional inside the allocator.
    
    Now that the master always constructs an offer constraints filter
    for a framework (potentially a no-op one) and always passes this filter
    into an allocator, storing the filter as an `Option` inside the
    hierarchical allocator is no longer necessary.
    
    Review: https://reviews.apache.org/r/72953
---
 src/master/allocator/mesos/hierarchical.cpp | 23 ++++++++---------------
 src/master/allocator/mesos/hierarchical.hpp |  2 +-
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index 35264b9..41a4924 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -2178,8 +2178,7 @@ void HierarchicalAllocatorProcess::__generateOffers()
         const Framework& framework = *CHECK_NOTNONE(getFramework(frameworkId));
         CHECK(framework.active) << frameworkId;
 
-        if (framework.offerConstraintsFilter.isSome() &&
-            framework.offerConstraintsFilter->isAgentExcluded(
+        if (framework.offerConstraintsFilter.isAgentExcluded(
                 role, slave.info)) {
           // Framework filters the agent regardless of remaining resources.
           continue;
@@ -2414,8 +2413,7 @@ void HierarchicalAllocatorProcess::__generateOffers()
 
         const Framework& framework = *CHECK_NOTNONE(getFramework(frameworkId));
 
-        if (framework.offerConstraintsFilter.isSome() &&
-            framework.offerConstraintsFilter->isAgentExcluded(
+        if (framework.offerConstraintsFilter.isAgentExcluded(
                 role, slave.info)) {
           // Framework filters the agent regardless of remaining resources.
           continue;
@@ -3244,14 +3242,15 @@ static string OFFER_CONSTRAINTS_DEBUG_HELP()
         "         \"0b1e7d60-dfbc-44c9-8222-48b57eca8637-S123\",",
         "         \"654af69c-80f7-45ad-bcb3-c7c917f1811b-S045\"],",
         "       \"role2\": [] }},",
-        "   \"b0377da6-090d-4338-9e2e-bf6cf0f309b7-0011\": {}",
+        "   \"b0377da6-090d-4338-9e2e-bf6cf0f309b7-0011\": {",
+        "     \"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\",",
-        "and the second framework (-0011) has no offer constraints set."
-        ),
+        "are excluded from allocation to this framework under \"role2\".",
+        "The second framework (-0011) is also subscribed to \"role1\",",
+        "but has no agents excluded from allocation to \"role1\"."),
     process::AUTHENTICATION(true),
     process::AUTHORIZATION(
         "This endpoint skips frameworks for which the user is not authorized"
@@ -3301,19 +3300,13 @@ process::http::Response HierarchicalAllocatorProcess::offerConstraintsDebug_(
   auto writeFrameworks = [&](JSON::ObjectWriter* writer) {
     for (const Framework* framework : approvedFrameworks) {
       auto writeFramework = [&](JSON::ObjectWriter* writer) {
-        if (framework->offerConstraintsFilter.isNone()) {
-          // For an authorized frameworks without offer constraints,
-          // an empty object is written.
-          return;
-        }
-
         writer->field(
             "excluded_by_attribute_constraints",
             [&](JSON::ObjectWriter* writer) {
               for (const string& role : framework->roles) {
                 writer->field(role, [&](JSON::ArrayWriter* writer) {
                   foreachvalue (const Slave& slave, slaves) {
-                    if (framework->offerConstraintsFilter->isAgentExcluded(
+                    if (framework->offerConstraintsFilter.isAgentExcluded(
                             role, slave.info)) {
                       writer->element(stringify(slave.id));
                     }
diff --git a/src/master/allocator/mesos/hierarchical.hpp b/src/master/allocator/mesos/hierarchical.hpp
index 4ec15b6..99b9c24 100644
--- a/src/master/allocator/mesos/hierarchical.hpp
+++ b/src/master/allocator/mesos/hierarchical.hpp
@@ -117,7 +117,7 @@ struct Framework
   // offer constraints.
   hashmap<std::string, std::vector<ResourceQuantities>> minAllocatableResources;
 
-  Option<::mesos::allocator::OfferConstraintsFilter> offerConstraintsFilter;
+  ::mesos::allocator::OfferConstraintsFilter offerConstraintsFilter;
 };