kaxil edited a comment on issue #6549: [AIRFLOW-5880] Enforce unique task ids
URL: https://github.com/apache/airflow/pull/6549#issuecomment-566285839
 
 
   @Acehaidrey 
   
   > To be sure, it seems we cannot enforce if two tasks that are the same 
operator with the same task_id are in the dag, it will fail to catch this. Is 
this the experience expected?
   
   No that is not true.
   
   For example, the following would raise an error:
   
   ```python
   from airflow.utils import timezone
   from airflow.operators.bash_operator import BashOperator
   
   with DAG("test_dag", start_date=timezone.datetime(2016, 1, 1)) as dag:
       t1 = BashOperator(task_id="t1", bash_command="true")
       t2 = BashOperator(task_id="t1", bash_command="false")
       t1 >> t2
   ```
   
   Error:
   
   ```
   airflow.exceptions.DuplicateTaskIdFound: Task id 't1' has already been added 
to the DAG
   ```

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


With regards,
Apache Git Services

Reply via email to