title: How to set a number as retry condition in airflow DAG?
body: <p>In my <code>Airflow DAG</code> i have 4 <code>tasks</code></p>
  <pre><code>task_1 &gt;&gt; [task_2,task_3]&gt;&gt; task_4
  </code></pre>
  <p><code>task_4</code> runs only after a successful run of both <code>task_2</code> and <code>task_3</code></p>
  <p>How do i set a condition such as :</p>
  <p>if <code>task_2</code> fails, retry <code>task_2</code> after 2 minutes and stop retrying after the 5th attempt</p>
  <p>This is my code :</p>
  <pre><code>from airflow.models import DAG
  from airflow.utils.dates import days_ago
  from airflow.operators.python_operator import PythonOperator
  
  args={
      'owner' : 'Anti',
      'start_date':days_ago(1)# 1 means yesterday
  }
  
  dag = DAG(dag_id='my_sample_dag',default_args=args,schedule_interval='15 * * * *')
  
  def func1(**context):
      print(&quot;ran task 1&quot;)
  
  def func2(**context):
      print(&quot;ran task 2&quot;)
  
  def func3(**context):
      print(&quot;ran task 3&quot;)
  
  def func4(**context):
      print(&quot;ran task 4&quot;)
  
  with dag:
      task_1=PythonOperator(
          task_id='task1',
          python_callable=func1,
          provide_context=True,
          
      )
      task_2=PythonOperator(
          task_id='task2',
          python_callable=func2,
          provide_context=True 
      )
      task_3=PythonOperator(
          task_id='task3',
          python_callable=func3,
          provide_context=True 
      )
      task_4=PythonOperator(
          task_id='task4',
          python_callable=func4,
          provide_context=True 
      )
  
  task_1 &gt;&gt; [task_2,task_3]&gt;&gt; task_4 # t2,t3 runs parallel right after t1 has ran
  
  </code></pre>