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

Method recoverResources

src/master/framework.cpp:208–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206
207
208void Framework::recoverResources(Task* task)
209{
210 CHECK(tasks.contains(task->task_id()))
211 << "Unknown task " << task->task_id()
212 << " of framework " << task->framework_id();
213
214 totalUsedResources -= task->resources();
215 usedResources[task->slave_id()] -= task->resources();
216 if (usedResources[task->slave_id()].empty()) {
217 usedResources.erase(task->slave_id());
218 }
219
220 // If we are no longer subscribed to the role to which these resources are
221 // being returned to, and we have no more resources allocated to us for that
222 // role, stop tracking the framework under the role.
223 CHECK(!task->resources().empty());
224 const std::string& role =
225 task->resources().begin()->allocation_info().role();
226
227 auto allocatedToRole = [&role](const Resource& resource) {
228 return resource.allocation_info().role() == role;
229 };
230
231 if (roles.count(role) == 0 &&
232 totalUsedResources.filter(allocatedToRole).empty()) {
233 CHECK(totalOfferedResources.filter(allocatedToRole).empty());
234 untrackUnderRole(role);
235 }
236}
237
238
239void Framework::addCompletedTask(Task&& task)

Callers

nothing calls this directly

Calls 11

isSpeculativeOperationFunction · 0.85
getConsumedResourcesFunction · 0.85
infoMethod · 0.80
containsMethod · 0.45
resourcesMethod · 0.45
emptyMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
countMethod · 0.45
filterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected