I am working with AWS Batch. My goal is to create a multi-node parallel job through the AWS SDK for C++. For this, I have created a job definition as per the instructions here.
I am working with the AWS C++ SDK, and I noticed that when I try to override either environmental variables or commands, nothing is actually transferred to the job.
Interestingly, the same code works perfectly fine for a job which uses a normal job definition (as opposed to a multi-node one):
#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;
}
Should I be using a different API for multi-node parallel jobs?