fix: make celery broker SQS visibility timeout configurable, default 30m - #40
Open
ividito wants to merge 1 commit into
Open
fix: make celery broker SQS visibility timeout configurable, default 30m#40ividito wants to merge 1 commit into
ividito wants to merge 1 commit into
Conversation
aws_sqs_queue.celery_broker set no visibility_timeout_seconds, so the AWS provider default of 30s applied. Any Airflow task running longer than 30s had its broker message redelivered mid-run, and a second worker tried to start the same task instance. On Airflow 2 the duplicate delivery was tolerated. On Airflow 3 the Task Execution API rejects the second start with `invalid_state`, the Celery executor reports the task as failed, and the scheduler kills the still-healthy original run - the task fails despite never having errored. This has to be fixed on the queue rather than through celery's broker_transport_options, because the Airflow config uses `predefined_queues`: kombu does not create the queue, so the queue's own attribute governs redelivery. Observed on sm2a-dev and sm2a-sit (both Airflow 3.0.2): a vector ingest task failed at the 30s mark while actively processing, having succeeded at ~11 minutes on 2.10.5. Exposed as celery_broker_visibility_timeout_seconds. The new 1800s default changes the queue attribute for existing consumers on next apply; this is an in-place SetQueueAttributes update and does not replace the queue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Increase SQS timeout threshold to prevent long-running tasks from failing. This is configurable, and defaults to 30m (the longest impacted task I found in our dev environment was 11m, so this is generous).