Populate trigger team_name at creation time for multi-team support#67605
Open
ramitkataria wants to merge 1 commit into
Open
Populate trigger team_name at creation time for multi-team support#67605ramitkataria wants to merge 1 commit into
ramitkataria wants to merge 1 commit into
Conversation
Populate `trigger.team_name` at all 4 trigger creation paths so that team-scoped triggerers can filter to their own team's triggers: - **`TaskInstance.defer_task()`** — resolves via `DagModel.get_team_name(dag_id)` - **Execution API `PATCH .../state` (deferred)** — resolves via `get_team_name_for_ti(ti_id)` - **`TriggererCallback.queue()`** — resolves via `DagBundleModel.get_team_name(bundle_name)` - **Asset watcher triggers (`bulk_write_to_db`)** — resolves via `DagBundleModel.get_team_name(bundle_name)` All paths are gated on `core.multi_team`; when disabled, no DB query is executed and `team_name` remains NULL. To support the above changes: - Add `DagBundleModel.get_team_name()` following the existing pattern used by Pool, Connection, Variable, and DagModel. - Add `session` parameter to `Callback.queue()` so triggerer callbacks can resolve team.
vincbeck
reviewed
May 27, 2026
| "next_method": "execute_callback", | ||
| } | ||
|
|
||
| with conf_vars({("core", "multi_team"): multi_team_enabled}): |
Contributor
There was a problem hiding this comment.
nit: move it as decorator of the test, that makes the test smaller (that applies to other location in your PR as well)
|
|
||
| @staticmethod | ||
| @provide_session | ||
| def get_team_name(bundle_name: str, *, session: Session = NEW_SESSION) -> str | None: |
Contributor
There was a problem hiding this comment.
Please have unit test associated to this method
| self.trigger_timeout = None | ||
|
|
||
| team_name: str | None = None | ||
| if conf.getboolean("core", "multi_team"): |
Contributor
There was a problem hiding this comment.
This is not covered by unit test
o-nikolas
approved these changes
May 28, 2026
Contributor
o-nikolas
left a comment
There was a problem hiding this comment.
Other than Vincent's comments, this looks good to me
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.
Populate
trigger.team_nameat all 4 trigger creation paths so that team-scoped triggerers can filter to their own team's triggers:TaskInstance.defer_task()— resolves viaDagModel.get_team_name(dag_id)PATCH .../state(deferred) — resolves viaget_team_name_for_ti(ti_id)TriggererCallback.queue()— resolves viaDagBundleModel.get_team_name(bundle_name)bulk_write_to_db) — resolves viaDagBundleModel.get_team_name(bundle_name)All paths are gated on
core.multi_team; when disabled, no DB query is executed andteam_nameremains NULL.To support the above changes:
DagBundleModel.get_team_name()following the existing pattern used by Pool, Connection, Variable, and DagModel.sessionparameter toCallback.queue()so triggerer callbacks can resolve team.Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.