Moving to a poll method for workers, and daggyd-preserved capacities

This commit is contained in:
Ian Roddis
2021-12-24 10:21:19 -04:00
parent 0914ede8fb
commit 779d6adaea
7 changed files with 199 additions and 128 deletions

View File

@@ -49,7 +49,8 @@ namespace daggy {
{
Ok = 200,
Not_Found = 404,
Not_Acceptable = 406
Not_Acceptable = 406,
Server_Error = 500
};
struct HTTPResponse

View File

@@ -58,13 +58,21 @@ namespace daggy::executors::task {
std::string taskName;
std::string runnerURL;
uint32_t retries;
daggy_runner::Capacity resources;
};
// Resolves jobs through polling
std::atomic<bool> running_;
std::thread monitorWorker_;
std::unordered_set<std::string> runners_;
struct RunnerCapacity
{
daggy_runner::Capacity current;
daggy_runner::Capacity total;
};
std::mutex runnersGuard_;
std::unordered_map<std::string, RunnerCapacity> runners_;
std::mutex rtGuard_;
std::unordered_map<std::pair<DAGRunID, std::string>, RunningTask>
runningTasks_;