MCPcopy Create free account
hub / github.com/apache/mesos / create

Function create

src/slave/qos_controllers/load.cpp:175–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173
174
175static QoSController* create(const Parameters& parameters)
176{
177 // Obtain the system load threshold from parameters.
178 Option<double> loadThreshold5Min = None();
179 Option<double> loadThreshold15Min = None();
180
181 foreach (const Parameter& parameter, parameters.parameter()) {
182 if (parameter.key() == "load_threshold_5min") {
183 // Try to parse the load 5min value.
184 Try<double> thresholdParam = numify<double>(parameter.value());
185 if (thresholdParam.isError()) {
186 LOG(ERROR) << "Failed to parse 5 min load threshold: "
187 << thresholdParam.error();
188 return nullptr;
189 }
190
191 loadThreshold5Min = thresholdParam.get();
192 } else if (parameter.key() == "load_threshold_15min") {
193 // Try to parse the load 15min value.
194 Try<double> thresholdParam = numify<double>(parameter.value());
195 if (thresholdParam.isError()) {
196 LOG(ERROR) << "Failed to parse 15 min load threshold: "
197 << thresholdParam.error();
198 return nullptr;
199 }
200
201 loadThreshold15Min = thresholdParam.get();
202 }
203 }
204
205 if (loadThreshold5Min.isNone() && loadThreshold15Min.isNone()) {
206 LOG(ERROR) << "No load thresholds are configured for LoadQoSController";
207 return nullptr;
208 }
209
210 return new mesos::internal::slave::LoadQoSController(
211 loadThreshold5Min, loadThreshold15Min);
212}
213
214
215Module<QoSController> org_apache_mesos_LoadQoSController(

Callers 15

MesosProcessMethod · 0.50
synchronizedMethod · 0.50
foreachpairFunction · 0.50
getFlagsMethod · 0.50
setLoggingLevelMethod · 0.50
stateMethod · 0.50
getFrameworksMethod · 0.50
getExecutorsMethod · 0.50
getOperationsMethod · 0.50
getTasksMethod · 0.50

Calls 2

NoneClass · 0.85
isNoneMethod · 0.45

Tested by

no test coverage detected