I built a job definition using a docker image (on ECR) and according to the documentation and this guide the vCPU and memory parameters should be override using the containerOverrides dictionary:
"containerOverrides": { "resourceRequirements": [
{
"type": "MEMORY",
"value": "8192"
},
{
"type": "VCPU",
"value": "4"
} ], }
So this is how I built my code (python):
import boto3
client = boto3.client('batch')
resource_requirements = [
{
'value': str(cpu_count),
'type': 'VCPU'
},
{
'value': str(memory),
'type': 'MEMORY'
}
]
container_overrides = {
'command': ["python", "main.py", "example"],
'resourceRequirements': resource_requirements,
}
result = client.submit_job(
jobName=job_name,
jobQueue=job_queue,
jobDefinition=job_definition,
containerOverrides=container_overrides,
)
But still the AWS console displays the original values for cpu & memory and this error as well:
Configuration conflict This value was submitted using containerOverrides.vcpus which has been deprecated and was not used as an override. Instead, the VCPU value found in the job definition’s resourceRequirements key was used instead. More information about the deprecated key can be found in the AWS Batch API documentation.
So I tried to do the exact opposite to what the documentation says and changed my code to look like this:
import boto3
client = boto3.client('batch')
resource_requirements = [
{
'value': str(cpu_count),
'type': 'VCPU'
},
{
'value': str(memory),
'type': 'MEMORY'
}
]
container_overrides = {
'command': ["python", "main.py", "example"],
'vcpus': cpu_count,
'memory': memory
}
result = client.submit_job(
jobName=job_name,
jobQueue=job_queue,
jobDefinition=job_definition,
containerOverrides=container_overrides,
)
And now the error is not displayed and the values on the console are overridden. Can someone explain why the documentation and actual results are so different? Maybe I'm missing something?