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/12/16 22:59:24 UTC

[GitHub] [airflow] kaxil edited a comment on issue #6549: [AIRFLOW-5880] Enforce unique task ids

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


With regards,
Apache Git Services