Fixing issue with logic for daggyr submission

This commit is contained in:
Ian Roddis
2022-01-10 13:09:11 -04:00
parent 53308c063d
commit 7312776e39

View File

@@ -158,8 +158,9 @@ std::future<AttemptRecord> DaggyRunnerTaskExecutor::execute(
std::lock_guard<std::mutex> lock(runnersGuard_);
for (auto &[runner, caps] : runners_) {
const auto result = HTTP_REQUEST(runner + "/ready");
if (result.code != 200)
if (result.code != 200) {
continue;
}
// Set capacities if they haven't been discovered yet
if (caps.total.cores == 0) {
@@ -206,14 +207,16 @@ std::future<AttemptRecord> DaggyRunnerTaskExecutor::execute(
const auto response = HTTP_REQUEST(url, taskToJSON(task), "POST");
if (response.code != HTTPCode::Ok) {
std::cout << response.code << " : " << response.body << std::endl;
continue;
// throw std::runtime_error("Unable to submit task: " + response.body);
}
submitted_runner = runner;
break;
}
if (!submitted_runner.empty()) {
if (submitted_runner.empty()) {
std::promise<AttemptRecord> prom;
auto fut = prom.get_future();
AttemptRecord record{.rc = -1,