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