Skip to content

Conversation

@zach-overflow
Copy link
Contributor

@zach-overflow zach-overflow commented Dec 9, 2025


Closes: #33818
Partially addresses / related: #59871

What?

  • Adds optional support for task-based trigger queue assignment, which allows a given triggerer to consume from a user-configured subset of triggers, based on their origin tasks' queue value.
    • Adds an optional --queues CLI option to the triggerer, to constrain a triggerer to only consume Triggers from a given list of task queues.
    • Adds a new triggerer.queues_enabled config entry, which when set to True enables the trigger queue feature (False by default).
    • Adds a queue column to the trigger table, which is set automatically by the task runner when triggerer.queues_enabled is set to True.
  • Adds relevant documentation updates for this new feature.

Why?

  • AIP-67 (multi-tenancy support), to enable team-specific triggerer assignment.
  • More generally, and not necessarily specific to multi-tenancy use-cases, to allow for other triggerer assignment strategies in an HA setup.

Testing

  • Tested the example HITL dag in docker-compose; once with triggerer.queues_enabled=False and once with triggerer.queues_enabled=True to ensure deferrable tasks worked in either setup.
  • standard collection of breeze and prek testing commands
  • Ran uv run --group docs build-docs --autobuild to check the new doc section rendering.

Note on event-based triggers and async Callbacks

Following from the helpful discussion here, this PR aims to assign a trigger's queue from its deferring task's queue. As such, this PR does not add any triggerer assignment controls for event-based triggers or TriggererCallback-based triggers. This was done intentionally both to keep this PR's scope reasonable, and because the latter 2 types of triggers do not necessarily have a relation to a singular task / task queue. If it is preferred, I'm happy to create a followup issue for adding queue support in these types of triggers. I've also made sure to make this explicit in the user documentation, and added details in the docs on how to use this feature without disrupting any potential usage of event-based or callback-based triggers.

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Thanks for adding the nice feature!

Would it be better that Triggerer only add the SQL filter if user specify --consume-trigger-queues from CLI without adding the new configs?

Not sure if this would be not only less ambiguous for users but also make the SQL unchanged by only applying the trigger_queue.in_ filter when users explicitly pass the --consume-trigger-queues flag. In my opinion, this preserves the feature while minimizing changes.

@zach-overflow
Copy link
Contributor Author

zach-overflow commented Dec 13, 2025

Thanks for adding the nice feature!

Would it be better that Triggerer only add the SQL filter if user specify --consume-trigger-queues from CLI without adding the new configs?

Not sure if this would be not only less ambiguous for users but also make the SQL unchanged by only applying the trigger_queue.in_ filter when users explicitly pass the --consume-trigger-queues flag. In my opinion, this preserves the feature while minimizing changes.

Thanks for the suggestion, I like that idea and am all in favor of reduced ambiguity. It also seems like what your suggesting will fall more in line with the celery queues controls (i.e. the queue(s) a celery worker consumes from are optionally set by the CLI command).

@zach-overflow zach-overflow force-pushed the zg/support-triggerer-queues branch from 65ae27e to aab098f Compare December 30, 2025 17:57
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

For me it is good then

@jscheffl jscheffl added this to the Airflow 3.2.0 milestone Dec 30, 2025
@jscheffl jscheffl merged commit 667e230 into apache:main Dec 31, 2025
239 of 241 checks passed
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

#protm , it's a really nice feature for 3.2!

@Dev-iL
Copy link
Collaborator

Dev-iL commented Jan 1, 2026

Great job!

@potiuk
Copy link
Member

potiuk commented Jan 1, 2026

Indeed!

@zach-overflow zach-overflow deleted the zg/support-triggerer-queues branch January 2, 2026 13:19
@o-nikolas
Copy link
Contributor

AIP-67 (multi-tenancy support), to enable team-specific triggerer assignment.

We won't be able to rely on the queue field for the multi-tenancy use-case. But I'm sure there will be lots of plumbing we can reuse from this!

stegololz pushed a commit to stegololz/airflow that referenced this pull request Jan 9, 2026
* Add trigger_queues to triggerer

* Update config additions, add doc section and unit tests

* Fix default consume_trigger_queues split on commas

* Add migration script, test updates, and news fragment

* Address feedback, bugfixes

* core unit test typing fix

* Fix trigger callback trigger_queue assignment

* Fix mypy issues in google provider triggers

* Fix 0015_2_9_0_update_trigger_kwargs_type migration

* fix deprecated sqlalchemy language in test

* refactor trigger_queue in kwargs

* Add examples to doc section, clarify newsfragment

* Initial refactor to derive trigger queues from task queues

* Move trigger queue assignment to task deferral API calls, update docs + tests

* Address mypy failures in test_ecs.py

* Remove redundant changes from refactor

* Make trigger.queue column max length consistent with taskinstance.queue column max len

* Remove no longer required typing-only changes

* manual refactors to unit test conflict resolutions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dispatching triggers to different triggerer instances.

6 participants