diff --git a/airflow-core/docs/templates-ref.rst b/airflow-core/docs/templates-ref.rst index c908e03da9411..ea2035a61846f 100644 --- a/airflow-core/docs/templates-ref.rst +++ b/airflow-core/docs/templates-ref.rst @@ -39,7 +39,7 @@ uniquely identify a Dag run triggered by an asset event. The variables listed on this page are provided via Airflow's execution-time context. -When using the Task SDK, the same execution-time context is also available programmatically via the :class:`airflow.sdk.Context` object. +When using the Task SDK, the same execution-time context is also available programmatically via the :py:class:`airflow.sdk.Context` object. The following come for free out of the box with Airflow. Additional custom macros can be added globally through :doc:`administration-and-deployment/plugins`, or at a Dag level through the @@ -63,24 +63,24 @@ Variable Type Description ``{{ exception }}`` None | str | | Error occurred while running task instance. Exception | KeyboardInterrupt | -``{{ prev_data_interval_start_success }}`` `pendulum.DateTime`_ | Start of the data interval of the prior successful :class:`~airflow.models.dagrun.DagRun`. +``{{ prev_data_interval_start_success }}`` `pendulum.DateTime`_ | Start of the data interval of the prior successful :py:class:`~airflow.models.dagrun.DagRun`. | ``None`` | Added in version 2.2. -``{{ prev_data_interval_end_success }}`` `pendulum.DateTime`_ | End of the data interval of the prior successful :class:`~airflow.models.dagrun.DagRun`. +``{{ prev_data_interval_end_success }}`` `pendulum.DateTime`_ | End of the data interval of the prior successful :py:class:`~airflow.models.dagrun.DagRun`. | ``None`` | Added in version 2.2. -``{{ prev_start_date_success }}`` `pendulum.DateTime`_ Start date from prior successful :class:`~airflow.models.dagrun.DagRun` (if available). +``{{ prev_start_date_success }}`` `pendulum.DateTime`_ | Start date from prior successful :py:class:`~airflow.models.dagrun.DagRun` (if available). + | ``None`` +``{{ prev_end_date_success }}`` `pendulum.DateTime`_ End date from prior successful :py:class:`~airflow.models.dagrun.DagRun` (if available). | ``None`` -``{{ prev_end_date_success }}`` `pendulum.DateTime`_ End date from prior successful :class:`~airflow.models.dagrun.DagRun` (if available). - | ``None`` ``{{ inlets }}`` list List of inlets declared on the task. ``{{ inlet_events }}`` dict[str, ...] Access past events of inlet assets. See :doc:`Assets `. Added in version 2.10. ``{{ outlets }}`` list List of outlets declared on the task. ``{{ outlet_events }}`` dict[str, ...] | Accessors to attach information to asset events that will be emitted by the current task. | See :doc:`Assets `. Added in version 2.10. -``{{ dag }}`` DAG The currently running :class:`~airflow.models.dag.DAG`. You can read more about Dags in :doc:`Dags `. -``{{ task }}`` BaseOperator | The currently running :class:`~airflow.models.baseoperator.BaseOperator`. You can read more about Tasks in :doc:`core-concepts/operators` +``{{ dag }}`` DAG The currently running :py:class:`~airflow.models.dag.DAG`. You can read more about Dags in :doc:`Dags `. +``{{ task }}`` BaseOperator | The currently running :py:class:`~airflow.models.baseoperator.BaseOperator`. You can read more about Tasks in :doc:`core-concepts/operators` ``{{ task_reschedule_count }}`` int How many times current task has been rescheduled. Relevant to ``mode="reschedule"`` sensors. ``{{ macros }}`` | A reference to the macros package. See Macros_ below. -``{{ task_instance }}`` TaskInstance The currently running :class:`~airflow.models.taskinstance.TaskInstance`. +``{{ task_instance }}`` TaskInstance The currently running :py:class:`~airflow.models.taskinstance.TaskInstance`. ``{{ ti }}`` TaskInstance Same as ``{{ task_instance }}``. ``{{ params }}`` dict[str, Any] | The user-defined params. This can be overridden by the mapping | passed to ``trigger_dag -c`` if ``dag_run_conf_overrides_params`` @@ -95,14 +95,14 @@ Variable Type Description | | For asset-triggered DAGs, the format uses the DAG run identifier instead: | ``{dag_id}__{task_id}__{dag_run.run_id}``. -``{{ run_id }}`` str The currently running :class:`~airflow.models.dagrun.DagRun` run ID. -``{{ dag_run }}`` DagRun The currently running :class:`~airflow.models.dagrun.DagRun`. +``{{ run_id }}`` str The currently running :py:class:`~airflow.models.dagrun.DagRun` run ID. +``{{ dag_run }}`` DagRun The currently running :py:class:`~airflow.models.dagrun.DagRun`. ``{{ test_mode }}`` bool Whether the task instance was run by the ``airflow test`` CLI. ``{{ map_index_template }}`` None | str Template used to render the expanded task instance of a mapped task. Setting this value will be reflected in the rendered result. ``{{ expanded_ti_count }}`` int | ``None`` | Number of task instances that a mapped task was expanded into. If | the current task is not mapped, this should be ``None``. | Added in version 2.5. -``{{ triggering_asset_events }}`` dict[str, | If in an Asset Scheduled Dag, a map of Asset URI to a list of triggering :class:`~airflow.models.asset.AssetEvent` +``{{ triggering_asset_events }}`` dict[str, | If in an Asset Scheduled Dag, a map of Asset URI to a list of triggering :py:class:`~airflow.models.asset.AssetEvent` list[AssetEvent]] | (there may be more than one, if there are multiple Assets with different frequencies). | Read more here :doc:`Assets `. | Added in version 2.4. @@ -201,13 +201,13 @@ A few commonly used libraries and methods are made available. ================================= ======================================================================================================================================================================== Variable Description ================================= ======================================================================================================================================================================== -``macros.datetime`` The standard lib's :class:`datetime.datetime`. +``macros.datetime`` The standard lib's :py:class:`datetime.datetime`. Note: ``utcnow()`` is deprecated in Python 3.12+; use ``now(macros.dateutil.tz.UTC)`` instead. -``macros.timedelta`` The standard lib's :class:`datetime.timedelta` +``macros.timedelta`` The standard lib's :py:class:`datetime.timedelta` ``macros.dateutil`` A reference to the ``dateutil`` package ``macros.time`` The standard lib's :mod:`time` ``macros.uuid`` The standard lib's :mod:`uuid` -``macros.random`` The standard lib's :class:`random.random` +``macros.random`` The standard lib's :py:class:`random.random` ================================= ======================================================================================================================================================================== Some Airflow specific macros are also defined: