ashb commented on code in PR #54225:
URL: https://github.com/apache/airflow/pull/54225#discussion_r2284983966


##########
task-sdk/src/airflow/sdk/definitions/taskgroup.py:
##########
@@ -39,7 +39,6 @@
     TaskAlreadyInTaskGroup,
 )
 from airflow.sdk.definitions._internal.node import DAGNode, validate_group_key
-from airflow.sdk.exceptions import AirflowDagCycleException

Review Comment:
   Was this causing problems having the import at the top level?



##########
airflow-core/src/airflow/models/dagbag.py:
##########
@@ -549,10 +544,15 @@ def bag_dag(self, dag: DAG):
                 )
             self.dags[dag.dag_id] = dag
             self.log.debug("Loaded DAG %s", dag)
-        except (AirflowDagCycleException, AirflowDagDuplicatedIdException):
-            # There was an error in bagging the dag. Remove it from the list 
of dags
+        except AirflowDagDuplicatedIdException:
             self.log.exception("Exception bagging dag: %s", dag.dag_id)
             raise
+        except Exception as e:
+            if type(e).__name__ == "AirflowDagCycleException":
+                self.log.exception("Cycle detected in DAG: %s", dag.dag_id)

Review Comment:
   Why did you do this rather than the import/except approach?



##########
airflow-core/src/airflow/models/dagbag.py:
##########
@@ -549,10 +544,15 @@ def bag_dag(self, dag: DAG):
                 )
             self.dags[dag.dag_id] = dag
             self.log.debug("Loaded DAG %s", dag)
-        except (AirflowDagCycleException, AirflowDagDuplicatedIdException):
-            # There was an error in bagging the dag. Remove it from the list 
of dags
+        except AirflowDagDuplicatedIdException:
             self.log.exception("Exception bagging dag: %s", dag.dag_id)
             raise
+        except Exception as e:
+            if type(e).__name__ == "AirflowDagCycleException":
+                self.log.exception("Cycle detected in DAG: %s", dag.dag_id)

Review Comment:
   Ah, the deprecated imports were fixed in a drive by by This was fine as it 
was, and was fixed as a drive by in 
https://github.com/apache/airflow/commit/a964e0fdee135e3484ed6ca5cadbacca764d4919



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