summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-04-18 10:53:49 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-04-18 15:51:28 +0200
commitc36b157f5f65c6381864b670ea826aad705aa6a8 (patch)
treeae60e767d1dcd671988a2a3298c083146c87543b /src
parent88c792e051aea57823423bd91dfb4c439a7b52a8 (diff)
downloadjustbuild-c36b157f5f65c6381864b670ea826aad705aa6a8.tar.gz
just-mrrc: support retry options
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/just_mr/rc.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp
index c5de5ad5..8a81a686 100644
--- a/src/other_tools/just_mr/rc.cpp
+++ b/src/other_tools/just_mr/rc.cpp
@@ -385,6 +385,49 @@ namespace {
entry->String());
}
}
+ // read the defaults for the retry parameters
+ if (not clargs->retry.max_attempts) {
+ auto max_attempts = rc_config["max attempts"];
+ if (max_attempts.IsNotNull()) {
+ if (not max_attempts->IsNumber()) {
+ Logger::Log(LogLevel::Error,
+ "Configuration-file provided \"max attempts\" has "
+ "to be a number, but found {}",
+ max_attempts->ToString());
+ std::exit(kExitConfigError);
+ }
+ clargs->retry.max_attempts =
+ static_cast<unsigned int>(std::lround(max_attempts->Number()));
+ }
+ }
+ if (not clargs->retry.initial_backoff_seconds) {
+ auto initial_backoff_seconds = rc_config["initial backoff seconds"];
+ if (initial_backoff_seconds.IsNotNull()) {
+ if (not initial_backoff_seconds->IsNumber()) {
+ Logger::Log(LogLevel::Error,
+ "Configuration-file provided \"initial backoff "
+ "seconds\" has to be a number, but found {}",
+ initial_backoff_seconds->ToString());
+ std::exit(kExitConfigError);
+ }
+ clargs->retry.initial_backoff_seconds = static_cast<unsigned int>(
+ std::lround(initial_backoff_seconds->Number()));
+ }
+ }
+ if (not clargs->retry.max_backoff_seconds) {
+ auto max_backoff_seconds = rc_config["max backoff seconds"];
+ if (max_backoff_seconds.IsNotNull()) {
+ if (not max_backoff_seconds->IsNumber()) {
+ Logger::Log(LogLevel::Error,
+ "Configuration-file provided \"max backoff "
+ "seconds\" has to be a number, but found {}",
+ max_backoff_seconds->ToString());
+ std::exit(kExitConfigError);
+ }
+ clargs->retry.max_backoff_seconds = static_cast<unsigned int>(
+ std::lround(max_backoff_seconds->Number()));
+ }
+ }
// read default for local launcher
if (not clargs->common.local_launcher) {
auto launcher = rc_config["local launcher"];