From 4d967dd17a1fd14b4f54f8e65f455463c7543a4c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 4 Aug 2015 07:54:24 -0400 Subject: [PATCH 1/3] hydra-eval-jobs: Pass all inputs as 'inputs' arg. If there is no input named 'inputs', hydra-eval-jobs now passes in a set of lists, where each attribute corresponds to an input defined in the jobset specification and each list element is a different input alt, as an argument named 'inputs'. Among other things, this allows for generic hydra expressions to be shared amongst projects with similar structures but different sets of specific inputs. --- src/hydra-eval-jobs/hydra-eval-jobs.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index 0eacecd0..4877520a 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -253,16 +253,28 @@ int main(int argc, char * * argv) EvalState state(searchPath); AutoArgs autoArgs; + Value * inputsSet = state.allocValue(); + state.mkAttrs(*inputsSet, autoArgs_.size()); for (auto & i : autoArgs_) { + Symbol inputName = state.symbols.create(i.first); + Value * inputAttr = state.allocAttr(*inputsSet, inputName); + state.mkList(*inputAttr, i.second.size()); + int altIndex = 0; for (auto & j : i.second) { Value * v = state.allocValue(); if (j[0] == 'E') state.eval(state.parseExprFromString(string(j, 1), absPath(".")), *v); else mkString(*v, string(j, 1)); - autoArgs[state.symbols.create(i.first)].push_back(v); + autoArgs[inputName].push_back(v); + inputAttr->list.elems[altIndex++] = v; } } + Symbol sInputs = state.symbols.create("inputs"); + if (autoArgs.find(sInputs) == autoArgs.end()) { + inputsSet->attrs->sort(); + autoArgs[sInputs].push_back(inputsSet); + } store = openStore(); From a5b986cf33630ac26ffd6ab7b8b432272960a6f5 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 4 Aug 2015 08:10:47 -0400 Subject: [PATCH 2/3] Only pass the first value of each input in the inputs argument Multiple alts are on their way out --- src/hydra-eval-jobs/hydra-eval-jobs.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index 4877520a..a6428d82 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -257,9 +257,7 @@ int main(int argc, char * * argv) state.mkAttrs(*inputsSet, autoArgs_.size()); for (auto & i : autoArgs_) { Symbol inputName = state.symbols.create(i.first); - Value * inputAttr = state.allocAttr(*inputsSet, inputName); - state.mkList(*inputAttr, i.second.size()); - int altIndex = 0; + bool first = true; for (auto & j : i.second) { Value * v = state.allocValue(); if (j[0] == 'E') @@ -267,7 +265,10 @@ int main(int argc, char * * argv) else mkString(*v, string(j, 1)); autoArgs[inputName].push_back(v); - inputAttr->list.elems[altIndex++] = v; + if (first) { + inputsSet->attrs->push_back(Attr(inputName, *v)); + first = false; + } } } Symbol sInputs = state.symbols.create("inputs"); From 7b7f189b3ee32b6f1e81d12bdc5049d75223b1fc Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 4 Aug 2015 08:12:24 -0400 Subject: [PATCH 3/3] Whoops, misread signature --- src/hydra-eval-jobs/hydra-eval-jobs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index a6428d82..1f2c15c9 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -266,7 +266,7 @@ int main(int argc, char * * argv) mkString(*v, string(j, 1)); autoArgs[inputName].push_back(v); if (first) { - inputsSet->attrs->push_back(Attr(inputName, *v)); + inputsSet->attrs->push_back(Attr(inputName, v)); first = false; } }