sweco-sedalh opened a new issue, #71586:
URL: https://github.com/apache/airflow/issues/71586

   ### 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?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to