Under which category would you file this issue?
Airflow Core
Apache Airflow version
3.2.0
What happened and how to reproduce it?
I have a dynamic mapped task that uses map_index_template to make it easier to distinguish tasks in the UI.
However, when the result of map_index_template is convertible to int, Airflow/Jinja2 does that, which then fails downstream in the code.
Example that triggers a failure: map_index_template="123"
Error:
TypeError: object of type 'int' has no len()
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 1279 in run
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 1695 in _render_map_index
What you think should happen instead?
The value should not be coerced into an int so that map_index_template results that look like numbers are valid.
Operating System
Debian 12 (but presumably irrelevant)
Deployment
Official Apache Airflow Helm Chart
Apache Airflow Provider(s)
No response
Versions of Apache Airflow Providers
No response
Official Helm Chart version
Not Applicable
Kubernetes Version
Not Applicable
Helm Chart configuration
No response
Docker Image customizations
No response
Anything else?
I can confirm that the value produced by the template are strings. I've also tried adding | string to the template to force it to a string, but Jinja still forces a coercion to int. Adding some non-integer extra text to the template (e.g. map_index_template="id: {{ ... }}" works, but is an annoying workaround that doesn't add any additional value.
Are you willing to submit PR?
Code of Conduct
Under which category would you file this issue?
Airflow Core
Apache Airflow version
3.2.0
What happened and how to reproduce it?
I have a dynamic mapped task that uses
map_index_templateto make it easier to distinguish tasks in the UI.However, when the result of map_index_template is convertible to int, Airflow/Jinja2 does that, which then fails downstream in the code.
Example that triggers a failure:
map_index_template="123"Error:
What you think should happen instead?
The value should not be coerced into an int so that
map_index_templateresults that look like numbers are valid.Operating System
Debian 12 (but presumably irrelevant)
Deployment
Official Apache Airflow Helm Chart
Apache Airflow Provider(s)
No response
Versions of Apache Airflow Providers
No response
Official Helm Chart version
Not Applicable
Kubernetes Version
Not Applicable
Helm Chart configuration
No response
Docker Image customizations
No response
Anything else?
I can confirm that the value produced by the template are strings. I've also tried adding
| stringto the template to force it to a string, but Jinja still forces a coercion to int. Adding some non-integer extra text to the template (e.g.map_index_template="id: {{ ... }}"works, but is an annoying workaround that doesn't add any additional value.Are you willing to submit PR?
Code of Conduct