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

Method acceptOffers

src/sched/sched.cpp:1312–1412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1310 }
1311
1312 void acceptOffers(
1313 const vector<OfferID>& offerIds,
1314 const vector<Offer::Operation>& operations,
1315 const Filters& filters)
1316 {
1317 // TODO(jieyu): Move all driver side verification to master since
1318 // we are moving towards supporting pure launguage scheduler.
1319
1320 if (!connected) {
1321 VLOG(1) << "Ignoring accept offers message as master is disconnected";
1322
1323 // Reply to the framework with TASK_DROPPED messages for each
1324 // task launch. If the framework is not partition-aware, we send
1325 // TASK_LOST instead. See details from notes in `launchTasks`.
1326 TaskState newTaskState = TASK_DROPPED;
1327 if (!protobuf::frameworkHasCapability(
1328 framework, FrameworkInfo::Capability::PARTITION_AWARE)) {
1329 newTaskState = TASK_LOST;
1330 }
1331
1332 foreach (const Offer::Operation& operation, operations) {
1333 if (operation.type() != Offer::Operation::LAUNCH) {
1334 continue;
1335 }
1336
1337 foreach (const TaskInfo& task, operation.launch().task_infos()) {
1338 StatusUpdate update = protobuf::createStatusUpdate(
1339 framework.id(),
1340 None(),
1341 task.task_id(),
1342 newTaskState,
1343 TaskStatus::SOURCE_MASTER,
1344 None(),
1345 "Master disconnected",
1346 TaskStatus::REASON_MASTER_DISCONNECTED);
1347
1348 statusUpdate(UPID(), update, UPID());
1349 }
1350 }
1351 return;
1352 }
1353
1354 Call call;
1355 CHECK(framework.has_id());
1356 call.mutable_framework_id()->CopyFrom(framework.id());
1357 call.set_type(Call::ACCEPT);
1358
1359 Call::Accept* accept = call.mutable_accept();
1360
1361 // Setting accept.operations.
1362 foreach (const Offer::Operation& _operation, operations) {
1363 if (_operation.has_id()) {
1364 ABORT("An offer operation's 'id' field was set, which is disallowed"
1365 " because the SchedulerDriver cannot handle offer operation"
1366 " status updates");
1367 }
1368
1369 Offer::Operation* operation = accept->add_operations();

Callers

nothing calls this directly

Calls 5

frameworkHasCapabilityFunction · 0.85
CopyFromMethod · 0.80
sendFunction · 0.50
idMethod · 0.45
pidMethod · 0.45

Tested by

no test coverage detected