Repository: mesos Updated Branches: refs/heads/master 1b592c167 -> c4a6a4844
Moved QoS plug-in to separate directory. We need to move QoS plug-ins to a specified folder like resource_estimators, this can make sure new plug-ins can be put into the folders for resource estimator and qos controller. Review: https://reviews.apache.org/r/37479 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c4a6a484 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c4a6a484 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c4a6a484 Branch: refs/heads/master Commit: c4a6a48444b6b4623c24c141a7d681fa949748f4 Parents: 1b592c1 Author: Guangya Liu <[email protected]> Authored: Tue Aug 25 11:33:15 2015 -0700 Committer: Niklas Q. Nielsen <[email protected]> Committed: Tue Aug 25 11:33:16 2015 -0700 ---------------------------------------------------------------------- src/Makefile.am | 3 +- src/examples/test_qos_controller_module.cpp | 2 +- src/slave/qos_controller.cpp | 48 +-------------- src/slave/qos_controller.hpp | 58 ------------------ src/slave/qos_controllers/noop.cpp | 75 ++++++++++++++++++++++++ src/slave/qos_controllers/noop.hpp | 58 ++++++++++++++++++ 6 files changed, 137 insertions(+), 107 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/c4a6a484/src/Makefile.am ---------------------------------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index 9fd71d1..571e1ac 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -451,6 +451,7 @@ libmesos_no_3rdparty_la_SOURCES = \ slave/monitor.cpp \ slave/paths.cpp \ slave/qos_controller.cpp \ + slave/qos_controllers/noop.cpp \ slave/resource_estimator.cpp \ slave/slave.cpp \ slave/state.cpp \ @@ -726,7 +727,6 @@ libmesos_no_3rdparty_la_SOURCES += \ slave/metrics.hpp \ slave/monitor.hpp \ slave/paths.hpp \ - slave/qos_controller.hpp \ slave/slave.hpp \ slave/state.hpp \ slave/status_update_manager.hpp \ @@ -753,6 +753,7 @@ libmesos_no_3rdparty_la_SOURCES += \ slave/containerizer/isolators/filesystem/shared.hpp \ slave/containerizer/mesos/containerizer.hpp \ slave/containerizer/mesos/launch.hpp \ + slave/qos_controllers/noop.hpp \ slave/resource_estimators/noop.hpp \ tests/cluster.hpp \ tests/containerizer.hpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/c4a6a484/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 index 156529d..0168631 100644 --- a/src/examples/test_qos_controller_module.cpp +++ b/src/examples/test_qos_controller_module.cpp @@ -27,7 +27,7 @@ #include <stout/try.hpp> -#include "slave/qos_controller.hpp" +#include "slave/qos_controllers/noop.hpp" using namespace mesos; http://git-wip-us.apache.org/repos/asf/mesos/blob/c4a6a484/src/slave/qos_controller.cpp ---------------------------------------------------------------------- diff --git a/src/slave/qos_controller.cpp b/src/slave/qos_controller.cpp index 5788368..300dbea 100644 --- a/src/slave/qos_controller.cpp +++ b/src/slave/qos_controller.cpp @@ -26,7 +26,7 @@ #include "module/manager.hpp" -#include "slave/qos_controller.hpp" +#include "slave/qos_controllers/noop.hpp" using namespace process; @@ -57,49 +57,3 @@ Try<QoSController*> QoSController::create(const Option<string>& type) } // namespace slave { } // namespace mesos { - - -namespace mesos { -namespace internal { -namespace slave { - -class NoopQoSControllerProcess : public Process<NoopQoSControllerProcess> -{ -public: - virtual ~NoopQoSControllerProcess() {} - - NoopQoSControllerProcess() {} -}; - - -NoopQoSController::~NoopQoSController() -{ - if (process.get() != NULL) { - terminate(process.get()); - wait(process.get()); - } -} - - -Try<Nothing> NoopQoSController::initialize( - const lambda::function<Future<ResourceUsage>()>& usage) -{ - if (process.get() != NULL) { - return Error("Noop QoS Controller has already been initialized"); - } - - process.reset(new NoopQoSControllerProcess()); - spawn(process.get()); - - return Nothing(); -} - - -Future<list<mesos::slave::QoSCorrection>> NoopQoSController::corrections() -{ - return Future<list<mesos::slave::QoSCorrection>>(); -} - -} // namespace slave { -} // namespace internal { -} // namespace mesos { http://git-wip-us.apache.org/repos/asf/mesos/blob/c4a6a484/src/slave/qos_controller.hpp ---------------------------------------------------------------------- diff --git a/src/slave/qos_controller.hpp b/src/slave/qos_controller.hpp deleted file mode 100644 index 6188a74..0000000 --- a/src/slave/qos_controller.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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. - */ - -#ifndef __SLAVE_QOS_CONTROLLER_HPP__ -#define __SLAVE_QOS_CONTROLLER_HPP__ - -#include <mesos/slave/qos_controller.hpp> - -#include <stout/lambda.hpp> - -#include <process/owned.hpp> - -namespace mesos { -namespace internal { -namespace slave { - -// Forward declaration. -class NoopQoSControllerProcess; - - -// The NOOP QoS Controller is an empty stub, which returns a future -// which is never satisfied. Thus, the slave will never carry out any -// corrections. -class NoopQoSController : public mesos::slave::QoSController -{ -public: - virtual ~NoopQoSController(); - - virtual Try<Nothing> initialize( - const lambda::function<process::Future<ResourceUsage>()>& usage); - - virtual process::Future<std::list<mesos::slave::QoSCorrection>> corrections(); - -protected: - process::Owned<NoopQoSControllerProcess> process; -}; - - -} // namespace slave { -} // namespace internal { -} // namespace mesos { - -#endif // __SLAVE_QOS_CONTROLLER_HPP__ http://git-wip-us.apache.org/repos/asf/mesos/blob/c4a6a484/src/slave/qos_controllers/noop.cpp ---------------------------------------------------------------------- diff --git a/src/slave/qos_controllers/noop.cpp b/src/slave/qos_controllers/noop.cpp new file mode 100644 index 0000000..b8653ec --- /dev/null +++ b/src/slave/qos_controllers/noop.cpp @@ -0,0 +1,75 @@ +/** + * 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 <process/dispatch.hpp> +#include <process/process.hpp> + +#include <stout/error.hpp> + +#include <mesos/module/qos_controller.hpp> + +#include "slave/qos_controllers/noop.hpp" + +using namespace process; + +using std::list; + +namespace mesos { +namespace internal { +namespace slave { + +class NoopQoSControllerProcess : public Process<NoopQoSControllerProcess> +{ +public: + virtual ~NoopQoSControllerProcess() {} + + NoopQoSControllerProcess() {} +}; + + +NoopQoSController::~NoopQoSController() +{ + if (process.get() != NULL) { + terminate(process.get()); + wait(process.get()); + } +} + + +Try<Nothing> NoopQoSController::initialize( + const lambda::function<Future<ResourceUsage>()>& usage) +{ + if (process.get() != NULL) { + return Error("Noop QoS Controller has already been initialized"); + } + + process.reset(new NoopQoSControllerProcess()); + spawn(process.get()); + + return Nothing(); +} + + +Future<list<mesos::slave::QoSCorrection>> NoopQoSController::corrections() +{ + return Future<list<mesos::slave::QoSCorrection>>(); +} + +} // namespace slave { +} // namespace internal { +} // namespace mesos { http://git-wip-us.apache.org/repos/asf/mesos/blob/c4a6a484/src/slave/qos_controllers/noop.hpp ---------------------------------------------------------------------- diff --git a/src/slave/qos_controllers/noop.hpp b/src/slave/qos_controllers/noop.hpp new file mode 100644 index 0000000..77e37a2 --- /dev/null +++ b/src/slave/qos_controllers/noop.hpp @@ -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. + */ + +#ifndef __SLAVE_QOS_CONTROLLERS_NOOP_HPP__ +#define __SLAVE_QOS_CONTROLLERS_NOOP_HPP__ + +#include <mesos/slave/qos_controller.hpp> + +#include <stout/lambda.hpp> + +#include <process/owned.hpp> + +namespace mesos { +namespace internal { +namespace slave { + +// Forward declaration. +class NoopQoSControllerProcess; + + +// The NOOP QoS Controller is an empty stub, which returns a future +// which is never satisfied. Thus, the slave will never carry out any +// corrections. +class NoopQoSController : public mesos::slave::QoSController +{ +public: + virtual ~NoopQoSController(); + + virtual Try<Nothing> initialize( + const lambda::function<process::Future<ResourceUsage>()>& usage); + + virtual process::Future<std::list<mesos::slave::QoSCorrection>> corrections(); + +protected: + process::Owned<NoopQoSControllerProcess> process; +}; + + +} // namespace slave { +} // namespace internal { +} // namespace mesos { + +#endif // __SLAVE_QOS_CONTROLLERS_NOOP_HPP__
