Adding environment interpolation for noop, forking, and slurm executors

This commit is contained in:
Ian Roddis
2021-11-13 12:09:51 -04:00
parent c0315b4f0b
commit 14d0ef4a3f
6 changed files with 119 additions and 27 deletions

View File

@@ -125,11 +125,23 @@ namespace daggy::executors::task {
{
std::vector<ConfigValues> newValues;
const auto command = std::get<Command>(job.at("command"));
for (const auto &expandedCommand :
interpolateValues(command, expansionValues)) {
auto command =
(job.count("command") == 0 ? Command{}
: std::get<Command>(job.at("command")));
auto environment = (job.count("environment") == 0
? Command{}
: std::get<Command>(job.at("environment")));
Command both(command);
std::copy(environment.begin(), environment.end(), std::back_inserter(both));
for (const auto &parts : interpolateValues(both, expansionValues)) {
ConfigValues newCommand{job};
newCommand.at("command") = expandedCommand;
newCommand["command"] =
Command(parts.begin(), parts.begin() + command.size());
newCommand["environment"] =
Command(parts.begin() + command.size(), parts.end());
newValues.emplace_back(newCommand);
}