uranusjr commented on code in PR #33988:
URL: https://github.com/apache/airflow/pull/33988#discussion_r1312716905
##########
airflow/models/baseoperator.py:
##########
@@ -1107,9 +1107,11 @@ def dag(self, dag: DAG | None):
if self.__from_mapped:
pass # Don't add to DAG -- the mapped task takes the place.
- elif self.task_id not in dag.task_dict:
- dag.add_task(self)
- elif self.task_id in dag.task_dict and dag.task_dict[self.task_id] is
not self:
+ elif (
+ self.task_id not in dag.task_dict
+ or self.task_id in dag.task_dict
+ and dag.task_dict[self.task_id] is not self
+ ):
Review Comment:
```suggestion
elif (
self.task_id not in dag.task_dict
or dag.task_dict[self.task_id] is not self
):
```
or just
```suggestion
elif dag.task_dict.get(self.task_id) is not self:
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]