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 new conf to wait past_deps before skipping a task #27710

Merged
merged 19 commits into from
Jan 3, 2023

Conversation

hussein-awala
Copy link
Member

@hussein-awala hussein-awala commented Nov 16, 2022

closes: #26200 and #26460

In this PR, I add a new config wait_for_past_depends_before_skipping which is False by default. When it is True, and depends_on_past is True, then when it is decided to skip a task because of trigger rules, the task will stay in None state waiting the past dependencies to be met.
In this case, we can ensure that the task instance will be scheduled only when all the past instances are finished with one of the states succeeded or skipped.

@hussein-awala hussein-awala force-pushed the skipping_dep branch 2 times, most recently from b08bde6 to e765a20 Compare November 17, 2022 09:48
@hussein-awala hussein-awala marked this pull request as ready for review November 18, 2022 16:43
@potiuk
Copy link
Member

potiuk commented Nov 27, 2022

conflicts, I am afraid.

@hussein-awala
Copy link
Member Author

@potiuk conflicts are resolved.

Comment on lines 546 to 550
ARG_WAIT_FOR_PAST_DEPENDS_BEFORE_SKIPPING = Arg(
("-W", "--wait-for-past-depends-before-skipping"),
help="Wait for past dependencies before skipping the task when --ignore-depends-on-past is not set",
action="store_true",
)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should merge this and --ignore-depends-on-past into one flag, say a --depends-on-past option that allows three possible values check (default), ignore, and wait. This can be done in a subsequent, separate PR, but we should start considering the design.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. We should simplify.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree but I was trying to add a feature safe with b/c.
I will create a new PR to implement this first proposition and we can discuss the design there.

Copy link
Member Author

Choose a reason for hiding this comment

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

@uranusjr can you please check this PR?
I just created a new option for Airflow CLI without changing the task instance deps classes arguments, if you prefer to merge the options everywhere, I can do that.

Comment on lines 229 to 230
ignore_depends_on_past=args.ignore_depends_on_past,
wait_for_past_depends_before_skipping=args.wait_for_past_depends_before_skipping,
Copy link
Member

Choose a reason for hiding this comment

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

And we can merge these two now into an enum, it both is clearer and makes more sense (since as it’s designed now it is nonsensical to set both flags).

@potiuk
Copy link
Member

potiuk commented Dec 4, 2022

Comments/responses to the comments @hussein-awala ? Still working on it?

@hussein-awala
Copy link
Member Author

Hi @potiuk, sorry I was ooo

@potiuk
Copy link
Member

potiuk commented Dec 27, 2022

I guesss this needs rebase after merging #28113

@hussein-awala hussein-awala requested review from uranusjr and removed request for ashb, kaxil, XD-DENG, dstandish and jedcunningham December 29, 2022 00:44
@hussein-awala
Copy link
Member Author

@potiuk it's ready, can you check it please?

@uranusjr
Copy link
Member

Do we still need to keep the old argument for backward compatibility?

@hussein-awala
Copy link
Member Author

Do we still need to keep the old argument for backward compatibility?

@uranusjr which old argument? we changed just the CLI arguments, do you prefer to simplify operator arguments (and/or DepContext attributes)?

@uranusjr
Copy link
Member

uranusjr commented Jan 3, 2023

Oh sorry, I was reading old code (before we merged this into --depends-on-past). This should be good now.

@potiuk potiuk merged commit 25e0e30 into apache:main Jan 3, 2023
@pierrejeambrun pierrejeambrun added this to the Airflow 2.6.0 milestone Jan 9, 2023
@pierrejeambrun pierrejeambrun added the type:new-feature Changelog: New Features label Feb 27, 2023
@gaboc623
Copy link

gaboc623 commented Apr 7, 2023

@hussein-awala @uranusjr was this included in the most recent release of Airflow or will it be included in a following version?

@hussein-awala
Copy link
Member Author

@gaboc623 since this is a new feature, it will be included in the next minor version 2.6.0 (as mentioned in the PR milestone).

@gaboc623
Copy link

gaboc623 commented Apr 7, 2023

thanks so much!

@dstandish
Copy link
Contributor

@hussein-awala can you help me understand why we need to involve xcom here? it seems like a real abuse of xcom system.

@dstandish
Copy link
Contributor

dstandish commented Oct 24, 2024

also @hussein-awala, can you clarify the behavior change here? what did it do differently before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:new-feature Changelog: New Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

depends_on_past is ignored when upstream is skipped
7 participants