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 2015/06/11 21:18:36 UTC

[2/3] mesos git commit: Added Test QoS Controller module.

Added Test QoS Controller module.

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


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

Branch: refs/heads/master
Commit: 22a4133cbb14787e64fbc7c72bf6b78cc2c521ec
Parents: 1e6847e
Author: Niklas Nielsen <ni...@qni.dk>
Authored: Thu Jun 11 11:56:07 2015 -0700
Committer: Niklas Q. Nielsen <ni...@qni.dk>
Committed: Thu Jun 11 12:18:14 2015 -0700

----------------------------------------------------------------------
 src/Makefile.am                             |  7 +++
 src/examples/test_qos_controller_module.cpp | 58 ++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/22a4133c/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 2df9238..3c44f01 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1463,6 +1463,13 @@ libtestresource_estimator_la_SOURCES =		\
 libtestresource_estimator_la_CPPFLAGS = $(MESOS_CPPFLAGS)
 libtestresource_estimator_la_LDFLAGS = $(MESOS_TEST_MODULE_LDFLAGS)
 
+# Library containing example test noop qos controller module.
+noinst_LTLIBRARIES += libtestqos_controller.la
+libtestqos_controller_la_SOURCES =		\
+  examples/test_qos_controller_module.cpp
+libtestqos_controller_la_CPPFLAGS = $(MESOS_CPPFLAGS)
+libtestqos_controller_la_LDFLAGS = $(MESOS_TEST_MODULE_LDFLAGS)
+
 mesos_tests_SOURCES =				\
   tests/anonymous_tests.cpp			\
   tests/attributes_tests.cpp			\

http://git-wip-us.apache.org/repos/asf/mesos/blob/22a4133c/src/examples/test_qos_controller_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_qos_controller_module.cpp b/src/examples/test_qos_controller_module.cpp
new file mode 100644
index 0000000..156529d
--- /dev/null
+++ b/src/examples/test_qos_controller_module.cpp
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string>
+
+#include <mesos/mesos.hpp>
+#include <mesos/module.hpp>
+
+#include <mesos/module/qos_controller.hpp>
+
+#include <mesos/slave/qos_controller.hpp>
+
+#include <stout/try.hpp>
+
+#include "slave/qos_controller.hpp"
+
+using namespace mesos;
+
+using mesos::internal::slave::NoopQoSController;
+
+using mesos::slave::QoSController;
+
+static QoSController* createQoSController(const Parameters& parameters)
+{
+  Try<QoSController*> result = NoopQoSController::create(None());
+  if (result.isError()) {
+    return NULL;
+  }
+  return result.get();
+}
+
+
+// Declares a TestNoopQoSController module named
+// 'org_apache_mesos_TestNoopQoSController'.
+mesos::modules::Module<QoSController>
+  org_apache_mesos_TestNoopQoSController(
+      MESOS_MODULE_API_VERSION,
+      MESOS_VERSION,
+      "Apache Mesos",
+      "modules@mesos.apache.org",
+      "Test Noop QoS Controller module.",
+      NULL,
+      createQoSController);