airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] bolkedebruin commented on a change in pull request #4156: [AIRFLOW-3314] Changed auto inlets feature to work as described
Date Sun, 25 Nov 2018 14:16:25 GMT
bolkedebruin commented on a change in pull request #4156: [AIRFLOW-3314] Changed auto inlets
feature to work as described
URL: https://github.com/apache/incubator-airflow/pull/4156#discussion_r236074966
 
 

 ##########
 File path: airflow/lineage/__init__.py
 ##########
 @@ -110,26 +114,31 @@ def wrapper(self, context, *args, **kwargs):
                       for i in inlets]
             self.inlets.extend(inlets)
 
-        if self._inlets['auto']:
-            # dont append twice
-            task_ids = set(self._inlets['task_ids']).symmetric_difference(
-                self.upstream_task_ids
-            )
-            inlets = self.xcom_pull(context,
-                                    task_ids=task_ids,
-                                    dag_id=self.dag_id,
-                                    key=PIPELINE_OUTLETS)
-            inlets = [item for sublist in inlets if sublist for item in sublist]
-            inlets = [DataSet.map_type(i['typeName'])(data=i['attributes'])
-                      for i in inlets]
-            self.inlets.extend(inlets)
-
-        if len(self._inlets['datasets']) > 0:
-            self.inlets.extend(self._inlets['datasets'])
+        if self._inlets["auto"]:
+            visited_task_ids = set(self._inlets["task_ids"])  # prevent double counting of
outlets
+            stack = {self.task_id}
+            while stack:
+                task_id = stack.pop()
+                task = self._dag.task_dict[task_id]
+                visited_task_ids.add(task_id)
+                inlets = self.xcom_pull(
 
 Review comment:
   I suggest getting all upstream tasks and using a topological sort to have the right order.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message