From 51465fc74465a0867f1e3996f63934cf4fc4a264 Mon Sep 17 00:00:00 2001 From: Dylan Brasseur Date: Fri, 27 Oct 2023 14:22:46 +0200 Subject: [PATCH] PR Suggestions --- .../ArmoniK.Api.Client/header/tasks/TasksClient.h | 4 ++-- .../source/tasks/TasksClient.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/cpp/ArmoniK.Api.Client/header/tasks/TasksClient.h b/packages/cpp/ArmoniK.Api.Client/header/tasks/TasksClient.h index 8a1775176..f9325996c 100644 --- a/packages/cpp/ArmoniK.Api.Client/header/tasks/TasksClient.h +++ b/packages/cpp/ArmoniK.Api.Client/header/tasks/TasksClient.h @@ -21,7 +21,7 @@ class TasksClient { * @param total Output for the total of session available for this request (used for pagination) * @param page Page to request, use -1 to get all pages. * @param page_size Size of the requested page, ignored if page is -1 - * @param sort How the sessions are sorted, ascending creation date by default + * @param sort How the tasks are sorted, ascending creation date by default * @return List of tasks summary * * @note If the tasks corresponding to the filters change while this call is going for page==-1, @@ -40,7 +40,7 @@ class TasksClient { * @param total Output for the total of session available for this request (used for pagination) * @param page Page to request, use -1 to get all pages. * @param page_size Size of the requested page, ignored if page is -1 - * @param sort How the sessions are sorted, ascending creation date by default + * @param sort How the tasks are sorted, ascending creation date by default * @return List of tasks summary * * @note If the tasks corresponding to the filters change while this call is going for page==-1, diff --git a/packages/cpp/ArmoniK.Api.Client/source/tasks/TasksClient.cpp b/packages/cpp/ArmoniK.Api.Client/source/tasks/TasksClient.cpp index 2bfaa3b07..9c18bb1a0 100644 --- a/packages/cpp/ArmoniK.Api.Client/source/tasks/TasksClient.cpp +++ b/packages/cpp/ArmoniK.Api.Client/source/tasks/TasksClient.cpp @@ -18,6 +18,18 @@ static inline ::grpc::Status call_stub_list(armonik::api::grpc::v1::tasks::Tasks return stub->ListTasks(&context, request, response); } +/** + * Common function called to list tasks + * @tparam T Result value type (TaskSummary or TaskDetailed + * @tparam U Response type + * @param stub Task stub + * @param filters Filter to be used + * @param total Output for the total of session available for this request (used for pagination) + * @param page Page to request, use -1 to get all pages. + * @param page_size Size of the requested page, ignored if page is -1 + * @param sort How the tasks are sorted, ascending creation date by default + * @return Vector of information about the tasks + */ template ().tasks()), class = decltype(std::declval().total())> static std::vector list_tasks_common(armonik::api::grpc::v1::tasks::Tasks::StubInterface *stub, @@ -71,6 +83,7 @@ TasksClient::list_tasks(armonik::api::grpc::v1::tasks::Filters filters, int32_t armonik::api::grpc::v1::tasks::ListTasksResponse>(stub.get(), std::move(filters), total, page, page_size, std::move(sort)); } + std::vector TasksClient::list_tasks_detailed(armonik::api::grpc::v1::tasks::Filters filters, int32_t &total, int32_t page, int32_t page_size, armonik::api::grpc::v1::tasks::ListTasksRequest::Sort sort) { @@ -78,6 +91,7 @@ TasksClient::list_tasks_detailed(armonik::api::grpc::v1::tasks::Filters filters, armonik::api::grpc::v1::tasks::ListTasksDetailedResponse>( stub.get(), std::move(filters), total, page, page_size, std::move(sort)); } + armonik::api::grpc::v1::tasks::TaskDetailed TasksClient::get_task(std::string task_id) { ::grpc::ClientContext context; armonik::api::grpc::v1::tasks::GetTaskRequest request; @@ -160,6 +174,7 @@ TasksClient::count_tasks_by_status(armonik::api::grpc::v1::tasks::Filters filter } return map_status; } + std::vector TasksClient::submit_tasks(std::string session_id, const std::vector &task_creations, const armonik::api::grpc::v1::TaskOptions &task_options) {