Small bug fixes
This commit is contained in:
@@ -118,6 +118,8 @@ int main(int argc, char **argv)
|
||||
.implicit_value(true);
|
||||
args.add_argument("-d", "--daemon").default_value(false).implicit_value(true);
|
||||
args.add_argument("--config").default_value(std::string{});
|
||||
args.add_argument("--ip").default_value(std::string{"127.0.0.1"});
|
||||
args.add_argument("--port").default_value(int{2504});
|
||||
|
||||
try {
|
||||
args.parse_args(argc, argv);
|
||||
@@ -135,8 +137,8 @@ int main(int argc, char **argv)
|
||||
bool verbose = args.get<bool>("--verbose");
|
||||
bool asDaemon = args.get<bool>("--daemon");
|
||||
auto configFile = args.get<std::string>("--config");
|
||||
std::string listenIP = "127.0.0.1";
|
||||
int listenPort = 2504;
|
||||
std::string listenIP = args.get<std::string>("--ip");
|
||||
int listenPort = args.get<int>("--port");
|
||||
size_t webThreads = 50;
|
||||
ssize_t maxCores = std::max(1U, std::thread::hardware_concurrency() - 2);
|
||||
ssize_t maxMemoryMB =
|
||||
|
||||
@@ -196,13 +196,14 @@ namespace daggy::daggyr {
|
||||
curCapacity_.cores += it->second.resourcesUsed.cores;
|
||||
curCapacity_.memoryMB += it->second.resourcesUsed.memoryMB;
|
||||
}
|
||||
pending_.extract(it);
|
||||
std::cout << "Resolved " << it->first.first << " / "
|
||||
<< it->first.second << std::endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
payload = R"({ "state": "RUNNING" })";
|
||||
found = true;
|
||||
else {
|
||||
payload = R"({ "state": "RUNNING" })";
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,9 +146,8 @@ std::future<AttemptRecord> DaggyRunnerTaskExecutor::execute(
|
||||
auto curCap = capacityFromJSON(doc["current"]);
|
||||
auto totCap = capacityFromJSON(doc["total"]);
|
||||
|
||||
ssize_t cores = curCap.cores < 0 ? totCap.cores : curCap.cores;
|
||||
ssize_t memoryMB =
|
||||
curCap.memoryMB < 0 ? totCap.memoryMB : curCap.memoryMB;
|
||||
double cores = curCap.cores < 0 ? totCap.cores : curCap.cores;
|
||||
double memoryMB = curCap.memoryMB < 0 ? totCap.memoryMB : curCap.memoryMB;
|
||||
|
||||
double impact =
|
||||
std::max(taskUsed.cores / cores, taskUsed.memoryMB / memoryMB);
|
||||
@@ -170,6 +169,7 @@ std::future<AttemptRecord> DaggyRunnerTaskExecutor::execute(
|
||||
|
||||
auto cit = impacts.begin();
|
||||
for (auto it = impacts.begin(); it != impacts.end(); ++it) {
|
||||
std::cout << it->first << " impact is " << it->second << std::endl;
|
||||
if (it->second < cit->second)
|
||||
cit = it;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user