Apache Mesos
qos_controller.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MESOS_SLAVE_QOS_CONTROLLER_HPP__
18 #define __MESOS_SLAVE_QOS_CONTROLLER_HPP__
19 
20 #include <list>
21 #include <string>
22 
23 #include <mesos/resources.hpp>
24 
26 
27 #include <process/future.hpp>
28 #include <process/queue.hpp>
29 
30 #include <stout/lambda.hpp>
31 #include <stout/nothing.hpp>
32 #include <stout/option.hpp>
33 #include <stout/try.hpp>
34 
35 namespace mesos {
36 namespace slave {
37 
38 // A slave component used for oversubscription. When the revocable
39 // tasks are running, it is important to constantly monitor the
40 // original tasks running on those resources and guarantee performance
41 // based on an SLA. In order to react to detected interference, the
42 // QoS controller needs to be able to kill or throttle running
43 // revocable tasks.
45 {
46 public:
47  // Create a QoS Controller instance of the given type specified
48  // by the user. If the type is not specified, a default resource
49  // estimator instance will be created.
51 
52  virtual ~QoSController() {}
53 
54  // Initializes this QoS Controller. This method needs to be
55  // called before any other member method is called. It registers
56  // a callback in the QoS Controller. The callback allows the
57  // QoS Controller to fetch the current resource usage for each
58  // executor on slave.
59  virtual Try<Nothing> initialize(
60  const lambda::function<process::Future<ResourceUsage>()>& usage) = 0;
61 
62  // A QoS Controller informs the slave about corrections to carry
63  // out, but returning futures to QoSCorrection objects. For more
64  // information, please refer to mesos.proto.
66 };
67 
68 } // namespace slave {
69 } // namespace mesos {
70 
71 #endif // __MESOS_SLAVE_QOS_CONTROLLER_HPP__
Definition: check.hpp:33
virtual Try< Nothing > initialize(const lambda::function< process::Future< ResourceUsage >()> &usage)=0
virtual ~QoSController()
Definition: qos_controller.hpp:52
static Try< QoSController * > create(const Option< std::string > &type)
virtual process::Future< std::list< QoSCorrection > > corrections()=0
Try< ResourceStatistics > usage(pid_t pid, bool mem=true, bool cpus=true)
Definition: agent.hpp:25
Try< uint32_t > type(const std::string &path)
Definition: qos_controller.hpp:44
Definition: future.hpp:58