<p dir="auto">I recently upgraded my Airflow version from 1.10.10 to 2.0.0, and noticed the scheduler are failing and exiting after upgrade. After checking the log, it's suggest the duplicated entry for records in <code class="notranslate">dag_run</code> table. It tries to insert dag runs already executed before the upgrade.<br>
After some digging, I found it related to how the scheduler calculate the next execution_date: it picks the last dag_run with <code class="notranslate">run_type</code> of scheduled, however the new <code class="notranslate">DagRunType.SCHEDULED</code> is not the same as "scheduled" as previously was. as <code class="notranslate">DagRunType</code> is an enum type, <code class="notranslate">DagRunType.SCHEDULED</code> is actually converted to "DagRunType.SCHEDULED" not "scheduled".<br>
It looks like not an intended design but a mistake. change of <code class="notranslate">DagRunType.SCHEDULED</code> to <code class="notranslate">DagRunType.SCHEDULED.value</code> will simply solve this issue.</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/apache/airflow/blob/ab5f770bfcd8c690cbe4d0825896325aca0beeca/airflow/jobs/scheduler_job.py#L1559-L1568">airflow/airflow/jobs/scheduler_job.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 1559 to 1568
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/ab5f770bfcd8c690cbe4d0825896325aca0beeca">ab5f770</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L1559" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1559"></td>
          <td id="LC1559" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">dag</span>.<span class="pl-en">create_dagrun</span>( </td>
        </tr>

        <tr class="border-0">
          <td id="L1560" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1560"></td>
          <td id="LC1560" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">run_type</span><span class="pl-c1">=</span><span class="pl-v">DagRunType</span>.<span class="pl-v">SCHEDULED</span>, </td>
        </tr>

        <tr class="border-0">
          <td id="L1561" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1561"></td>
          <td id="LC1561" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">execution_date</span><span class="pl-c1">=</span><span class="pl-s1">dag_model</span>.<span class="pl-s1">next_dagrun</span>, </td>
        </tr>

        <tr class="border-0">
          <td id="L1562" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1562"></td>
          <td id="LC1562" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">start_date</span><span class="pl-c1">=</span><span class="pl-s1">timezone</span>.<span class="pl-en">utcnow</span>(), </td>
        </tr>

        <tr class="border-0">
          <td id="L1563" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1563"></td>
          <td id="LC1563" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-v">State</span>.<span class="pl-v">RUNNING</span>, </td>
        </tr>

        <tr class="border-0">
          <td id="L1564" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1564"></td>
          <td id="LC1564" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">external_trigger</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, </td>
        </tr>

        <tr class="border-0">
          <td id="L1565" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1565"></td>
          <td id="LC1565" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">session</span><span class="pl-c1">=</span><span class="pl-s1">session</span>, </td>
        </tr>

        <tr class="border-0">
          <td id="L1566" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1566"></td>
          <td id="LC1566" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">dag_hash</span><span class="pl-c1">=</span><span class="pl-s1">dag_hash</span>, </td>
        </tr>

        <tr class="border-0">
          <td id="L1567" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1567"></td>
          <td id="LC1567" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">creating_job_id</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">id</span>, </td>
        </tr>

        <tr class="border-0">
          <td id="L1568" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1568"></td>
          <td id="LC1568" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> ) </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.6.0</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">Worker pod template file doesn't have an option to add priorityClassName.</p>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">Airflow workers deployment however has the option to add it via the override airflow.workers.priorityClassName . We should reuse this for the worker pod template file too.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Trying to add a priorityClassName for airflow worker pod doesnt work. Unless we override the whole worker pod template with our own. But that is not preferrable as we will need to duplicate a lot of the existing template file.</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Rhel8</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Official Apache Airflow Helm Chart</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Anything else</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>