forked from lix-project/hydra
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.
This commit is contained in:
parent
deee99b518
commit
4d967dd17a
|
@ -253,16 +253,28 @@ int main(int argc, char * * argv)
|
||||||
EvalState state(searchPath);
|
EvalState state(searchPath);
|
||||||
|
|
||||||
AutoArgs autoArgs;
|
AutoArgs autoArgs;
|
||||||
|
Value * inputsSet = state.allocValue();
|
||||||
|
state.mkAttrs(*inputsSet, autoArgs_.size());
|
||||||
for (auto & i : autoArgs_) {
|
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) {
|
for (auto & j : i.second) {
|
||||||
Value * v = state.allocValue();
|
Value * v = state.allocValue();
|
||||||
if (j[0] == 'E')
|
if (j[0] == 'E')
|
||||||
state.eval(state.parseExprFromString(string(j, 1), absPath(".")), *v);
|
state.eval(state.parseExprFromString(string(j, 1), absPath(".")), *v);
|
||||||
else
|
else
|
||||||
mkString(*v, string(j, 1));
|
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();
|
store = openStore();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue