| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <concepts> | ||
| 4 | #include <filesystem> | ||
| 5 | #include <string> | ||
| 6 | #include <string_view> | ||
| 7 | |||
| 8 | #include "task/include/task.hpp" | ||
| 9 | |||
| 10 | namespace ppc::util { | ||
| 11 | |||
| 12 | template <typename Task> | ||
| 13 | 10 | std::string ResolveTaskIdentifier(const std::string &settings_path) { | |
| 14 | if constexpr (requires { | ||
| 15 | { Task::GetTaskIdentifier() } -> std::convertible_to<std::string_view>; | ||
| 16 | }) { | ||
| 17 |
5/10✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 112 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 28 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 28 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 28 times.
|
308 | return std::string(Task::GetTaskIdentifier()); |
| 18 | } else { | ||
| 19 | 10 | const std::filesystem::path path(settings_path); | |
| 20 |
5/16✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 13 taken 10 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 10 times.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
30 | return path.has_parent_path() ? path.parent_path().filename().string() : path.stem().string(); |
| 21 | 10 | } | |
| 22 | } | ||
| 23 | |||
| 24 | 318 | inline ppc::task::TaskDescriptor MakeTaskDescriptor(std::string_view task_namespace, ppc::task::TypeOfTask task_type, | |
| 25 | const std::string &settings_path, | ||
| 26 | std::string_view settings_task_path = {}) { | ||
| 27 | 318 | const auto status = ppc::task::GetTaskStatus(task_type, settings_path, settings_task_path); | |
| 28 | const std::string_view task_type_name = ppc::task::TypeOfTaskToString(task_type); | ||
| 29 | const auto task_name = task_type == ppc::task::TypeOfTask::kUnknown | ||
| 30 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
|
318 | ? std::string(task_type_name) |
| 31 |
3/10✓ Branch 1 taken 318 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 318 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 318 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
954 | : std::string(task_type_name) + "_" + std::string(ppc::task::StatusOfTaskToString(status)); |
| 32 | return {.type = task_type, | ||
| 33 | .status = status, | ||
| 34 | 318 | .category = ppc::task::TaskCategoryFromSettingsPath(settings_task_path), | |
| 35 |
1/4✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
636 | .display_name = std::string(task_namespace) + "_" + task_name}; |
| 36 |
1/2✓ Branch 1 taken 318 times.
✗ Branch 2 not taken.
|
318 | } |
| 37 | |||
| 38 | inline bool IsMpiTaskType(ppc::task::TypeOfTask type) { | ||
| 39 | return type == ppc::task::TypeOfTask::kMPI || type == ppc::task::TypeOfTask::kALL; | ||
| 40 | } | ||
| 41 | |||
| 42 | } // namespace ppc::util | ||
| 43 |