title: How to force a Airflow Task to restart at the new scheduling date?
body: <p>I have this simple Airflow DAG:</p>
  <pre><code>from airflow import DAG
  from datetime import datetime, timedelta
  from airflow.operators.bash import BashOperator
  with DAG(&quot;Second Dag&quot;, 
          start_date=datetime(2022,1,1), 
          schedule_interval=&quot;0 5 * * *&quot;, 
          catchup=False,
          max_active_runs=1
          ) as dag:
  
      task_a = BashOperator(
          task_id=&quot;ToRepeat&quot;,
          bash_command=&quot;cd /home/xdf/local/ &amp;&amp; (env/bin/python workflow/test1.py)&quot;,
          retries =1,
      )
  </code></pre>
  <p>The task takes a variable amount of time between one run and the other, and I don't have any guarantee that it will be finished within the 5 A.M of the next day.
  If the task is still running when a new task is scheduled to start, I need to kill the old one before it starts running.</p>
  <p>How can I design Airflow DAG to automatically kill the old task if it's still running when a new task is scheduled to start?</p>
  <p>More details:
  I am looking for something dynamic. The old DAG should be killed only when the new DAG is starting. If, for any reason, the new DAG does not start for one week, then old DAG should be able to run for an entire week. That's why using a timeout is sub-optimal</p>