airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] potiuk commented on a change in pull request #6175: [AIRFLOW-5545] Fixes recursion in DAG cycle testing
Date Tue, 24 Sep 2019 11:34:26 GMT
potiuk commented on a change in pull request #6175: [AIRFLOW-5545] Fixes recursion in DAG cycle
testing
URL: https://github.com/apache/airflow/pull/6175#discussion_r327562210
 
 

 ##########
 File path: airflow/models/dag.py
 ##########
 @@ -1467,22 +1467,26 @@ def _test_cycle_helper(self, visit_map, task_id):
         """
         from airflow.models.dagbag import DagBag  # Avoid circular imports
 
-        # print('Inspecting %s' % task_id)
-        if visit_map[task_id] == DagBag.CYCLE_DONE:
-            return False
-
-        visit_map[task_id] = DagBag.CYCLE_IN_PROGRESS
-
-        task = self.task_dict[task_id]
-        for descendant_id in task.get_direct_relative_ids():
-            if visit_map[descendant_id] == DagBag.CYCLE_IN_PROGRESS:
-                msg = "Cycle detected in DAG. Faulty task: {0} to {1}".format(
-                    task_id, descendant_id)
+        path, visited = [task_id], []
+
+        while path:
+            current_task_id = path.pop()
+            if visit_map[current_task_id] == DagBag.CYCLE_DONE:
+                return False
 
 Review comment:
   return False -> return
   
   The return value does not seem to be checked and there is no 'return True'

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message