kaxil commented on code in PR #73991:
URL: https://github.com/apache/airflow/pull/73991#discussion_r4153539339
##########
providers/common/ai/src/airflow/providers/common/ai/observability.py:
##########
@@ -121,15 +121,30 @@ def build_run_identity_attributes(ti: Any) -> dict[str,
Any]:
Reuses core's task-span attribute keys (see ``_make_task_span``) so agent
spans filter identically to the task span they nest under, plus the
per-attempt task-instance id as the run join key carried on every span.
+ Airflow 2 task instances have no id, so the attribute is left out there.
"""
- return {
+ attributes: dict[str, Any] = {
"airflow.dag_id": ti.dag_id,
"airflow.task_id": ti.task_id,
"airflow.dag_run.run_id": ti.run_id,
"airflow.task_instance.try_number": ti.try_number,
"airflow.task_instance.map_index": ti.map_index if ti.map_index is not
None else -1,
- "airflow.task_instance.id": str(ti.id),
}
+ if (ti_id := getattr(ti, "id", None)) is not None:
+ attributes["airflow.task_instance.id"] = str(ti_id)
+ return attributes
+
+
+def task_instance_run_key(ti: Any) -> str:
Review Comment:
Renamed to `make_task_instance_run_key` in b55be6a8f0a.
##########
providers/common/ai/docs/installation.rst:
##########
@@ -62,21 +62,50 @@ package each extra installs.
Features gated on the Airflow version
-------------------------------------
-The provider runs on Airflow 3.0, but some features need a newer core:
+The provider runs on Airflow 2.11, but some features need a newer core:
.. list-table::
:header-rows: 1
:widths: 60 40
* - Feature
- Needs
+ * - The ``skills`` and ``git`` extras (``apache-airflow-providers-git``
needs Airflow 3)
+ - Airflow 3.0
* - :doc:`Approval gates <approval_gates>` and :doc:`HITL review
<hitl_review>`
- Airflow 3.1
+ * - The **Model** field in the connection form; on older cores put the
model in
+ **Extra**, for example ``{"model": "openai:gpt-5"}``
+ - Airflow 3.2
* - :doc:`Retry policies <retry_policies>`
- Airflow 3.3
* - :doc:`Durable execution <durable_execution>` without configuring
``[common.ai] durable_cache_path`` (the task state store)
- Airflow 3.3
+ * - :doc:`Tool approval <tool_approval>` that pauses the task; on older
cores a tool
+ marked for approval fails the task
+ - Airflow 3.3
+ * - A :doc:`structured output <structured_output>` reaching downstream
tasks as the
+ Pydantic model; on older cores it arrives as a ``dict``
+ - Airflow 3.3
+
+Airflow 2
Review Comment:
Agreed, the heading now reads "Airflow 2.11". The provider's floor is
`apache-airflow>=2.11.0`, so 2.10 and earlier won't install it.
##########
providers/common/compat/tests/unit/common/compat/test__set_during_execution.py:
##########
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import pytest
+
+from airflow.providers.common.compat import sdk
+
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
+
+pytestmark = pytest.mark.skipif(AIRFLOW_V_3_0_PLUS, reason="The stand-in is
only used on Airflow 2")
+
+if not AIRFLOW_V_3_0_PLUS:
+ from airflow.providers.common.compat._set_during_execution import
SET_DURING_EXECUTION
+ from airflow.serialization.helpers import serialize_template_field
+ from airflow.utils.types import ArgNotSet
Review Comment:
Thanks, added in b55be6a8f0a. That was the only mypy error in the CI run.
--
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]