You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2014/12/04 02:33:35 UTC

[1/4] mesos git commit: Moved repeated labels to Labels message.

Repository: mesos
Updated Branches:
  refs/heads/master 4be93ab2c -> 65bf0f81f


Moved repeated labels to Labels message.

We suggested to change hooks into manipulating task labels only. With
that in mind and based on BenH's suggestion originally, this patch set
wraps the repeated Labels field in a message when can be used without
referring to repeated field types.

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


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

Branch: refs/heads/master
Commit: c3bdaf989ba5f407ea2074175d9c3ea48bf0f061
Parents: 4be93ab
Author: Niklas Nielsen <ni...@qni.dk>
Authored: Wed Dec 3 16:36:54 2014 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Wed Dec 3 17:11:21 2014 -0800

----------------------------------------------------------------------
 include/mesos/mesos.proto | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c3bdaf98/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index e0b6375..540071d 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -636,7 +636,7 @@ message TaskInfo {
   // acted upon by Mesos itself. As opposed to the data field, labels
   // will be kept in memory on master and slave processes. Therefore,
   // labels should be used to tag tasks with light-weight meta-data.
-  repeated Label labels = 10;
+  optional Labels labels = 10;
 }
 
 
@@ -974,6 +974,15 @@ message ContainerInfo {
   optional DockerInfo docker = 3;
 }
 
+
+/**
+ * Collection of labels.
+ */
+message Labels {
+    repeated Label labels = 1;
+}
+
+
 /**
  * Key, value pair used to store free form user-data.
  */


[2/4] mesos git commit: Changed task to use Labels.

Posted by nn...@apache.org.
Changed task to use Labels.

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


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

Branch: refs/heads/master
Commit: ca555579c5c1cba9c61b12b2f9085e2d102925b0
Parents: c3bdaf9
Author: Niklas Nielsen <ni...@qni.dk>
Authored: Wed Dec 3 16:38:09 2014 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Wed Dec 3 17:11:22 2014 -0800

----------------------------------------------------------------------
 src/messages/messages.proto | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ca555579/src/messages/messages.proto
----------------------------------------------------------------------
diff --git a/src/messages/messages.proto b/src/messages/messages.proto
index 28e593f..6b261f7 100644
--- a/src/messages/messages.proto
+++ b/src/messages/messages.proto
@@ -54,7 +54,7 @@ message Task {
   optional TaskState status_update_state = 9;
   optional bytes status_update_uuid = 10;
 
-  repeated Label labels = 11;
+  optional Labels labels = 11;
 }
 
 


[3/4] mesos git commit: Changed tests to use Labels.

Posted by nn...@apache.org.
Changed tests to use Labels.

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


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

Branch: refs/heads/master
Commit: 65bf0f81fbae51eedf8e497ab45d439128ecb377
Parents: 1b3d171
Author: Niklas Nielsen <ni...@qni.dk>
Authored: Wed Dec 3 16:38:48 2014 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Wed Dec 3 17:11:22 2014 -0800

----------------------------------------------------------------------
 src/tests/master_tests.cpp | 8 +++++---
 src/tests/slave_tests.cpp  | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/65bf0f81/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 56cba65..4be4815 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -2580,15 +2580,17 @@ TEST_F(MasterTest, TaskLabels)
   task.mutable_executor()->MergeFrom(DEFAULT_EXECUTOR_INFO);
 
   // Add three labels to the task (two of which share the same key).
-  Label* label1 = task.add_labels();
+  Labels* labels = task.mutable_labels();
+
+  Label* label1 = labels->add_labels();
   label1->set_key("foo");
   label1->set_value("bar");
 
-  Label* label2 = task.add_labels();
+  Label* label2 = labels->add_labels();
   label2->set_key("bar");
   label2->set_value("baz");
 
-  Label* label3 = task.add_labels();
+  Label* label3 = labels->add_labels();
   label3->set_key("bar");
   label3->set_value("qux");
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/65bf0f81/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 3b80ca9..f2896a1 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -1442,15 +1442,17 @@ TEST_F(SlaveTest, TaskLabels)
   task.mutable_executor()->MergeFrom(DEFAULT_EXECUTOR_INFO);
 
   // Add three labels to the task (two of which share the same key).
-  Label* label1 = task.add_labels();
+  Labels* labels = task.mutable_labels();
+
+  Label* label1 = labels->add_labels();
   label1->set_key("foo");
   label1->set_value("bar");
 
-  Label* label2 = task.add_labels();
+  Label* label2 = labels->add_labels();
   label2->set_key("bar");
   label2->set_value("baz");
 
-  Label* label3 = task.add_labels();
+  Label* label3 = labels->add_labels();
   label3->set_key("bar");
   label3->set_value("qux");
 


[4/4] mesos git commit: Changed HTTP task modeling to use Labels.

Posted by nn...@apache.org.
Changed HTTP task modeling to use Labels.

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


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

Branch: refs/heads/master
Commit: 1b3d171eb1b44a6dc6f0212316c3f98274b2aea0
Parents: ca55557
Author: Niklas Nielsen <ni...@qni.dk>
Authored: Wed Dec 3 16:38:30 2014 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Wed Dec 3 17:11:22 2014 -0800

----------------------------------------------------------------------
 src/common/http.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1b3d171e/src/common/http.cpp
----------------------------------------------------------------------
diff --git a/src/common/http.cpp b/src/common/http.cpp
index 422fa68..0d0d52f 100644
--- a/src/common/http.cpp
+++ b/src/common/http.cpp
@@ -132,8 +132,10 @@ JSON::Object model(const Task& task)
   object.values["statuses"] = array;
 
   JSON::Array labels;
-  foreach (const Label& label, task.labels()) {
-    labels.values.push_back(JSON::Protobuf(label));
+  if (task.has_labels()) {
+    foreach (const Label& label, task.labels().labels()) {
+      labels.values.push_back(JSON::Protobuf(label));
+    }
   }
   object.values["labels"] = labels;
 
@@ -170,8 +172,10 @@ JSON::Object model(
   object.values["statuses"] = array;
 
   JSON::Array labels;
-  foreach (const Label& label, task.labels()) {
-    labels.values.push_back(JSON::Protobuf(label));
+  if (task.has_labels()) {
+    foreach (const Label& label, task.labels().labels()) {
+      labels.values.push_back(JSON::Protobuf(label));
+    }
   }
   object.values["labels"] = labels;