You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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
Copy file name to clipboardExpand all lines: airflow-core/docs/authoring-and-scheduling/deferring.rst
+65Lines changed: 65 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -468,6 +468,71 @@ According to `benchmarks <https://github.com/apache/airflow/pull/58803#pullreque
468
468
469
469
You can determine a suitable value for your deployment by creating a large number of triggers (for example, by triggering a Dag with many deferrable tasks) and observing both how the load is distributed across Triggerers in your environment and how long it takes for all Triggerers to pick up the triggers.
470
470
471
+
Controlling Triggerer Host Assignment Per Trigger
472
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
473
+
474
+
.. versionadded:: 3.2.0
475
+
476
+
Under some circumstances, it may be desirable to assign a Trigger to a specific subset of ``triggerer`` hosts. Some examples of when this might be desirable are:
477
+
478
+
* In a multi-tenant Airflow system where you run a distinct set of ``triggerers`` per team.
479
+
* Running distinct sets of ``triggerers`` hosts, where each set of hosts are configured for different trigger operations (e.g. each set of triggerers may have different cloud permissions).
480
+
481
+
To enable queue assignment for triggers, do the following:
482
+
483
+
1. Set the :ref:`config:triggerer__queues_enabled` config value to ``true``. This will ensure when tasks defer, they pass their assigned task queue to the newly registered trigger instance.
484
+
2. For a given ``triggerer`` host(s), add ``--queues=<comma-separated string of task queue names to consume from>`` to the Triggerers' startup command. This option ensures the triggerer will only pick up ``trigger`` instances deferred by tasks from the specified task queue(s).
485
+
486
+
For example, let's say you are running two triggerer hosts (labeled "X", and "Y") with the following commands:
487
+
488
+
.. code-block:: bash
489
+
490
+
# triggerer "X" startup command
491
+
airflow triggerer --queues=alice,bob
492
+
# triggerer "Y" startup command
493
+
airflow triggerer --queues=test_q
494
+
495
+
In this scenario, triggerer "X" will exclusively run triggers deferred from tasks originating from task queues ``"alice"`` or ``"bob"``.
496
+
Similarly, triggerer "Y" will exclusively run triggers deferred from tasks originating from task queue ``"test_q"``.
497
+
498
+
Trigger Queue Assignment Caveats
499
+
''''''''''''''''''''''''''''''''
500
+
501
+
This feature is only compatible with executors which utilize the task ``queue`` concept
502
+
(such as the :ref:`CeleryExecutor<apache-airflow-providers-celery:celery_executor:queue>`).
503
+
504
+
Additionally, queue assignment is currently only compatible with the subset of triggers originating from a task's defer ``method``.
| Triggers from async :doc:`Callbacks<../administration-and-deployment/logging-monitoring/callbacks>` | No | Any triggerer running without the ``--queues`` option |
If you use queues for task-based triggers, while **also** using event-based triggers and/or callback triggers,
517
+
you must run one or more triggerer hosts **without** the ``--queues`` option, so the latter 2 types of triggers are still run.
518
+
519
+
.. note::
520
+
To enable trigger queues, you must set the ``--queues`` option on one or more triggerers' startup command (these values may differ between the various triggerers).
521
+
If you set the ``--queue`` value of a triggerer to some value which no task queues exist for, that triggerer will never run any triggers.
522
+
Similarly, all ``triggerer`` instances running without the ``--queues`` option will only consume event-driven and callback-based triggers.
523
+
524
+
525
+
The following example shows how to run HA triggerers so that all trigger types are run (assuming all tasks'
526
+
queue values are set to either ``"team_A"`` or ``"team_B"``):
527
+
528
+
.. code-block:: bash
529
+
530
+
# triggerer "A" startup command, only consumes triggers registered by tasks in queue "team_A"
531
+
airflow triggerer --queues=team_A
532
+
# triggerer "B" startup command, only consumes triggers registered by tasks in queue "team_B"
533
+
airflow triggerer --queues=team_B
534
+
# triggerer "C" startup command, consumes only event-based triggers and callback-based triggers.
535
+
airflow triggerer
471
536
472
537
473
538
Difference between Mode='reschedule' and Deferrable=True in Sensors
0 commit comments