reubenvanammers 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_r238060986
##########
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:
Hi @bolkedebruin I've squashed the commits, and changed the logic slightly
so that it doesn't do a call on the initial task id xcom. Is there a good way
to profile the possible slowdown from this commit?
----------------------------------------------------------------
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