hydra-evaluator: JobsetName -> JobsetIdentity

This commit is contained in:
Graham Christensen 2021-01-25 15:18:52 -05:00
parent 705a45df2b
commit cb01859718
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F

View file

@ -13,7 +13,7 @@
using namespace nix; using namespace nix;
typedef std::pair<std::string, std::string> JobsetName; typedef std::pair<std::string, std::string> JobsetIdentity;
enum class EvaluationStyle enum class EvaluationStyle
{ {
@ -30,16 +30,16 @@ struct Evaluator
struct Jobset struct Jobset
{ {
JobsetName name; JobsetIdentity name;
std::optional<EvaluationStyle> evaluation_style; std::optional<EvaluationStyle> evaluation_style;
time_t lastCheckedTime, triggerTime; time_t lastCheckedTime, triggerTime;
int checkInterval; int checkInterval;
Pid pid; Pid pid;
}; };
typedef std::map<JobsetName, Jobset> Jobsets; typedef std::map<JobsetIdentity, Jobset> Jobsets;
std::optional<JobsetName> evalOne; std::optional<JobsetIdentity> evalOne;
const size_t maxEvals; const size_t maxEvals;
@ -76,10 +76,10 @@ struct Evaluator
auto state(state_.lock()); auto state(state_.lock());
std::set<JobsetName> seen; std::set<JobsetIdentity> seen;
for (auto const & row : res) { for (auto const & row : res) {
auto name = JobsetName{row["project"].as<std::string>(), row["name"].as<std::string>()}; auto name = JobsetIdentity{row["project"].as<std::string>(), row["name"].as<std::string>()};
if (evalOne && name != *evalOne) continue; if (evalOne && name != *evalOne) continue;
@ -466,7 +466,7 @@ int main(int argc, char * * argv)
else { else {
if (!args.empty()) { if (!args.empty()) {
if (args.size() != 2) throw UsageError("Syntax: hydra-evaluator [<project> <jobset>]"); if (args.size() != 2) throw UsageError("Syntax: hydra-evaluator [<project> <jobset>]");
evaluator.evalOne = JobsetName(args[0], args[1]); evaluator.evalOne = JobsetIdentity(args[0], args[1]);
} }
evaluator.run(); evaluator.run();
} }