Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Nov 28, 2021

It used to be that the backfill job deadlocked when a task had
"depends_on_past" set. This was because it depended on past,
non-existing and not succesful task.

You needed to set `ignore_first_depends_on_past' set in order to
avoid the deadlock. This test was quarantined but I think
the behaviour has changed.

It looks like currently Airflow behaves differently: when checking
dependencies, it actually retrieves the previous dag-run and
if there is none available it does not deadlock no matter if
depends_on_past is set. That makes much more sense and likely
was fixed during the recent changes involved in timetable
implementation.

This PR updates the tests to show that backfill will behave
properly, regardless from ignore_first_depends_on_past.

Fixes: #14755


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

It used to be that the backfill job deadlocked when a task had
"depends_on_past" set. This was because it depended on past,
non-existing and not succesful task.

You needed to set `ignore_first_depends_on_past' set in order to
avoid the deadlock. This test was quarantined but I think
the behaviour has changed.

It looks like currently Airflow behaves differently: when checking
dependencies, it actually retrieves the previous dag-run and
if there is none available it does not deadlock no matter if
depends_on_past is set. That makes much more sense and likely
was fixed during the recent changes involved in timetable
implementation.

This PR updates the tests to show that backfill will behave
properly, regardless from `ignore_first_depends_on_past`.

Fixes: apache#14755
@boring-cyborg boring-cyborg bot added the area:Scheduler including HA (high availability) scheduler label Nov 28, 2021
@potiuk potiuk requested review from ephraimbuddy, jmcarp, kaxil, milton0825 and uranusjr and removed request for ephraimbuddy November 28, 2021 14:29
@potiuk
Copy link
Member Author

potiuk commented Nov 28, 2021

I am not 100% - but from what I debugged, the behaviour of backfill in case depends_on_past==Truw in a task have been fixed in the meantime (likely during timeteable implementation):

From what I see the backfil job will not deadlock any more but it will just work even if "ignore_first_depends_on_past" is set to true, simply because in prev_dagrun_dep, the prev_dagrun_dep is None (as it should be IMHO):

in

No matter if catchup is True or false, previous DagRun is None (as I think it should be for backfill job).


        if catchup:
            last_dagrun = dr.get_previous_scheduled_dagrun(session)
        else:
            last_dagrun = dr.get_previous_dagrun(session=session)

However I'd love to hear other's comment if understand it right. I am not sure if there is other case where we actually still need ignore_first_depends_on_past in this case or should we depreacate it ?

@potiuk potiuk requested a review from ashb November 29, 2021 11:33
@potiuk potiuk force-pushed the remove-test-backfill-depends-on-past branch from 8630adb to cfeaff6 Compare November 29, 2021 21:50
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Nov 30, 2021
@potiuk potiuk merged commit a804666 into apache:main Nov 30, 2021
@potiuk potiuk deleted the remove-test-backfill-depends-on-past branch November 30, 2021 12:59
dillonjohnson pushed a commit to dillonjohnson/airflow that referenced this pull request Dec 1, 2021
* Clarify behaviour of test_backfill_depends_on_past

It used to be that the backfill job deadlocked when a task had
"depends_on_past" set. This was because it depended on past,
non-existing and not succesful task.

You needed to set `ignore_first_depends_on_past' set in order to
avoid the deadlock. This test was quarantined but I think
the behaviour has changed.

It looks like currently Airflow behaves differently: when checking
dependencies, it actually retrieves the previous dag-run and
if there is none available it does not deadlock no matter if
depends_on_past is set. That makes much more sense and likely
was fixed during the recent changes involved in timetable
implementation.

This PR updates the tests to show that backfill will behave
properly, regardless from `ignore_first_depends_on_past`.

Fixes: apache#14755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QUARANTINE] Backfill depends on past test is flaky

2 participants