o-nikolas commented on code in PR #66954:
URL: https://github.com/apache/airflow/pull/66954#discussion_r3244316741
##########
airflow-core/src/airflow/dag_processing/collection.py:
##########
@@ -891,7 +891,9 @@ def add_dag_asset_references(
if not references:
dags[dag_id].schedule_asset_references = []
continue
- referenced_assets = {assets[r.name, r.uri]: r.allow_producer_teams
for r in references}
+ referenced_assets = {
+ assets[r.name, r.uri]: r.access_control.get("producer_teams",
[]) for r in references
Review Comment:
You could make `producer_teams` a property that returns [] if there isn't
any configured so that you don't have to do these guarded gets. But I also see
in one of the tests that it already defaults to []? Or is this because it's a
deser to a dict at this point?
##########
airflow-core/src/airflow/example_dags/example_asset_allow_teams.py:
##########
@@ -15,32 +15,34 @@
# specific language governing permissions and limitations
# under the License.
"""
-Example DAG demonstrating cross-team asset triggering with
``allow_producer_teams``.
+Example DAG demonstrating cross-team asset triggering with
``AssetAccessControl``.
When Multi-Team mode is enabled (``[core] multi_team = True``), asset events
are filtered by team
membership. By default, a consuming DAG only receives events from DAGs within
the same team.
Usage:
- ``team_analytics_producer`` (belonging to ``team_analytics``) produces
events on ``shared_data``.
- ``team_ml_consumer`` (belonging to ``team_ml``) consumes ``shared_data``.
- - Because ``shared_data`` has ``allow_producer_teams=["team_analytics"]``,
events from ``team_analytics``
- are accepted by ``team_ml_consumer``.
- - Without ``allow_producer_teams``, the cross-team event would be blocked.
+ - Because ``shared_data`` has
``access_control=AssetAccessControl(producer_teams=["team_analytics"])``,
+ events from ``team_analytics`` are accepted by ``team_ml_consumer``.
+ - Without ``access_control``, the cross-team event would be blocked.
"""
from __future__ import annotations
import pendulum
from airflow.providers.standard.operators.bash import BashOperator
-from airflow.sdk import DAG, Asset
+from airflow.sdk import DAG, Asset, AssetAccessControl
-# [START asset_allow_producer_teams]
-# Define an asset that accepts events from team_analytics in addition to the
consumer's own team.
+# [START asset_access_control]
Review Comment:
Where is this referenced? I expected to see some docs pull this as an
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]