You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mz...@apache.org on 2019/05/13 13:46:14 UTC

[mesos] branch master updated (62f0b69 -> 88ce572)

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

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


    from 62f0b69  Revert "Added an UPDATE_FRAMEWORK scheduler::Call."
     new cf6eb0b  Fixed a bug where random sorter fails to clear removed clients.
     new 88ce572  Templatized two sorter tests for both random and DRF.

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/sorter/random/sorter.cpp |  3 +++
 src/tests/sorter_tests.cpp                    | 29 ++++++++++++++++++++-------
 2 files changed, 25 insertions(+), 7 deletions(-)


[mesos] 01/02: Fixed a bug where random sorter fails to clear removed clients.

Posted by mz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cf6eb0bc1c007184d790ada81a2cf33492b94ca5
Author: Meng Zhu <mz...@mesosphere.io>
AuthorDate: Mon May 13 14:32:37 2019 +0200

    Fixed a bug where random sorter fails to clear removed clients.
    
    Review: https://reviews.apache.org/r/70630
---
 src/master/allocator/sorter/random/sorter.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/master/allocator/sorter/random/sorter.cpp b/src/master/allocator/sorter/random/sorter.cpp
index 813f5b5..9899cfd 100644
--- a/src/master/allocator/sorter/random/sorter.cpp
+++ b/src/master/allocator/sorter/random/sorter.cpp
@@ -583,6 +583,9 @@ void RandomSorter::SortInfo::updateRelativeWeights()
            activeInternalNodes.contains(node);
   };
 
+  clients.clear();
+  weights.clear();
+
   // Note, though we reserve here, the size of the vector will always
   // grow (as we add more roles).
   clients.reserve(sorter->clients.size());


[mesos] 02/02: Templatized two sorter tests for both random and DRF.

Posted by mz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 88ce5722c0905633fa5df51a88a0d314ea8b4ffe
Author: Meng Zhu <mz...@mesosphere.io>
AuthorDate: Mon May 13 14:35:30 2019 +0200

    Templatized two sorter tests for both random and DRF.
    
    Review: https://reviews.apache.org/r/70631
---
 src/tests/sorter_tests.cpp | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/tests/sorter_tests.cpp b/src/tests/sorter_tests.cpp
index 9aee2b4..5cd2a64 100644
--- a/src/tests/sorter_tests.cpp
+++ b/src/tests/sorter_tests.cpp
@@ -1009,9 +1009,9 @@ TEST(DRFSorterTest, AddChildToInactiveLeaf)
 // This test checks what happens when a sorter client is removed,
 // which allows a leaf node to be collapsed into its parent node. This
 // is basically the inverse situation to `AddChildToLeaf`.
-TEST(DRFSorterTest, RemoveLeafCollapseParent)
+TYPED_TEST(CommonSorterTest, RemoveLeafCollapseParent)
 {
-  DRFSorter sorter;
+  TypeParam sorter;
 
   SlaveID slaveId;
   slaveId.set_value("agentId");
@@ -1033,20 +1033,30 @@ TEST(DRFSorterTest, RemoveLeafCollapseParent)
   sorter.allocated(
       "a/c", slaveId, Resources::parse("cpus:5;mem:5").get());
 
-  EXPECT_EQ(vector<string>({"b", "a/c", "a"}), sorter.sort());
+  // We sort the `sort()` output alphabetically here since we only
+  // want to verify the content of elements but not their order.
+  vector<string> clients = sorter.sort();
+  sort(clients.begin(), clients.end());
+
+  EXPECT_EQ(vector<string>({"a", "a/c", "b"}), clients);
 
   sorter.remove("a/c");
 
-  EXPECT_EQ(vector<string>({"b", "a"}), sorter.sort());
+  // We sort the `sort()` output alphabetically here since we only
+  // want to verify the content of elements but not their order.
+  clients = sorter.sort();
+  sort(clients.begin(), clients.end());
+
+  EXPECT_EQ(vector<string>({"a", "b"}), clients);
 }
 
 
 // This test checks what happens when a sorter client is removed and a
 // leaf node can be collapsed into its parent node, we correctly
 // propagate the `inactive` flag from leaf -> parent.
-TEST(DRFSorterTest, RemoveLeafCollapseParentInactive)
+TYPED_TEST(CommonSorterTest, RemoveLeafCollapseParentInactive)
 {
-  DRFSorter sorter;
+  TypeParam sorter;
 
   SlaveID slaveId;
   slaveId.set_value("agentId");
@@ -1070,7 +1080,12 @@ TEST(DRFSorterTest, RemoveLeafCollapseParentInactive)
 
   sorter.deactivate("a");
 
-  EXPECT_EQ(vector<string>({"b", "a/c"}), sorter.sort());
+  // We sort the `sort()` output alphabetically here since we only
+  // want to verify the content of elements but not their order.
+  vector<string> clients = sorter.sort();
+  sort(clients.begin(), clients.end());
+
+  EXPECT_EQ(vector<string>({"a/c", "b"}), clients);
 
   sorter.remove("a/c");