我正在使用 AWS Batch。我的目标是通过适用于 C++ 的 AWS 开发工具包创建多节点并行作业。为此,我按照此处的说明创建了一个工作定义。
我正在使用 AWS C++ SDK,我注意到当我尝试覆盖环境变量或命令时,实际上没有任何内容传输到作业中。
有趣的是,对于使用普通作业定义(与多节点作业相反)的作业,相同的代码工作得非常好:
#include <aws/batch/BatchClient.h>
#include <aws/batch/model/ContainerOverrides.h>
#include <aws/batch/model/KeyValuePair.h>
#include <aws/batch/model/SubmitJobRequest.h>
#include <aws/core/Aws.h>
#include <aws/core/utils/Outcome.h>
int main(void)
{
Aws::SDKOptions options;
Aws::InitAPI(options);
Aws::Batch::BatchClient batchClient;
Aws::Batch::Model::SubmitJobRequest submitJobRequest;
Aws::Batch::Model::SubmitJobOutcome submitJobOutcome;
Aws::Batch::Model::ContainerOverrides containerOverrides;
Aws::Batch::Model::KeyValuePair envVariable;
envVariable.SetName("foo");
envVariable.SetValue("bar");
containerOverrides.AddEnvironment(envVariable); // This does nothing for a multi-node job definition.
containerOverrides.AddCommand("foobarbaz"); // This does nothing for a multi-node job definition.
submitJobRequest.SetJobName("myjob");
submitJobRequest.SetJobDefinition("arn:aws:...."); // This string is an example. I have used the actual job definition ARN.
submitJobRequest.SetJobQueue("arn:aws:...."); // This string is an exmaple. I have used the actual queue ARN.
submitJobRequest.SetContainerOverrides(containerOverrides);
submitJobOutcome = batchClient.SubmitJob(submitJobRequest);
Aws::ShutdownAPI(options);
return 0;
}
我应该为多节点并行作业使用不同的 API 吗?