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

Method recoverFramework

src/slave/slave.cpp:8469–8538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8467
8468
8469void Slave::recoverFramework(
8470 const FrameworkState& state,
8471 const hashset<ExecutorID>& executorsToRecheckpoint,
8472 const hashmap<ExecutorID, hashset<TaskID>>& tasksToRecheckpoint)
8473{
8474 LOG(INFO) << "Recovering framework " << state.id;
8475
8476 if (state.executors.empty()) {
8477 // GC the framework work directory.
8478 garbageCollect(
8479 paths::getFrameworkPath(flags.work_dir, info.id(), state.id));
8480
8481 // GC the framework meta directory.
8482 garbageCollect(
8483 paths::getFrameworkPath(metaDir, info.id(), state.id));
8484
8485 return;
8486 }
8487
8488 CHECK(!frameworks.contains(state.id));
8489
8490 CHECK_SOME(state.info);
8491 FrameworkInfo frameworkInfo = state.info.get();
8492
8493 // Mesos 0.22 and earlier didn't write the FrameworkID into the FrameworkInfo.
8494 // In this case, we we update FrameworkInfo.framework_id from directory name,
8495 // and rewrite the new format when we are done.
8496 bool recheckpoint = false;
8497 if (!frameworkInfo.has_id()) {
8498 frameworkInfo.mutable_id()->CopyFrom(state.id);
8499 recheckpoint = true;
8500 }
8501
8502 CHECK(frameworkInfo.has_id());
8503 CHECK(frameworkInfo.checkpoint());
8504
8505 // In 0.24.0, HTTP schedulers are supported and these do not
8506 // have a 'pid'. In this case, the slave will checkpoint UPID().
8507 CHECK_SOME(state.pid);
8508
8509 Option<UPID> pid = state.pid.get();
8510
8511 if (pid.get() == UPID()) {
8512 pid = None();
8513 }
8514
8515 Framework* framework = new Framework(
8516 this, flags, frameworkInfo, pid);
8517
8518 frameworks[framework->id()] = framework;
8519
8520 if (recheckpoint) {
8521 framework->checkpointFramework();
8522 }
8523
8524 // Now recover the executors for this framework.
8525 foreachvalue (const ExecutorState& executorState, state.executors) {
8526 framework->recoverExecutor(

Callers

nothing calls this directly

Calls 10

getFrameworkPathFunction · 0.85
NoneClass · 0.85
CopyFromMethod · 0.80
checkpointMethod · 0.80
checkpointFrameworkMethod · 0.80
UPIDClass · 0.50
emptyMethod · 0.45
idMethod · 0.45
containsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected