You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "o-nikolas (via GitHub)" <gi...@apache.org> on 2025/06/02 18:23:41 UTC

[PR] Team Based Configuration (AIP-67) [airflow]

o-nikolas opened a new pull request, #51322:
URL: https://github.com/apache/airflow/pull/51322

   Context: In the context of multi team airflow, teams will have their own configuration files for the components that run on team-only hosts (for workers, dag parsers, etc running on those hosts). However some team components must live along side one another on the scheduler host, namely executors, and some airflow configuration affecting teams must also be accessible to the scheduler.
   
   This commit delivers the capability for airflow `conf` to load and allow access to multiple team configurations in addition to the main/global configuration we have today.
   
   A new config is added `core.multi_team_configurations` (the name is not set in stone) in which teams and their associated configuration files are specified. E.g.:
   ```
   path/to/team_a/airflow.cfg:team_a,different/path/team_b/airflow.cfg:team_b
   ```
   
   Airflow conf, during initialization, loads each of these configurations and makes them accessible by id, e.g.: `conf.get("core", "executor", team_id="team_a")`
   
   Team configuration can be provided by cfg file and environment variable. cmd and secret based config is not yet supported (TBD).
   
   Within those team configurations, teams can specify the executors they would like to use and the associated configuration for those executors. Since each team configuration is loaded and stored separately, this allows multiple instances of the same executor to be configured.
   
   The Base executor has been updated with a config shim to allow easier access to team based executor configations and the AWS ECS executor has been updated to use it as a proof of concept. Other executors will need to be updated to be "multi team compliant" at a later time to minimize the size and scope of this commit.
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on PR #51322:
URL: https://github.com/apache/airflow/pull/51322#issuecomment-3045979514

   Sadly, it doesn't sound like this will be accepted by the community. Closing this PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #51322:
URL: https://github.com/apache/airflow/pull/51322#issuecomment-2955934456

   > > I really do wonder if this level of complexity means it's time to move away from uni to something with more structure such as TOML
   > 
   > @ashb,
   > 
   > Yeah, that was discussed in the AIP, but I actually think this is much easier and simpler honestly:
   > 
   > 1. It's _way_ fewer changes both strictly lines of code and as well as cognitively for users.
   > 2. For those who are not using multi-team, nothing will change and their configuration as they have it continues to work. To overhaul all of config, just to enable the users who wish to use multi-team, feels like putting a lot of work onto developers and users of airflow who are not interested in multi team (which will be a much bigger population).
   > 3. Also, I like the separation of team and non-team config. To make config expressive enough to mix the two doesn't actually seem to gain anything to me, I prefer the separation of church and state :)
   
   Quite agree. The thing is also that for multi-team configuration we do not want team a configuration to be present in DAG file processor of Team B. You keep various things there including credentials needed for secrets manager (future) - so you do not want to give Team A a way to read Team B credentials - so you just do not want team A config to be present in Team B environment.
   
   Having the config split by file was deliberate choice - because then you could only copy the dedicated config file to dedicated environment. 
   
   If we use TOML and arrays, you woudl have to likely pre-process the config files and generate differet config sets for different teams, which would mean additional operational complexity when updating config files.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas closed pull request #51322: Team Based Configuration (AIP-67)
URL: https://github.com/apache/airflow/pull/51322


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #51322:
URL: https://github.com/apache/airflow/pull/51322#discussion_r2135818383


##########
airflow-core/src/airflow/configuration.py:
##########
@@ -873,12 +874,14 @@ def mask_secrets(self):
                 continue
             mask_secret(value)
 
-    def _env_var_name(self, section: str, key: str) -> str:
-        return f"{ENV_VAR_PREFIX}{section.replace('.', '_').upper()}__{key.upper()}"
+    def _env_var_name(self, section: str, key: str, team_id: str | None = None) -> str:
+        team_component = f"{team_id.upper()}__" if team_id else ""
+        return f"{ENV_VAR_PREFIX}{team_component}{section.replace('.', '_').upper()}__{key.upper()}"

Review Comment:
   Suggestion: maybe a better approach for env var will be to make sure that the team settings are having a separate namespace:
   
   ``AIRFLOW_TEAM__TEAM_ID__SECTION__CONFIG``
   
   There is a non-zero chance someone names their team "core" for example. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #51322:
URL: https://github.com/apache/airflow/pull/51322#discussion_r2127129924


##########
airflow-core/src/airflow/configuration.py:
##########
@@ -1864,6 +1903,29 @@ def providers_configuration_loaded(self) -> bool:
         """Checks if providers have been loaded."""
         return self._providers_configuration_loaded
 
+    def setup_team_configs(self, from_dict: dict | None = None):

Review Comment:
   Why do we need `from_dict`? I find it confusing. If multiple teams are specified in the config, they'll all have the same config?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on code in PR #51322:
URL: https://github.com/apache/airflow/pull/51322#discussion_r2130116529


##########
airflow-core/src/airflow/configuration.py:
##########
@@ -1864,6 +1903,29 @@ def providers_configuration_loaded(self) -> bool:
         """Checks if providers have been loaded."""
         return self._providers_configuration_loaded
 
+    def setup_team_configs(self, from_dict: dict | None = None):

Review Comment:
   Ah, actually I found the reason it's still there. Both here and for the main config, this is used mostly in tests as an easier way to get config injected. So I'll keep it for now
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #51322:
URL: https://github.com/apache/airflow/pull/51322#issuecomment-2932222913

   I really do wonder if this level of complexity means it's time to move away from uni to something with more structure such as TOML


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on PR #51322:
URL: https://github.com/apache/airflow/pull/51322#issuecomment-2932470082

   > I really do wonder if this level of complexity means it's time to move away from uni to something with more structure such as TOML
   
   @ashb, 
   
   Yeah, that was discussed in the AIP, but I actually think this is much easier and simpler honestly:
   1) It's _way_ fewer changes both strictly lines of code and as well as cognitively for users.
   1) For those who are not using multi-team, nothing will change and their configuration as they have it continues to work. To overhaul all of config, just to enable the users who wish to use multi-team, feels like putting a lot of work onto developers and users of airflow who are not interested in multi team (which will be a much bigger population).
   2) Also, I like the separation of team and non-team config. To make config expressive enough to mix the two doesn't actually seem to gain anything to me, I prefer the separation of church and state :) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Team Based Configuration (AIP-67) [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on code in PR #51322:
URL: https://github.com/apache/airflow/pull/51322#discussion_r2127146925


##########
airflow-core/src/airflow/configuration.py:
##########
@@ -1864,6 +1903,29 @@ def providers_configuration_loaded(self) -> bool:
         """Checks if providers have been loaded."""
         return self._providers_configuration_loaded
 
+    def setup_team_configs(self, from_dict: dict | None = None):

Review Comment:
   Ah yes, this was some carry-over from the non-team code. Good catch! Will remove :+1: 
   
   We could think of taking a list of dicts (or some other structure) for each team, but I think that's a bit overkill for the team use case, which will be much more niche. If people really want it we can add it later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org