potiuk commented on code in PR #41390:
URL: https://github.com/apache/airflow/pull/41390#discussion_r1721452951


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -495,8 +495,9 @@ def _get_ti_pod_labels(context: Context | None = None, 
include_try_number: bool
         if include_try_number:
             labels.update(try_number=ti.try_number)
         # In the case of sub dags this is just useful
-        if context["dag"].parent_dag:
-            labels["parent_dag_id"] = context["dag"].parent_dag.dag_id
+        if getattr(context["dag"], "parent_dag", False):
+            labels["parent_dag_id"] = context["dag"].parent_dag.dag_id  # 
type: ignore[attr-defined]

Review Comment:
   But you are quite right - we shouls  (@kaxil?) likely add some flag or at 
least comment to mark it as removable when we drop Airflow 2 compatibility for 
providers.



##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -495,8 +495,9 @@ def _get_ti_pod_labels(context: Context | None = None, 
include_try_number: bool
         if include_try_number:
             labels.update(try_number=ti.try_number)
         # In the case of sub dags this is just useful
-        if context["dag"].parent_dag:
-            labels["parent_dag_id"] = context["dag"].parent_dag.dag_id
+        if getattr(context["dag"], "parent_dag", False):
+            labels["parent_dag_id"] = context["dag"].parent_dag.dag_id  # 
type: ignore[attr-defined]

Review Comment:
   But you are quite right - we should  (@kaxil?) likely add some flag or at 
least comment to mark it as removable when we drop Airflow 2 compatibility for 
providers.



-- 
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]

Reply via email to