MCPcopy Create free account
hub / github.com/catboost/catboost / ExecTasks

Method ExecTasks

catboost/libs/helpers/resource_constrained_executor.cpp:49–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 void TResourceConstrainedExecutor::ExecTasks() {
50 while (!Queue.empty()) {
51 TVector<std::function<void()>> tasks;
52
53 TResourceUnit freeResource = ResourceQuota;
54
55 while (true) {
56 auto it = Queue.lower_bound(freeResource);
57 if (it == Queue.end()) {
58 break;
59 }
60
61 freeResource -= it->first;
62 tasks.push_back(std::move(it->second));
63 Queue.erase(it);
64 };
65
66 if (LenientMode && tasks.empty()) {
67 // execute at least one task even if it requests more than ResourceQuota
68 auto it = Queue.begin();
69 tasks.push_back(std::move(it->second));
70 Queue.erase(it);
71 } else {
72 Y_ASSERT(!tasks.empty());
73 }
74
75 ExecuteTasksInParallel(&tasks, &LocalExecutor);
76 }
77 }
78}

Callers 5

Y_UNIT_TESTFunction · 0.80
GetSubsetImplMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80

Calls 7

moveFunction · 0.50
emptyMethod · 0.45
lower_boundMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected