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

Method state

src/slave/http.cpp:1331–1553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329
1330
1331Future<Response> Http::state(
1332 const Request& request,
1333 const Option<Principal>& principal) const
1334{
1335 if (slave->state == Slave::RECOVERING) {
1336 return ServiceUnavailable("Agent has not finished recovery");
1337 }
1338
1339 return ObjectApprovers::create(
1340 slave->authorizer,
1341 principal,
1342 {VIEW_FRAMEWORK,
1343 VIEW_TASK,
1344 VIEW_EXECUTOR,
1345 VIEW_FLAGS,
1346 VIEW_ROLE,
1347 VIEW_RESOURCE_PROVIDER})
1348 .then(defer(
1349 slave->self(),
1350 [this, request](const Owned<ObjectApprovers>& approvers) -> Response {
1351 // This lambda is consumed before the outer lambda
1352 // returns, hence capture by reference is fine here.
1353 auto state = [this, &approvers](JSON::ObjectWriter* writer) {
1354 writer->field("version", MESOS_VERSION);
1355
1356 if (build::GIT_SHA.isSome()) {
1357 writer->field("git_sha", build::GIT_SHA.get());
1358 }
1359
1360 if (build::GIT_BRANCH.isSome()) {
1361 writer->field("git_branch", build::GIT_BRANCH.get());
1362 }
1363
1364 if (build::GIT_TAG.isSome()) {
1365 writer->field("git_tag", build::GIT_TAG.get());
1366 }
1367
1368 writer->field("build_date", build::DATE);
1369 writer->field("build_time", build::TIME);
1370 writer->field("build_user", build::USER);
1371 writer->field("start_time", slave->startTime.secs());
1372
1373 writer->field("id", slave->info.id().value());
1374 writer->field("pid", string(slave->self()));
1375 writer->field("hostname", slave->info.hostname());
1376 writer->field(
1377 "capabilities",
1378 slave->capabilities.toRepeatedPtrField());
1379
1380 if (slave->info.has_domain()) {
1381 writer->field("domain", slave->info.domain());
1382 }
1383
1384 if (slave->drainConfig.isSome()) {
1385 writer->field(
1386 "drain_config",
1387 JSON::Protobuf(slave->drainConfig.get()));
1388

Callers 15

message.hppFile · 0.45
foreachpairFunction · 0.45
_applyOperationMethod · 0.45
updateOperationStatusMethod · 0.45
updateMethod · 0.45
_handleMethod · 0.45
receivedMethod · 0.45
waitedMethod · 0.45
launchParentContainerMethod · 0.45
TEST_FFunction · 0.45

Calls 15

ServiceUnavailableClass · 0.85
deferFunction · 0.85
ProtobufClass · 0.85
FrameworkWriterClass · 0.85
OKClass · 0.85
jsonifyFunction · 0.85
fieldMethod · 0.80
toRepeatedPtrFieldMethod · 0.80
elementMethod · 0.80
foreachvalueFunction · 0.70
createFunction · 0.50
AttributesClass · 0.50

Tested by 15

launchParentContainerMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_PFunction · 0.36
TEST_FFunction · 0.36
TEST_PFunction · 0.36
TEST_FFunction · 0.36
awaitFinishedFunction · 0.36
TEST_PFunction · 0.36