You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "vatsrahul1001 (via GitHub)" <gi...@apache.org> on 2025/02/08 05:26:19 UTC

[I] Dynamic task map DAGRUN marked as failed [airflow]

vatsrahul1001 opened a new issue, #46580:
URL: https://github.com/apache/airflow/issues/46580

   ### Apache Airflow version
   
   3.0.0a1
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   DAGRUN is failing with Dynamic Mapped task in the `upstream_failed` state even though upstream task is in success state
   
   **Error in schedule logs**
   
   ```
   [2025-02-08T05:18:20.469+0000] {scheduler_job_runner.py:744} INFO - Received executor event with state queued for task instance TaskInstanceKey(dag_id='context_ref', task_id='a_list', run_id='manual__2025-02-08T05:18:19.465557+00:00', try_number=1, map_index=-1)
   [2025-02-08T05:18:20.479+0000] {scheduler_job_runner.py:776} INFO - Setting external_id for <TaskInstance: context_ref.a_list manual__2025-02-08T05:18:19.465557+00:00 [queued]> to e229edfa-f569-4e19-af4e-32f9a4c5b303
   [2025-02-08T05:18:22.141+0000] {taskmap.py:148} ERROR - Cannot expand '\x1b[1m<Mapped(_PythonDecoratedOperator): ref_context>\x1b[22m' for run manual__2025-02-08T05:18:19.465557+00:00; missing upstream values: ['num']
   [2025-02-08T05:18:22.165+0000] {scheduler_job_runner.py:744} INFO - Received executor event with state success for task instance TaskInstanceKey(dag_id='context_ref', task_id='a_list', run_id='manual__2025-02-08T05:18:19.465557+00:00', try_number=1, map_index=-1)
   ```
   
   ### What you think should happen instead?
   
   Dynamic mapped task DAG should execute fine as it used to be in AF2
   
   ### How to reproduce
   
   Execute below DAG in with `3.0.0a2`
   
   **DAG**
   ```
   
   from airflow import DAG
   from airflow.decorators import task
   from datetime import datetime
   
   
   @task
   def a_list():
       return [3, 6, 9]
   
   
   @task
   def ref_context(num, **context):
       return num + context["ti"].map_index * 5
   
   
   @task
   def assert_sum(nums, expect):
       print(nums)
       print(f"expecting sum: {' + '.join(map(str,nums))} == {expect}")
       print(sum(nums))
       assert sum(nums) == expect
   
   
   with DAG(
       dag_id="context_ref",
       start_date=datetime(1970, 1, 1),
       schedule=None,
       tags=["taskmap"]
   ) as dag:
       assert_sum(ref_context.expand(num=a_list()), 33)
   ```
   
   ### Operating System
   
   Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### 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](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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task mapping- Expand not working when provided value from a task [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham closed issue #46580: Dynamic task mapping- Expand not working when provided value from a task
URL: https://github.com/apache/airflow/issues/46580


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task mapping- Expand not working when provided value from a task [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on issue #46580:
URL: https://github.com/apache/airflow/issues/46580#issuecomment-2692150681

   Reopening as issue still persists in `main` - I'm using the first DAG provided in #47141,
   and it raises the following error:
   `airflow.sdk.definitions._internal.expandinput.NotFullyPopulated: Failed to populate all mapping metadata; missing: 'num'`


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task mapping- Expand not working when provided value from a task [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on issue #46580:
URL: https://github.com/apache/airflow/issues/46580#issuecomment-2692266926

   Hello @shahar1! Thanks for testing, i just tested it again with the same DAG and i see the DAG passing with no errors.
   
   ![Image](https://github.com/user-attachments/assets/ffd8aa57-71a4-46b6-8bcc-4aecd1d53531)
   
   Could you check if your `main` has the fix [Fix Task Mapping with XCOM arguments from other Tasks #47141](https://github.com/apache/airflow/pull/47141)?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task mapping- Expand not working when provided value from a task [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on issue #46580:
URL: https://github.com/apache/airflow/issues/46580#issuecomment-2692270870

   Probably wasn't rebased :)
   Closing again


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task mapping- Expand not working when provided value from a task [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on issue #46580:
URL: https://github.com/apache/airflow/issues/46580#issuecomment-2687491145

   @uranusjr thank you for your input, its helpful :D


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task mapping- Expand not working when provided value from a task [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 closed issue #46580: Dynamic task mapping- Expand not working when provided value from a task
URL: https://github.com/apache/airflow/issues/46580


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task map DAGRUN marked as failed [airflow]

Posted by "vatsrahul1001 (via GitHub)" <gi...@apache.org>.
vatsrahul1001 commented on issue #46580:
URL: https://github.com/apache/airflow/issues/46580#issuecomment-2644539300

   Looks like `expand` is not working when list is provided from task
   **Not working**
   `assert_sum(ref_context.expand(num=a_list()), 33)`
   
   **working**
   `assert_sum(ref_context.expand(num=[3, 6, 9]), 33)`


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic task mapping- Expand not working when provided value from a task [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on issue #46580:
URL: https://github.com/apache/airflow/issues/46580#issuecomment-2687010299

   When Airflow pushes an XCom for task expansion, the worker that creates the upstream XCom calculates how long the list is (in this case `[3, 6, 9]` so it’s 3), and write that number into a separate table TaskMap
   
   This allows the scheduler to simply reads that table when it needs to expand the task into TIs. The scheduler cannot read the XCom directly because it may contain huge data and cripple the process (also deserialisation can be unsafe depending on the XCom backend).
   
   I’m guessing maybe something along this pipeline is not working correctly, and Airflow is complaining about the TaskMap record is missing.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org