blob: d1743302b55615cb443e382ec1d2764e4924f263 [file] [log] [blame]
// 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
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
#include <list>
#include <string>
#include <mesos/resources.hpp>
#include <mesos/slave/oversubscription.hpp>
#include <process/future.hpp>
#include <process/queue.hpp>
#include <stout/lambda.hpp>
#include <stout/nothing.hpp>
#include <stout/option.hpp>
#include <stout/try.hpp>
namespace mesos {
namespace slave {
// A slave component used for oversubscription. When the revocable
// tasks are running, it is important to constantly monitor the
// original tasks running on those resources and guarantee performance
// based on an SLA. In order to react to detected interference, the
// QoS controller needs to be able to kill or throttle running
// revocable tasks.
class QoSController
// Create a QoS Controller instance of the given type specified
// by the user. If the type is not specified, a default resource
// estimator instance will be created.
static Try<QoSController*> create(const Option<std::string>& type);
virtual ~QoSController() {}
// Initializes this QoS Controller. This method needs to be
// called before any other member method is called. It registers
// a callback in the QoS Controller. The callback allows the
// QoS Controller to fetch the current resource usage for each
// executor on slave.
virtual Try<Nothing> initialize(
const lambda::function<process::Future<ResourceUsage>()>& usage) = 0;
// A QoS Controller informs the slave about corrections to carry
// out, but returning futures to QoSCorrection objects. For more
// information, please refer to mesos.proto.
virtual process::Future<std::list<QoSCorrection>> corrections() = 0;
} // namespace slave {
} // namespace mesos {