diff options
| author | Dan Engelbrecht <[email protected]> | 2024-01-22 13:21:55 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-22 13:21:55 +0100 |
| commit | cccb2d71885d1211b3eb2fc9531826457846b014 (patch) | |
| tree | 9424b687d76bf937304ce14aaeef9308a31e02c2 /src/zen/cmds/projectstore_cmd.cpp | |
| parent | make sure to advance read buffer pointer in BasicFileWriter::Write (#633) (diff) | |
| download | archived-zen-cccb2d71885d1211b3eb2fc9531826457846b014.tar.xz archived-zen-cccb2d71885d1211b3eb2fc9531826457846b014.zip | |
jobqueue - allow multiple threads to report progress/messages (#635)
jobqueue - add AbortReason and properly propagate error when running async command
Diffstat (limited to 'src/zen/cmds/projectstore_cmd.cpp')
| -rw-r--r-- | src/zen/cmds/projectstore_cmd.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/zen/cmds/projectstore_cmd.cpp b/src/zen/cmds/projectstore_cmd.cpp index 5795b3190..723b45cda 100644 --- a/src/zen/cmds/projectstore_cmd.cpp +++ b/src/zen/cmds/projectstore_cmd.cpp @@ -84,7 +84,20 @@ namespace { } CbObject StatusObject = StatusResult.AsObject(); std::string_view Status = StatusObject["Status"sv].AsString(); - CbArrayView Messages = StatusObject["Messages"sv].AsArrayView(); + + if (Status == "Running") + { + std::string_view CurrentOp = StatusObject["CurrentOp"sv].AsString(); + uint32_t CurrentOpPercentComplete = StatusObject["CurrentOpPercentComplete"sv].AsUInt32(); + if (CurrentOp != LastCurrentOp || CurrentOpPercentComplete != LastCurrentOpPercentComplete) + { + LastCurrentOp = CurrentOp; + LastCurrentOpPercentComplete = CurrentOpPercentComplete; + ZEN_CONSOLE("{} {}%", CurrentOp, CurrentOpPercentComplete); + } + } + + CbArrayView Messages = StatusObject["Messages"sv].AsArrayView(); for (auto M : Messages) { std::string_view Message = M.AsString(); @@ -106,7 +119,15 @@ namespace { } if (Status == "Aborted") { - Result.ThrowError("Aborted"); + std::string_view AbortReason = StatusObject["AbortReason"].AsString(); + if (!AbortReason.empty()) + { + throw std::runtime_error(std::string(AbortReason)); + } + else + { + throw std::runtime_error("Aborted"); + } break; } if (Status == "Queued") @@ -114,17 +135,6 @@ namespace { double QueueTimeS = StatusObject["QueueTimeS"].AsDouble(); ZEN_CONSOLE("Queued, waited {:.3} s...", QueueTimeS); } - if (Status == "Running") - { - std::string_view CurrentOp = StatusObject["CurrentOp"sv].AsString(); - uint32_t CurrentOpPercentComplete = StatusObject["CurrentOpPercentComplete"sv].AsUInt32(); - if (CurrentOp != LastCurrentOp || CurrentOpPercentComplete != LastCurrentOpPercentComplete) - { - LastCurrentOp = CurrentOp; - LastCurrentOpPercentComplete = CurrentOpPercentComplete; - ZEN_CONSOLE("{} {}%", CurrentOp, CurrentOpPercentComplete); - } - } uint32_t AbortCounter = SignalCounter[SIGINT].load(); if (SignalCounter[SIGINT] > 0) { |