| 206 | |
| 207 | |
| 208 | void 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 | |
| 239 | void Framework::addCompletedTask(Task&& task) |
nothing calls this directly
no test coverage detected