Skip to content

Ignore stale executor success with per-invocation workload_run_id - #73510

Closed
Pedrinhonitz wants to merge 20 commits into
apache:mainfrom
Pedrinhonitz:main
Closed

Pedrinhonitz wants to merge 20 commits into
apache:mainfrom
Pedrinhonitz:main

Conversation

@Pedrinhonitz

@Pedrinhonitz Pedrinhonitz commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the deferred-task race where a stale executor SUCCESS (from the worker that exited on defer) is applied to the resumed attempt that still shares the same TaskInstanceKey (try_number unchanged). Heuristics based on next_method + state (SCHEDULED/QUEUED/RUNNING) keep growing and still miss cases.

This PR introduces a per-invocation workload_run_id (UUID):

Generated on every scheduler enqueue and stored on TaskInstance (+ history / migration).

Carried on executor completion events (event_buffer is now (state, info, workload_run_id)).

In process_executor_events, events whose run id does not match the TI’s current workload_run_id are treated as stale (same idea as requeued) and do not fail the current attempt.

LocalExecutor / Celery / Kubernetes emit and consume the id (with provider-compat fallbacks for older cores).

Cleared with external_executor_id on clear/orphan paths.

Related: #66374 / #66431, #67287 / #68741, #72716 / #71579 / #72767


Was generative AI tooling used to co-author this PR?
  • Yes.

Generated-by: Cursor IA IDLE, for discussion and planning of the solution. Following the guidelines

@Pedrinhonitz
Pedrinhonitz marked this pull request as draft September 22, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:db-migrations PRs with DB migration area:Executors-core LocalExecutor & SequentialExecutor area:providers area:scheduler kind:documentation provider:celery provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant