Skip to content

Conversation

@itayweb
Copy link

@itayweb itayweb commented Nov 9, 2025

closes: #56103
related: #50443


Adding new feature for Apache Airflow 3.x to mark TaskGroup tasks as Success/Failed, using existing bulk api

image image

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:serialization labels Nov 9, 2025
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 9, 2025

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 prek-hooks 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: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Nov 9, 2025
@itayweb itayweb marked this pull request as ready for review November 9, 2025 18:25
@guan404ming
Copy link
Member

Could you help resolve static check error and attatch some screenshot or demo for your changes? Thanks!

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

The unit tests are also required in airflow-core/tests/unit/api_fastapi/core_api/services/public/test_task_instances.py for the corresponding changes, thanks!

@itayweb
Copy link
Author

itayweb commented Nov 12, 2025

Could you help resolve static check error and attatch some screenshot or demo for your changes? Thanks!

What do you mean by static check error? Regarding the screenshots I'll add

@potiuk
Copy link
Member

potiuk commented Nov 12, 2025

What do you mean by static check error?

See the errors in the CI outputs - you need to have prek installed and fix all the issues (prek will fix them mostly automatically) - make sure also to rebase to latest main

"""Bulk update, and delete task instances."""
return BulkTaskInstanceService(
session=session, request=request, dag_id=dag_id, dag_run_id=dag_run_id, dag_bag=dag_bag, user=user
session=session, request=request, dag_id=dag_id, dag_run_id=dag_run_id, dag_bag=dag_bag, user=user, commit=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the duplicate dry run function and used the new parameter passed (commit) to reuse the existing function

@itayweb
Copy link
Author

itayweb commented Nov 22, 2025

Thanks for the PR!

The unit tests are also required in airflow-core/tests/unit/api_fastapi/core_api/services/public/test_task_instances.py for the corresponding changes, thanks!

I've took a look into the unit tests that are already exist and noticed that there is already for bulk task instances but in the routes instead of in the services, so is it suitable for this? looks good to me, also there is not for the new added dry run, should I added another for the dry run?

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool PR.

A few suggestions before we can merge 🎉

@itayweb itayweb requested a review from XD-DENG as a code owner December 6, 2025 20:31
@jscheffl
Copy link
Contributor

jscheffl commented Dec 6, 2025

I assume this is some uups in rebase :-D

@itayweb itayweb force-pushed the mark_as_task_group branch from ddf30db to 80172f6 Compare December 6, 2025 20:39
@itayweb
Copy link
Author

itayweb commented Dec 6, 2025

I assume this is some uups in rebase :-D

Yes 😅

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it some thoughts and it appears that the bulk api doesn't really fit well here.

Maybe we should instead use the "patch/update" TI endpoint and add support for TaskGroup there.

There already is a dry run endpoint for this too. And in addition it returns a TI collection already because it handles the "multiple mapped indexes" use case.

@itayweb itayweb force-pushed the mark_as_task_group branch 2 times, most recently from 10b0b1a to ce03f38 Compare December 26, 2025 11:42
@pierrejeambrun
Copy link
Member

Feel free to resolve irrelevant/addressed comments. Let us know when the PR is ready for another round of review, it looks like there are unrelated change added that need to be cleaned.

@itayweb
Copy link
Author

itayweb commented Jan 9, 2026

Feel free to resolve irrelevant/addressed comments. Let us know when the PR is ready for another round of review, it looks like there are unrelated change added that need to be cleaned.

Currently working on your last comment of using the existing patch endpoint

@itayweb itayweb force-pushed the mark_as_task_group branch from ce03f38 to c491700 Compare January 9, 2026 14:52
@itayweb itayweb requested a review from choo121600 as a code owner January 9, 2026 14:52
@itayweb
Copy link
Author

itayweb commented Jan 9, 2026

I've created a new endpoint for patching task and task group to not interfere with existing routes/tests, let me know what do you all think about my new approach 😄

@itayweb itayweb force-pushed the mark_as_task_group branch from 777b701 to 461e109 Compare January 25, 2026 19:01
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#60161 is closer to being mergeable. There is a bunch here to address and I would suggest closing it in favor of #60161, sorry for the inconvenience.

],
operation_id="post_patch_task_instances",
)
def post_patch_task_instances(
Copy link
Member

@pierrejeambrun pierrejeambrun Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some cleaning like that post_patch

application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/dry_run:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use the bulk task instance endpoint.

@itayweb
Copy link
Author

itayweb commented Jan 30, 2026

#60161 is closer to being mergeable. There is a bunch here to address and I would suggest closing it in favor of #60161, sorry for the inconvenience.

I see.. so should I fix your comments anyway or should I wait for another maintainers?

@guan404ming
Copy link
Member

guan404ming commented Jan 31, 2026

I see.. so should I fix your comments anyway or should I wait for another maintainers?

Sorry about that. I think you could take your time on finding another issue and trying to fix it. Meanwhile, you could still read the review from reviewer here and learn how to improve your next pr. Thanks for your contribution and looking forward to your next try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:serialization area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing the ability to mark all tasks in a Task Group Success/Failed in AF3

7 participants