TJaniF commented on PR #38902:
URL: https://github.com/apache/airflow/pull/38902#issuecomment-2134635772

   @rightx2 That is interesting. I just tried that and for me the map index 
values from the first run "stick", but maybe I misunderstood what you are doing 
:) 
   
   This is what I tried:
   
   ![2024-05-28_10-24-49 
(1)](https://github.com/apache/airflow/assets/90063506/1b79fa05-49a5-4c29-985e-56c07600009e)
   
   This is the DAG:
   
   ```python
   from airflow.decorators import dag, task
   
   @dag(
       start_date=None,
       schedule=None,
       catchup=False,
   )
   def mapping_test():
       @task(
           map_index_template="{{ custom_map_index }}"
       )
       def add_one(num):
           import time
           
           if num > 10:
               time.sleep(10)
           else:
               time.sleep(2)
           
           from airflow.operators.python import get_current_context
   
           context = get_current_context()
           context["custom_map_index"] = "Input x=" + str(num)
   
           return num + 1
       
       add_one.expand(num=[1, 2, 3, 4, 5, 10, 11, 12, 13])
   
   
   mapping_test()
   ```
   
   I'm using Airflow 2.9.1 (Astro Runtime 11.3.0)
   


-- 
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