ffinfo commented on a change in pull request #4396: [AIRFLOW-3585] - Add edges 
to database
URL: https://github.com/apache/airflow/pull/4396#discussion_r259609694
 
 

 ##########
 File path: airflow/models/__init__.py
 ##########
 @@ -4019,17 +4073,50 @@ def create_dagrun(self,
             conf=conf,
             state=state
         )
+
+        dag_model = DagModel.get_dagmodel(self.dag_id)
+
+        tis = self.create_tis(execution_date)
+        # Setting graph_id temparary on -1, will set set later.
+        edges = self.create_edges(graph_id=-1)
+
+        last_dagrun = 
dag_model.get_last_dagrun(include_externally_triggered=True)
+        if last_dagrun is None:
+            is_dag_unchanged = False
+        else:
+            last_edges = DagEdge.fetch_edges(self.dag_id, last_dagrun.graph_id)
+
+            # Compare edges from last run
+            prev_edges = [(edge.task_from, edge.task_to) for edge in 
last_edges]
+            current_edges = [(edge.task_from, edge.task_to) for edge in edges]
+            is_dag_unchanged = len(current_edges) == len(prev_edges)
+            is_dag_unchanged &= set(current_edges) == set(prev_edges)
 
 Review comment:
   I do agree but changed this because of other comments, I will switch to your 
version ;)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to