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 Orphaned tasks stuck in executor as running #16550

Merged
merged 1 commit into from Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions airflow/executors/celery_executor.py
Expand Up @@ -369,9 +369,7 @@ def _check_for_stalled_adopted_tasks(self):
"\n\t".join(repr(x) for x in timedout_keys),
)
for key in timedout_keys:
self.event_buffer[key] = (State.FAILED, None)
del self.tasks[key]
del self.adopted_task_timeouts[key]
self.change_state(key, State.FAILED)

def debug_dump(self) -> None:
"""Called in response to SIGUSR2 by the scheduler"""
Expand Down
2 changes: 2 additions & 0 deletions tests/executors/test_celery_executor.py
Expand Up @@ -371,10 +371,12 @@ def test_check_for_stalled_adopted_tasks(self):
key_1: queued_dttm + executor.task_adoption_timeout,
key_2: queued_dttm + executor.task_adoption_timeout,
}
executor.running = {key_1, key_2}
executor.tasks = {key_1: AsyncResult("231"), key_2: AsyncResult("232")}
executor.sync()
assert executor.event_buffer == {key_1: (State.FAILED, None), key_2: (State.FAILED, None)}
assert executor.tasks == {}
assert executor.running == set()
assert executor.adopted_task_timeouts == {}


Expand Down