From 09a4c9fad25cdaad67fcf2c02351b58a7eec4f3f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 16 May 2018 14:22:00 +0200 Subject: [PATCH] hydra-evaluator: Allow setting the maximum number of concurrent evaluations --- src/hydra-evaluator/hydra-evaluator.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/hydra-evaluator/hydra-evaluator.cc b/src/hydra-evaluator/hydra-evaluator.cc index e7d619b3..86ac5c39 100644 --- a/src/hydra-evaluator/hydra-evaluator.cc +++ b/src/hydra-evaluator/hydra-evaluator.cc @@ -1,6 +1,7 @@ -#include "shared.hh" #include "db.hh" +#include "hydra-config.hh" #include "pool.hh" +#include "shared.hh" #include #include @@ -16,6 +17,8 @@ typedef std::pair JobsetName; struct Evaluator { + std::unique_ptr config; + nix::Pool dbPool; struct Jobset @@ -30,7 +33,7 @@ struct Evaluator std::experimental::optional evalOne; - size_t maxEvals = 4; + const size_t maxEvals; struct State { @@ -45,6 +48,11 @@ struct Evaluator const time_t notTriggered = std::numeric_limits::max(); + Evaluator() + : config(std::make_unique<::Config>()) + , maxEvals(std::max((size_t) 1, (size_t) config->getIntOption("max_concurrent_evals", 4))) + { } + void readJobsets() { auto conn(dbPool.get());