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

set executor.job_id to BackfillJob.id for backfills #27020

Merged
merged 1 commit into from Oct 23, 2022

Conversation

RNHTTR
Copy link
Collaborator

@RNHTTR RNHTTR commented Oct 12, 2022

BackfillJob sets executor.job_id = "backfill", which results in a bug in the Celery executor's stalled_task_timeout feature. The query to select stalled tasks is as follows:

session.query(TaskInstance).filter(
    TaskInstance.filter_for_tis(keys),
    TaskInstance.state == State.QUEUED,
    TaskInstance.queued_by_job_id == self.job_id,

TaskInstance.queued_by_job_id is an int, but for backfill jobs, it is comparing against a string (i.e. "backfill"). This prevents stalled tasks from backfill jobs to remain stalled and not be retried.

Setting executor.job_id = self.id (where self.id is BaseJob's id field should resolve this issue.

@boring-cyborg boring-cyborg bot added the area:Scheduler Scheduler or dag parsing Issues label Oct 12, 2022
Copy link
Contributor

@o-nikolas o-nikolas left a comment

Choose a reason for hiding this comment

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

Nice one 👍

@potiuk potiuk added this to the Airflow 2.4.3 milestone Oct 23, 2022
@potiuk
Copy link
Member

potiuk commented Oct 23, 2022

I think that one is good for 2.4.3 - marked it so.

@potiuk potiuk merged commit 57bb54d into apache:main Oct 23, 2022
ephraimbuddy pushed a commit that referenced this pull request Nov 9, 2022
Co-authored-by: Ryan Hatter <ryan.hatter@astronomer.io>
(cherry picked from commit 57bb54d)
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Nov 9, 2022
@RNHTTR RNHTTR deleted the bugfix/backfill-job-id-stalled-tasks branch October 24, 2023 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Scheduler Scheduler or dag parsing Issues type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants