Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to override the arguement of a particular task in airflow DAG

I have a DAG which contains two tasks.The Dag has been created like below:

default_args = {
    'catchup': False,
    'depends_on_past': False,
    'start_date': datetime(2022, 1, 30),
    'retries': '2',
    'retry_delay': timedelta(minutes=3),
    'queue': us_constants.CELERY_QUEUE
}


 with DAG(dag.dag_id+'.'+task_id, default_args=default_args, schedule_interval=dag.schedule_interval) as temp_dag:
    
   t0 = DummyOperator(task_id='t0')
   
   t1 = DummyOperator(task_id='t1')

Now I want to overide the value of retries from 2 to 3 for t1 in the same DAG which contains default arguements of retries as 2

How can I do it.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Simply do:

t1 = DummyOperator(task_id='t1', retries=3)

parameters passed on operator level take precedence over values set in default_args.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading