Skip to content

Commit b1f7707

Browse files
committed
Fix PR comments
1 parent de0b569 commit b1f7707

File tree

2 files changed

+18
-36
lines changed

2 files changed

+18
-36
lines changed

airflow-core/docs/core-concepts/xcoms.rst

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,6 @@ An example of pushing multiple XComs and pulling them individually:
7676
# Pulling entire xcom data from push_multiple task
7777
data = context["ti"].xcom_pull(task_ids="push_multiple", key="return_value")
7878
79-
You can also use the Task Context directly for XCom operations:
80-
81-
.. code-block:: python
82-
83-
from airflow.sdk import get_current_context
84-
85-
86-
@task
87-
def example_task():
88-
context = get_current_context()
89-
ti = context["ti"]
90-
91-
# Push XCom
92-
ti.xcom_push(key="my_key", value="my_value")
93-
94-
# Pull XCom
95-
value = ti.xcom_pull(task_ids="previous_task", key="my_key")
96-
return value
97-
9879
.. note::
9980

10081
If the first task run is not succeeded then on every retry task XComs will be cleared to make the task run idempotent.
@@ -111,7 +92,7 @@ Custom XCom Backends
11192

11293
The XCom system has interchangeable backends, and you can set which backend is being used via the ``xcom_backend`` configuration option.
11394

114-
If you want to implement your own backend, you should subclass :class:`~airflow.sdk.execution_time.xcom.XCom`, and override the ``serialize_value`` and ``deserialize_value`` methods.
95+
If you want to implement your own backend, you should subclass :class:`~airflow.models.xcom.BaseXCom`, and override the ``serialize_value`` and ``deserialize_value`` methods.
11596

11697
The base class for custom XCom backends is now :class:`~airflow.sdk.execution_time.xcom.XCom`
11798
from the airflow.sdk namespace.

airflow-core/docs/public-airflow-interface.rst

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ and extending Airflow capabilities by writing new executors, plugins, operators
3636
Public Interface can be useful for building custom tools and integrations with other systems,
3737
and for automating certain aspects of the Airflow workflow.
3838

39-
In Airflow 3.0+, the primary public interface for DAG authors and task execution is the
39+
The primary public interface for DAG Authors and task execution is using task SDK
4040
:doc:`airflow.sdk namespace <core-concepts/taskflow>`. Direct access to the metadata database
4141
from task code is no longer allowed. Instead, use the :doc:`Stable REST API <stable-rest-api-ref>`,
4242
`Python Client <https://github.com/apache/airflow-client-python>`_, or Task Context methods.
@@ -74,16 +74,17 @@ way, the Stable REST API is recommended.
7474
Using the Public Interface for DAG Authors
7575
==========================================
7676

77-
The primary interface for DAG authors in Airflow 3.0+ is the :doc:`airflow.sdk namespace <core-concepts/taskflow>`.
77+
The primary interface for DAG Authors is the :doc:`airflow.sdk namespace <core-concepts/taskflow>`.
7878
This provides a stable, well-defined interface for creating DAGs and tasks that is not subject to internal
7979
implementation changes. The goal of this change is to decouple DAG authoring from Airflow internals (Scheduler,
80-
API Server, etc.), providing a forward-compatible, stable interface for writing and maintaining DAGs across Airflow versions.
80+
API Server, etc.), providing a version-agnostic, stable interface for writing and maintaining DAGs across Airflow versions.
8181

8282
**Key Imports from airflow.sdk:**
8383

8484
**Classes:**
8585

8686
* ``Asset``
87+
* ``BaseHook``
8788
* ``BaseNotifier``
8889
* ``BaseOperator``
8990
* ``BaseOperatorLink``
@@ -153,17 +154,17 @@ You can read more about dags in :doc:`Dags <core-concepts/dags>`.
153154
References for the modules used in dags are here:
154155

155156
.. note::
156-
The airflow.sdk namespace provides the primary interface for DAG authors in Airflow 3.0+.
157+
The airflow.sdk namespace provides the primary interface for DAG Authors.
157158
For detailed API documentation, see the `Task SDK Reference <https://airflow.apache.org/docs/task-sdk/stable/>`_.
158159

159160
.. note::
160161
The :class:`~airflow.models.dagbag.DagBag` class is used internally by Airflow for loading DAGs
161-
from files and folders. DAG authors should use the :class:`~airflow.sdk.DAG` class from the
162+
from files and folders. DAG Authors should use the :class:`~airflow.sdk.DAG` class from the
162163
airflow.sdk namespace instead.
163164

164165
.. note::
165166
The :class:`~airflow.models.dagrun.DagRun` class is used internally by Airflow for DAG run
166-
management. DAG authors should access DAG run information through the Task Context via
167+
management. DAG Authors should access DAG run information through the Task Context via
167168
:func:`~airflow.sdk.get_current_context` or use the :class:`~airflow.sdk.types.DagRunProtocol`
168169
interface.
169170

@@ -185,7 +186,7 @@ Task Instances
185186
Task instances are the individual runs of a single task in a DAG (in a DAG Run). They are available in the context
186187
passed to the execute method of the operators via the :class:`~airflow.sdk.types.RuntimeTaskInstanceProtocol` class.
187188

188-
In Airflow 3.0+, task instances are accessed through the Task Context via :func:`~airflow.sdk.get_current_context`
189+
Task instances are accessed through the Task Context via :func:`~airflow.sdk.get_current_context`
189190
Direct database access is not possible. The :class:`~airflow.sdk.types.RuntimeTaskInstanceProtocol` provides
190191
the stable interface for task instance operations.
191192

@@ -199,7 +200,7 @@ Task Instance Keys
199200
Task instance keys are unique identifiers of task instances in a DAG (in a DAG Run). A key is a tuple that consists of
200201
``dag_id``, ``task_id``, ``run_id``, ``try_number``, and ``map_index``.
201202

202-
In Airflow 3.0+, direct access to task instance keys via the :class:`~airflow.models.taskinstance.TaskInstance`
203+
Direct access to task instance keys via the :class:`~airflow.models.taskinstance.TaskInstance`
203204
model is no longer allowed from task code. Instead, use the Task Context via :func:`~airflow.sdk.get_current_context`
204205
to access task instance information.
205206

@@ -224,7 +225,7 @@ Example of accessing task instance information through Task Context:
224225
225226
.. note::
226227
The :class:`~airflow.models.taskinstancekey.TaskInstanceKey` class is used internally by Airflow
227-
for identifying task instances. DAG authors should access task instance information through the
228+
for identifying task instances. DAG Authors should access task instance information through the
228229
Task Context via :func:`~airflow.sdk.get_current_context` instead.
229230

230231

@@ -250,14 +251,14 @@ by extending them:
250251
Public Airflow utilities
251252
========================
252253

253-
When writing or extending Hooks and Operators, DAG authors and developers can
254+
When writing or extending Hooks and Operators, DAG Authors and developers can
254255
use the following classes:
255256

256257
* The :class:`~airflow.sdk.Connection`, which provides access to external service credentials and configuration.
257258
* The :class:`~airflow.sdk.Variable`, which provides access to Airflow configuration variables.
258259
* The :class:`~airflow.sdk.execution_time.xcom.XCom` which are used to access to inter-task communication data.
259260

260-
In Airflow 3.0+, Connection and Variable operations should be performed through the Task Context using
261+
Connection and Variable operations should be performed through the Task Context using
261262
:func:`~airflow.sdk.get_current_context` and the task instance's methods, or through the airflow.sdk namespace.
262263
Direct database access to :class:`~airflow.models.connection.Connection` and :class:`~airflow.models.variable.Variable`
263264
models is no longer allowed from task code.
@@ -294,7 +295,7 @@ You can read more about the public Airflow utilities in :doc:`howto/connection`,
294295
Reference for classes used for the utilities are here:
295296

296297
.. note::
297-
Connection, Variable, and XCom classes are now part of the airflow.sdk namespace in Airflow 3.0+.
298+
Connection, Variable, and XCom classes are now part of the airflow.sdk namespace.
298299
For detailed API documentation, see the `Task SDK Reference <https://airflow.apache.org/docs/task-sdk/stable/>`_.
299300

300301

@@ -478,10 +479,10 @@ implemented in the community providers.
478479

479480
Decorators
480481
==========
481-
DAG authors can use decorators to author dags using the :doc:`TaskFlow <core-concepts/taskflow>` concept.
482+
DAG Authors can use decorators to author dags using the :doc:`TaskFlow <core-concepts/taskflow>` concept.
482483
All Decorators derive from :class:`~airflow.sdk.bases.decorator.TaskDecorator`.
483484

484-
The primary decorators for DAG authors are now in the airflow.sdk namespace:
485+
The primary decorators for DAG Authors are now in the airflow.sdk namespace:
485486
:func:`~airflow.sdk.dag`, :func:`~airflow.sdk.task`, :func:`~airflow.sdk.asset`,
486487
:func:`~airflow.sdk.setup`, :func:`~airflow.sdk.task_group`, :func:`~airflow.sdk.teardown`,
487488
:func:`~airflow.sdk.chain`, :func:`~airflow.sdk.chain_linear`, :func:`~airflow.sdk.cross_downstream`,
@@ -491,7 +492,7 @@ Airflow has a set of Decorators that are considered public. You are free to exte
491492
by extending them:
492493

493494
.. note::
494-
Decorators are now part of the airflow.sdk namespace in Airflow 3.0+.
495+
Decorators are now part of the airflow.sdk namespace.
495496
For detailed API documentation, see the `Task SDK Reference <https://airflow.apache.org/docs/task-sdk/stable/>`_.
496497

497498
You can read more about creating custom Decorators in :doc:`howto/create-custom-decorator`.
@@ -541,7 +542,7 @@ but in Airflow they are not parts of the Public Interface and might change any t
541542
internal implementation detail and you should not assume they will be maintained
542543
in a backwards-compatible way.
543544

544-
**Direct metadata database access from task code is no longer allowed in Airflow 3.0+**.
545+
**Direct metadata database access from task code is no longer allowed**.
545546
Task code cannot directly access the metadata database to query DAG state, task history,
546547
or DAG runs. Instead, use one of the following alternatives:
547548

0 commit comments

Comments
 (0)