<p dir="auto"><strong>Apache Airflow version</strong>: 2.0.0</p>
<p dir="auto"><strong>Kubernetes version (if you are using kubernetes)</strong> (use <code class="notranslate">kubectl version</code>):</p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>:</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): redhat 7.9</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): 3.10.0-1160.11.1.el7.x86_64</li>
<li><strong>Install tools</strong>: pip</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto">I cleared a success DAG run and it failed to be scheduled again with the following error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{scheduler_job.py:1639} INFO - Run scheduled__2021-02-02T16:00:00+00:00 of some_job has timed-out"><pre class="notranslate"><code class="notranslate">{scheduler_job.py:1639} INFO - Run scheduled__2021-02-02T16:00:00+00:00 of some_job has timed-out
</code></pre></div>
<p dir="auto">After removing dagrun_timeout, the same dag run can be rescheduled.</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">I expect "timeout" is counted from the moment the DAG is reset.</p>
<p dir="auto"><strong>Anything else we need to know</strong>:</p>
<p dir="auto">I can reproduce it with the following code. Not sure if it is the intended behavior.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from airflow import DAG
from airflow.operators.dummy import DummyOperator
import pendulum
with DAG(&quot;test_timeout&quot;,
    default_args={'owner': 'airflow'},
    start_date= pendulum.yesterday(),
    schedule_interval='@daily',
    # add the following parameter after the first run is complete and then clear the success run
    # dagrun_timeout=pendulum.duration(minutes=1),
) as dag:
    DummyOperator(task_id='dummy')"><pre class="notranslate"><code class="notranslate">from airflow import DAG
from airflow.operators.dummy import DummyOperator
import pendulum
with DAG("test_timeout",
    default_args={'owner': 'airflow'},
    start_date= pendulum.yesterday(),
    schedule_interval='@daily',
    # add the following parameter after the first run is complete and then clear the success run
    # dagrun_timeout=pendulum.duration(minutes=1),
) as dag:
    DummyOperator(task_id='dummy')
</code></pre></div>
<p dir="auto"><strong>Apache Airflow version</strong>: 2.0.0</p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>:</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): Amazon Linux 2</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): Linux</li>
<li><strong>Install tools</strong>:</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>

<p dir="auto">Clearing a DagRun that has an <code class="notranslate">execution_date</code> in the past where the time difference between now and that <code class="notranslate">execution_date</code> is greater than the DagRun timeout leads to the DagRun failing on clear, and not running.</p>
<p dir="auto"><strong>What you expected to happen</strong>:<br>
The DagRun should enter the Running state</p>

<p dir="auto">I anticipate this is a bug where the existing DagRun duration is not being reset and so the new DagRun is timing out as soon as it starts.</p>
<p dir="auto"><strong>How to reproduce it</strong>:</p>

<p dir="auto">Create an DAG with a DagRun timeout. Trigger said DAG. Wait for <code class="notranslate">DagRun timeout + 1</code> minutes and then clear said DagRun. New DagRun will immediately fail.</p>
<p dir="auto"><strong>Anything else we need to know</strong>:<br>
This occurs regardless of whether the DAG/Task succeeded or failed. Also, any DagRun that has timed out can never be cleared.</p>