reubenvanammers commented on a change in pull request #4156: [AIRFLOW-3314]
Changed auto inlets feature to work as described
URL: https://github.com/apache/airflow/pull/4156#discussion_r248929437
##########
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:
Hey @bolkedebruin, I changed the logic a while ago on how the database was
called, so it will only do a single db call. Would you mind having another
look?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services