diff --git a/CMakeLists.txt b/CMakeLists.txt index 78b1df3..987b0a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.2) project(recodex-broker) -set(RECODEX_VERSION "0.2.0") +set(RECODEX_VERSION "1.0.0") set(EXEC_NAME ${PROJECT_NAME}) enable_testing() diff --git a/src/handlers/broker_handler.cpp b/src/handlers/broker_handler.cpp index 4237642..7a0b6a4 100644 --- a/src/handlers/broker_handler.cpp +++ b/src/handlers/broker_handler.cpp @@ -251,7 +251,8 @@ void broker_handler::process_worker_done( auto failed_request = worker->cancel_request(); if (!failed_request->data.is_complete()) { - status_notifier.rejected_job(failed_request->data.get_job_id(), "Job failed with '" + message.at(3) + "' and cannot be reassigned"); + status_notifier.rejected_job( + failed_request->data.get_job_id(), "Job failed with '" + message.at(3) + "' and cannot be reassigned"); } else if (check_failure_count(failed_request, status_notifier)) { reassign_request(failed_request, respond); } else { @@ -335,7 +336,8 @@ void broker_handler::process_timer(const message_container &message, handler_int for (auto request : *requests) { if (!request->data.is_complete()) { - status_notifier.rejected_job(request->data.get_job_id(), "Worker timed out and its job cannot be reassigned"); + status_notifier.rejected_job( + request->data.get_job_id(), "Worker timed out and its job cannot be reassigned"); continue; } diff --git a/src/worker.h b/src/worker.h index a01aed7..38e65e7 100644 --- a/src/worker.h +++ b/src/worker.h @@ -39,7 +39,6 @@ class job_request_data /** * A constructor for incomplete jobs (only id without request frames) * @param job_id identification of job - * @param additional additional information which will be added to standard message */ job_request_data(const std::string &job_id) : job_id_(job_id), complete_(false) { diff --git a/tests/broker.cpp b/tests/broker.cpp index 7cc47c7..7beeda4 100644 --- a/tests/broker.cpp +++ b/tests/broker.cpp @@ -516,15 +516,16 @@ TEST(broker, worker_orphan_job_internal_failure) // We cannot reassign the job (we don't know its headers). Let's just report it as failed. ASSERT_THAT(messages, - ElementsAre(message_container( - broker_connect::KEY_STATUS_NOTIFIER, "", {"type", - "job-status", - "id", - request_1->data.get_job_id(), - "status", - "FAILED", - "message", - "Job failed with 'Testing failure' and cannot be reassigned"}))); + ElementsAre(message_container(broker_connect::KEY_STATUS_NOTIFIER, + "", + {"type", + "job-status", + "id", + request_1->data.get_job_id(), + "status", + "FAILED", + "message", + "Job failed with 'Testing failure' and cannot be reassigned"}))); messages.clear(); } @@ -572,8 +573,7 @@ TEST(broker, worker_expiration_dont_reassign_orphan_job) // There are two workers in the registry, one of them has an orphan job and will die auto worker_1 = std::make_shared("identity_1", "group_1", worker_headers_t{{"env", "c"}}); - auto request_1 = - std::make_shared(job_request_data("job_id")); + auto request_1 = std::make_shared(job_request_data("job_id")); auto worker_2 = std::make_shared("identity_2", "group_1", worker_headers_t{{"env", "c"}}); worker_1->liveness = 1; worker_1->enqueue_request(request_1); @@ -594,15 +594,16 @@ TEST(broker, worker_expiration_dont_reassign_orphan_job) handler.on_request(message_container(broker_connect::KEY_TIMER, "", {"1100"}), respond); ASSERT_THAT(messages, - ElementsAre(message_container( - broker_connect::KEY_STATUS_NOTIFIER, "", {"type", - "job-status", - "id", - request_1->data.get_job_id(), - "status", - "FAILED", - "message", - "Worker timed out and its job cannot be reassigned"}))); + ElementsAre(message_container(broker_connect::KEY_STATUS_NOTIFIER, + "", + {"type", + "job-status", + "id", + request_1->data.get_job_id(), + "status", + "FAILED", + "message", + "Worker timed out and its job cannot be reassigned"}))); messages.clear(); }