bbovenzi commented on code in PR #69148:
URL: https://github.com/apache/airflow/pull/69148#discussion_r3807117295
##########
airflow-core/src/airflow/plugins_manager.py:
##########
@@ -137,6 +137,89 @@ def __register_plugins(plugin_instances:
list[AirflowPlugin], errors: dict[str,
return plugins, import_errors
+_DAG_APPLIES_TO_CRITERIA = frozenset({"dag_tags", "dag_ids"})
+_TASK_APPLIES_TO_CRITERIA = frozenset({"task_ids", "operators",
"operator_names"})
+_APPLIES_TO_CRITERIA = _DAG_APPLIES_TO_CRITERIA | _TASK_APPLIES_TO_CRITERIA
+
+# Which `applies_to` criteria each destination can resolve a record for. A
destination
+# missing from this mapping cannot evaluate any criterion. Kept in sync with
the table in
+# docs/administration-and-deployment/plugins.rst.
+_EVALUABLE_CRITERIA_BY_DESTINATION: dict[str, frozenset[str]] = {
+ "dag": _DAG_APPLIES_TO_CRITERIA,
+ "dag_run": _DAG_APPLIES_TO_CRITERIA,
+ "dag_overview": _DAG_APPLIES_TO_CRITERIA,
+ "task": _APPLIES_TO_CRITERIA,
+ "task_overview": _APPLIES_TO_CRITERIA,
+ "task_instance": _APPLIES_TO_CRITERIA,
+ "nav": frozenset(),
+ "base": frozenset(),
+ "dashboard": frozenset(),
+ "asset": frozenset(),
+}
Review Comment:
Let's add a test here so we can catch when this list falls out of sync.
##########
airflow-core/src/airflow/plugins_manager.py:
##########
@@ -137,6 +137,89 @@ def __register_plugins(plugin_instances:
list[AirflowPlugin], errors: dict[str,
return plugins, import_errors
+_DAG_APPLIES_TO_CRITERIA = frozenset({"dag_tags", "dag_ids"})
+_TASK_APPLIES_TO_CRITERIA = frozenset({"task_ids", "operators",
"operator_names"})
+_APPLIES_TO_CRITERIA = _DAG_APPLIES_TO_CRITERIA | _TASK_APPLIES_TO_CRITERIA
+
+# Which `applies_to` criteria each destination can resolve a record for. A
destination
+# missing from this mapping cannot evaluate any criterion. Kept in sync with
the table in
+# docs/administration-and-deployment/plugins.rst.
+_EVALUABLE_CRITERIA_BY_DESTINATION: dict[str, frozenset[str]] = {
+ "dag": _DAG_APPLIES_TO_CRITERIA,
+ "dag_run": _DAG_APPLIES_TO_CRITERIA,
+ "dag_overview": _DAG_APPLIES_TO_CRITERIA,
+ "task": _APPLIES_TO_CRITERIA,
+ "task_overview": _APPLIES_TO_CRITERIA,
+ "task_instance": _APPLIES_TO_CRITERIA,
+ "nav": frozenset(),
+ "base": frozenset(),
+ "dashboard": frozenset(),
+ "asset": frozenset(),
+}
Review Comment:
Let's add a test here so we can catch when this list falls out of sync.
--
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]