Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a task instance dependency for mapped dependencies #37498

Merged

Conversation

stevenschaerer
Copy link
Contributor

This closes #37091.

In particular, dynamically mapped tasks currently show as failed_upstream instead of skipped if some of the tasks that generate the mapping are skipped and the trigger rule is none_failed, all_done or similar.

This is because when trying to expand the mapped task, a failed and skipped mapped dependency behave identically and both result in a NotFullyPopulated being raised.

This PR introduces a new task instance dependency that sets a dynamically mapped task to skipped if any of the mapped dependencies are skipped (but not failed) and to upstream_failed if any of the mapped dependencies are failed. As such, an expansion of the mapped task is never attempted.

Before (from #37091):
image

After:
image

Copy link

boring-cyborg bot commented Feb 16, 2024

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@stevenschaerer stevenschaerer force-pushed the feature/mapped-task-upstream-issues branch from 4bd1303 to c2e94c2 Compare March 13, 2024 15:29
@eladkal eladkal added this to the Airflow 2.9.0 milestone Mar 13, 2024
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Mar 13, 2024
@eladkal
Copy link
Contributor

eladkal commented Mar 18, 2024

@stevenschaerer can you address the comments and rebase ?

@stevenschaerer stevenschaerer force-pushed the feature/mapped-task-upstream-issues branch 2 times, most recently from adbc13a to 325eace Compare March 25, 2024 21:07
@stevenschaerer
Copy link
Contributor Author

@uranusjr Could you please review my latest changes and responses to your comments? Thanks!

@stevenschaerer stevenschaerer force-pushed the feature/mapped-task-upstream-issues branch from a6b93e7 to dc90eb3 Compare March 28, 2024 22:16
@eladkal eladkal requested a review from uranusjr March 29, 2024 04:34
@stevenschaerer stevenschaerer force-pushed the feature/mapped-task-upstream-issues branch from dc90eb3 to ab8da53 Compare March 31, 2024 09:50
@eladkal eladkal changed the title Add a task instance dependency for mapped dependencies (#37091) Add a task instance dependency for mapped dependencies Mar 31, 2024
@stevenschaerer stevenschaerer force-pushed the feature/mapped-task-upstream-issues branch from 42a694d to 2f69980 Compare March 31, 2024 17:51
@stevenschaerer stevenschaerer force-pushed the feature/mapped-task-upstream-issues branch from 86dbbe7 to e4031b3 Compare April 2, 2024 10:28
@eladkal eladkal merged commit e2df442 into apache:main Apr 2, 2024
41 checks passed
@stevenschaerer stevenschaerer deleted the feature/mapped-task-upstream-issues branch April 2, 2024 12:55
ephraimbuddy pushed a commit that referenced this pull request Apr 2, 2024
* Add a task instance dependency for mapped dependencies (#37091)

---------

Co-authored-by: Tzu-ping Chung <[email protected]>
(cherry picked from commit e2df442)
ephraimbuddy pushed a commit that referenced this pull request Apr 2, 2024
* Add a task instance dependency for mapped dependencies (#37091)

---------

Co-authored-by: Tzu-ping Chung <[email protected]>
(cherry picked from commit e2df442)
idantepper pushed a commit to idantepper/airflow that referenced this pull request Apr 3, 2024
* Add a task instance dependency for mapped dependencies (apache#37091)

---------

Co-authored-by: Tzu-ping Chung <[email protected]>
idantepper pushed a commit to idantepper/airflow that referenced this pull request Apr 3, 2024
* Add a task instance dependency for mapped dependencies (apache#37091)

---------

Co-authored-by: Tzu-ping Chung <[email protected]>
mathiaHT pushed a commit to mathiaHT/airflow that referenced this pull request Apr 4, 2024
* Add a task instance dependency for mapped dependencies (apache#37091)

---------

Co-authored-by: Tzu-ping Chung <[email protected]>
utkarsharma2 pushed a commit to astronomer/airflow that referenced this pull request Apr 22, 2024
* Add a task instance dependency for mapped dependencies (apache#37091)

---------

Co-authored-by: Tzu-ping Chung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic task gets "upstream_failed" when with trigger_rule='none_failed' and upstream skipped.
3 participants