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

Fix race condition with dagrun callbacks #16741

Merged
merged 3 commits into from
Jul 29, 2021

Conversation

jedcunningham
Copy link
Member

Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.

@boring-cyborg boring-cyborg bot added the area:Scheduler including HA (high availability) scheduler label Jun 30, 2021
@jedcunningham jedcunningham requested review from ashb and kaxil July 1, 2021 00:04
@kaxil kaxil added this to the Airflow 2.1.2 milestone Jul 2, 2021
@jedcunningham jedcunningham marked this pull request as ready for review July 2, 2021 16:04
@jedcunningham jedcunningham requested a review from XD-DENG as a code owner July 2, 2021 16:04
@jedcunningham
Copy link
Member Author

(still needs more test coverage I think, but would like to get a preliminary review before I spend more time on it)

@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 Jul 11, 2021
Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

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

The approach looks sensible to me, worth adding a single test to make sure the end_date is set

Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

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

LGTM, just one trivial nitpick ❤️

airflow/jobs/scheduler_job.py Outdated Show resolved Hide resolved
@jedcunningham jedcunningham force-pushed the dagrun_callback branch 2 times, most recently from 80d78eb to 6fb17d8 Compare July 26, 2021 17:45
@jedcunningham jedcunningham requested review from kaxil and uranusjr July 26, 2021 17:46
Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.
@jedcunningham jedcunningham reopened this Jul 29, 2021
@jedcunningham jedcunningham merged commit fb3031a into apache:main Jul 29, 2021
@jedcunningham jedcunningham deleted the dagrun_callback branch July 29, 2021 17:05
@jedcunningham
Copy link
Member Author

Merged, failures are flacky tests.

jhtimmins pushed a commit that referenced this pull request Aug 11, 2021
Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.

(cherry picked from commit fb3031a)
kaxil pushed a commit that referenced this pull request Aug 13, 2021
Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.

(cherry picked from commit fb3031a)
kaxil pushed a commit that referenced this pull request Aug 13, 2021
Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.

(cherry picked from commit fb3031a)
kaxil pushed a commit that referenced this pull request Aug 14, 2021
Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.

(cherry picked from commit fb3031a)
kaxil pushed a commit that referenced this pull request Aug 17, 2021
Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.

(cherry picked from commit fb3031a)
jhtimmins pushed a commit that referenced this pull request Aug 17, 2021
Instead of immediately sending callbacks to be processed, wait until
after we commit so the dagrun.end_date is guaranteed to be there when
the callback runs.

(cherry picked from commit fb3031a)
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.

4 participants