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

Method connectAndActivateRecoveredFramework

src/master/master.cpp:10158–10233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10156
10157
10158void Master::connectAndActivateRecoveredFramework(
10159 Framework* framework,
10160 const Option<UPID>& pid,
10161 const Option<StreamingHttpConnection<v1::scheduler::Event>>& http,
10162 const Owned<ObjectApprovers>& objectApprovers)
10163{
10164 // Exactly one of `pid` or `http` must be provided.
10165 CHECK(pid.isSome() != http.isSome());
10166
10167 CHECK_NOTNULL(framework);
10168 CHECK(framework->recovered());
10169 CHECK(framework->offers.empty());
10170 CHECK(framework->inverseOffers.empty());
10171 CHECK(framework->pid().isNone());
10172 CHECK(framework->http().isNone());
10173
10174 // Updating `registeredTime` here is debatable: ideally,
10175 // `registeredTime` would be the time at which the framework first
10176 // registered with the master. However, we cannot determine this
10177 // because the time at which a framework first registered is not
10178 // persisted across master failover.
10179 framework->registeredTime = Clock::now();
10180 framework->reregisteredTime = Clock::now();
10181
10182 // Update the framework's connection state.
10183 if (pid.isSome()) {
10184 framework->updateConnection(pid.get(), objectApprovers);
10185 link(pid.get());
10186 } else {
10187 framework->updateConnection(http.get(), objectApprovers);
10188 http->closed()
10189 .onAny(defer(self(), &Self::exited, framework->id(), http.get()));
10190 }
10191
10192 CHECK(framework->activate())
10193 << "RECOVERED framework is expected not to be active";
10194
10195 allocator->activateFramework(framework->id());
10196
10197 // Export framework metrics if a principal is specified in `FrameworkInfo`.
10198 Option<string> principal = framework->info.has_principal()
10199 ? Option<string>(framework->info.principal())
10200 : None();
10201
10202 if (framework->pid().isSome()) {
10203 CHECK(!frameworks.principals.contains(framework->pid().get()));
10204 frameworks.principals.put(framework->pid().get(), principal);
10205 }
10206
10207 // We expect the framework metrics for this principal to be created
10208 // when the framework is recovered. This implies that the framework
10209 // principal cannot change on re-registration, which is currently
10210 // the case (MESOS-2842).
10211 if (principal.isSome()) {
10212 CHECK(metrics->frameworks.contains(principal.get()));
10213 }
10214
10215 if (pid.isSome()) {

Callers

nothing calls this directly

Calls 15

deferFunction · 0.85
NoneClass · 0.85
recoveredMethod · 0.80
updateConnectionMethod · 0.80
principalMethod · 0.80
MergeFromMethod · 0.80
sendMethod · 0.65
isSomeMethod · 0.45
emptyMethod · 0.45
isNoneMethod · 0.45
pidMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected