You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/11/12 13:24:04 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #6549: [AIRFLOW-5880] Enforce unique task ids

kaxil commented on a change in pull request #6549: [AIRFLOW-5880] Enforce unique task ids
URL: https://github.com/apache/airflow/pull/6549#discussion_r345201436
 
 

 ##########
 File path: airflow/models/baseoperator.py
 ##########
 @@ -528,7 +528,7 @@ def dag(self, dag):
         elif self.has_dag() and self.dag is not dag:
             raise AirflowException(
                 "The DAG assigned to {} can not be changed.".format(self))
-        elif self.task_id not in dag.task_dict:
+        elif self.task_id:
 
 Review comment:
   You mean like this:
   
   ```python
           elif self.task_id not in dag.task_dict:
               dag.add_task(self)
           elif self.task_id in dag.task_dict:
               raise DuplicateTaskIdFound("Task id '{}' has already been added to the DAG".format(self.task_id))
   ```
   
   I removed `not in dag.task_dict` as either the task is in task_dict or not I let it go to `add_task` where we already validate it.
   
   I am open to changing it either way so let me know which according to your makes more sense !

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services