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 external_executor_id being overwritten #37784

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

ferruzzi
Copy link
Contributor

@ferruzzi ferruzzi commented Feb 29, 2024

Currently, if you watch the taskinstance db table when you run a dag, you will notice that there is an external_executor_id value assigned when the TaskInstance state is QUEUED, but it gets overwritten with None when the TaskInstance state hits RUNNING. This change will only overwrite that field if another is provided.

Added some asserts to an existing unit test and added some new tests to verify behavior and prevent regression.

@jedcunningham - this is the bug you helped me repro

NOTE: This PR is blocking #37786 and must be merged first.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Hmmm. I am not sure, but isn't that actually overwritten potentially when there is a task adoption by another executor in another scheduler? I think this is the purpose of overriding it when the task is running. To cover the case where one executor got the task queued, but then it failed before the executor managed to change it to running and then another executor - in the other scheduler instance adopted it and actually managed to change state to running.

At least that would be my guess here. Are we sure that it's ok to leave the executor id "as is" in this case?

@potiuk
Copy link
Member

potiuk commented Mar 1, 2024

I might be wrong of course, but that sounds like a case where overriding it would make sense (but it's more of "I am not sure" that "I know").

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Ah sorry. No - should be fine (stupid me) I missed the None override only.

@ferruzzi ferruzzi merged commit 0232ad0 into apache:main Mar 4, 2024
59 checks passed
@ferruzzi ferruzzi deleted the ferruzzi/external-executor-id-fix branch March 4, 2024 18:20
abhishekbhakat pushed a commit to abhishekbhakat/my_airflow that referenced this pull request Mar 5, 2024
@utkarsharma2 utkarsharma2 added this to the Airflow 2.8.3 milestone Mar 6, 2024
@utkarsharma2 utkarsharma2 added the type:bug-fix Changelog: Bug Fixes label Mar 6, 2024
ephraimbuddy pushed a commit that referenced this pull request Mar 6, 2024
ephraimbuddy pushed a commit that referenced this pull request Mar 6, 2024
ephraimbuddy pushed a commit that referenced this pull request Mar 6, 2024
@cbonilla20
Copy link

Hi, I'm not sure if this fix applies to the Kubernetes Pod Operator one, after setting it as a deferrable = True
Someone could gently confirm or not that?
Thx, great work in advance.

utkarsharma2 pushed a commit to astronomer/airflow that referenced this pull request Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants