From 49e178e4b0e7898eeb13527ea3211210ee6d94d6 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 12 Jan 2023 23:44:31 +0800 Subject: [PATCH] Mention mapped operator in cluster policy doc (#28885) --- .../administration-and-deployment/cluster-policies.rst | 2 +- .../authoring-and-scheduling/dynamic-task-mapping.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/apache-airflow/administration-and-deployment/cluster-policies.rst b/docs/apache-airflow/administration-and-deployment/cluster-policies.rst index 242924a3f3249..76ede3bd67620 100644 --- a/docs/apache-airflow/administration-and-deployment/cluster-policies.rst +++ b/docs/apache-airflow/administration-and-deployment/cluster-policies.rst @@ -27,7 +27,7 @@ If you want to check or mutate DAGs or Tasks on a cluster-wide level, then a Clu There are three types of cluster policy: * ``dag_policy``: Takes a :class:`~airflow.models.dag.DAG` parameter called ``dag``. Runs at load time of the DAG from DagBag :class:`~airflow.models.dagbag.DagBag`. -* ``task_policy``: Takes a :class:`~airflow.models.baseoperator.BaseOperator` parameter called ``task``. The policy gets executed when the task is created during parsing of the task from DagBag at load time. This means that the whole task definition can be altered in the task policy. It does not relate to a specific task running in a DagRun. The ``task_policy`` defined is applied to all the task instances that will be executed in the future. +* ``task_policy``: Takes a parameter called ``task`` that is of type either :class:`~airflow.models.baseoperator.BaseOperator` or :class:`~airflow.models.mappedoperator.MappedOperator` (for `dynamically expanded tasks `_). The policy gets executed when the task is created during parsing of the task from DagBag at load time. This means that the whole task definition can be altered in the task policy. It does not relate to a specific task running in a DagRun. The ``task_policy`` defined is applied to all the task instances that will be executed in the future. * ``task_instance_mutation_hook``: Takes a :class:`~airflow.models.taskinstance.TaskInstance` parameter called ``task_instance``. The ``task_instance_mutation`` applies not to a task but to the instance of a task that relates to a particular DagRun. It is executed in a "worker", not in the dag file processor, just before the task instance is executed. The policy is only applied to the currently executed run (i.e. instance) of that task. The DAG and Task cluster policies can raise the :class:`~airflow.exceptions.AirflowClusterPolicyViolation` exception to indicate that the dag/task they were passed is not compliant and should not be loaded. diff --git a/docs/apache-airflow/authoring-and-scheduling/dynamic-task-mapping.rst b/docs/apache-airflow/authoring-and-scheduling/dynamic-task-mapping.rst index 8874e71ea29e6..a8d017626367d 100644 --- a/docs/apache-airflow/authoring-and-scheduling/dynamic-task-mapping.rst +++ b/docs/apache-airflow/authoring-and-scheduling/dynamic-task-mapping.rst @@ -15,6 +15,8 @@ specific language governing permissions and limitations under the License. +.. _dynamic-task-mapping: + ==================== Dynamic Task Mapping ====================