Adding environment interpolation for noop, forking, and slurm executors
This commit is contained in:
@@ -135,8 +135,7 @@ daggy::AttemptRecord ForkingTaskExecutor::runTask(const Task &task,
|
||||
close(stdoutPipe[0]);
|
||||
close(stderrPipe[0]);
|
||||
char **env = (envp.empty() ? nullptr : envp.data());
|
||||
auto res = execvpe(argv[0], argv.data(), env);
|
||||
std::cout << res << std::endl;
|
||||
execvpe(argv[0], argv.data(), env);
|
||||
exit(errno);
|
||||
}
|
||||
|
||||
@@ -217,11 +216,23 @@ std::vector<daggy::ConfigValues> ForkingTaskExecutor::expandTaskParameters(
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,12 +31,23 @@ namespace daggy::executors::task {
|
||||
const ConfigValues &job, const ConfigValues &expansionValues)
|
||||
{
|
||||
std::vector<ConfigValues> newValues;
|
||||
auto command =
|
||||
(job.count("command") == 0 ? Command{}
|
||||
: std::get<Command>(job.at("command")));
|
||||
|
||||
const auto command = std::get<Command>(job.at("command"));
|
||||
for (const auto &expandedCommand :
|
||||
interpolateValues(command, expansionValues)) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user