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

Function validateTaskGroupAndExecutorResources

src/master/validation.cpp:1853–1888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1851
1852
1853Option<Error> validateTaskGroupAndExecutorResources(
1854 const TaskGroupInfo& taskGroup,
1855 const ExecutorInfo& executor)
1856{
1857 Resources total = executor.resources();
1858
1859 vector<Resources> taskResources;
1860 foreach (const TaskInfo& task, taskGroup.tasks()) {
1861 taskResources.push_back(task.resources());
1862 total += task.resources();
1863 }
1864
1865 Option<Error> error = resource::validateUniquePersistenceID(total);
1866 if (error.isSome()) {
1867 return Error("Task group and executor use duplicate persistence ID: " +
1868 error->message);
1869 }
1870
1871 error = resource::validateRevocableAndNonRevocableResources(total);
1872 if (error.isSome()) {
1873 return Error("Task group and executor mix revocable and non-revocable"
1874 " resources: " + error->message);
1875 }
1876
1877 vector<Resources> allResources(taskResources);
1878 allResources.push_back(executor.resources());
1879
1880 if (resource::detectOverlappingSetAndRangeResources(allResources)) {
1881 return Error("There are overlapping resources in the task group's task"
1882 " resources " + stringify(taskResources) +
1883 " and/or executor resources " +
1884 stringify(executor.resources()));
1885 }
1886
1887 return None();
1888}
1889
1890
1891Option<Error> validateExecutor(

Callers 2

TEST_FFunction · 0.85
validateExecutorFunction · 0.85

Calls 8

NoneClass · 0.85
ErrorFunction · 0.50
stringifyFunction · 0.50
resourcesMethod · 0.45
isSomeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68