Skip to content

feat: adding new feature to mark task group as success or failed - #58102

Closed
itayweb wants to merge 11 commits into
apache:mainfrom
itayweb:mark_as_task_group
Closed

feat: adding new feature to mark task group as success or failed#58102
itayweb wants to merge 11 commits into
apache:mainfrom
itayweb:mark_as_task_group

Conversation

@itayweb

@itaywebitayweb commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

closes: #56103
related: #50443


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

imageimage

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

Copy link
Copy Markdown

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-cyborgboring-cyborgBot 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
Copy Markdown
Member

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

@jason810496jason810496 left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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?

@pierrejeambrunpierrejeambrun left a comment

Copy link
Copy Markdown
Member

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 🎉

Comment threadairflow-core/src/airflow/api_fastapi/core_api/services/public/common.py Outdated
Comment threadairflow-core/src/airflow/api_fastapi/core_api/services/public/common.py Outdated
@itayweb

Copy link
Copy Markdown
ContributorAuthor

I assume this is some uups in rebase :-D

Yes 😅

@pierrejeambrunpierrejeambrun left a comment

Copy link
Copy Markdown
Member

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
itaywebforce-pushed the mark_as_task_group branch 2 times, most recently from 10b0b1a to ce03f38CompareDecember 26, 2025 11:42
@pierrejeambrun

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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

Copy link
Copy Markdown
ContributorAuthor

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 😄

@pierrejeambrunpierrejeambrun left a comment

Copy link
Copy Markdown
Member

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(

@pierrejeambrunpierrejeambrunJan 30, 2026

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

#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

guan404ming commented Jan 31, 2026

Copy link
Copy Markdown
Member

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!

@pierrejeambrun

Copy link
Copy Markdown
Member

@itayweb I don't think it's worth continuing the effort at this point.

I'll close this PR in favor of #60161, feel free to re-open if you still want to work on it but it's unlikely it will get merged.

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

Labels

area:APIAirflow's REST/HTTP APIarea:serializationarea:UIRelated 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

@itayweb@guan404ming@potiuk@jscheffl@pierrejeambrun@uranusjr@jason810496