EcsRegisterTaskDefinitionOperator params are incorrectly invalidated
Apache Airflow Provider(s)
amazon
Versions of Apache Airflow Providers
https://raw.githubusercontent.com/apache/airflow/constraints-2.4.3/constraints-3.10.txt
Apache Airflow version
2.4.3
Operating System
https://github.com/aws/aws-mwaa-local-runner / on macos 12.6
Deployment
Docker-Compose
Deployment details
What happened
ECS task definition cpu and memory params are incorrectly invalidated
What you think should happen instead
parameters are correct, it should register a task. I can run the same bit of code using boto3.client.ecs.register_task_definition`
How to reproduce
Try and define a task using:
EcsRegisterTaskDefinitionOperator(
task_id="register_task",
family=TASK_FAMILY_NAME,
container_definitions=[
{
"name": CONTAINER_NAME,
"image": "ubuntu",
"workingDirectory": "/usr/bin",
"entryPoint": ["sh", "-c"],
"command": ["ls"],
}
],
register_task_kwargs={
"requiresCompatibilities": ["FARGATE"],
"cpu": "256",
"memory": "512",
"networkMode": "awsvpc",
},
)
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter cpu, value: 256, type: <class 'int'>, valid types: <class 'str'>
Invalid type for parameter memory, value: 512, type: <class 'int'>, valid types: <class 'str'>
Could this error have something to do with JSON serialising/deserialising where the parameters are autodetected as ints, rather than deserialised into strings
Anything else
No response
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Thanks for opening your first issue here! Be sure to follow the issue template!
Not a bug Airflow provider, the validation happen inside botocore / boto3, see available options and types in ECS.Client.register_task_definition
Nevermind, I have a look on wrong parameters initially.
Did you use specific values such as render_template_as_native_obj=True in DAG?
Ah! yes. I did. Why is that clashing?
register_task_kwargs it is templated field which evaluate thought jinja and I with this settings NativeEnvironment transform "512" to 512 even if it not not contain jinja blocks
This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.
This issue has been closed because it has not received response from the issue author.