<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.3.0 (latest released)</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">Running a standalone Dag Processor instance with <code class="notranslate">airflow dag-processor</code> throws the following exception:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Standalone DagProcessor is not supported when using sqlite."><pre class="notranslate"><code class="notranslate">Standalone DagProcessor is not supported when using sqlite.
</code></pre></div>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">The <code class="notranslate">airflow dag-processor</code> should start without an exception in case of Postgres database</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">The error is in the following line: </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/6f146e721c81e9304bf7c0af66fc3d203d902dab/airflow/cli/commands/dag_processor_command.py#L53">airflow/airflow/cli/commands/dag_processor_command.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 53
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/6f146e721c81e9304bf7c0af66fc3d203d902dab">6f146e7</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="L53" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="53"></td>
          <td id="LC53" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">sql_conn</span>: <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-s1">conf</span>.<span class="pl-en">get</span>(<span class="pl-s">'core'</span>, <span class="pl-s">'sql_alchemy_conn'</span>).<span class="pl-en">lower</span>() </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">It should be</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="sql_conn: str = conf.get('database', 'sql_alchemy_conn').lower() "><pre class="notranslate"><span class="pl-s1">sql_conn</span>: <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-s1">conf</span>.<span class="pl-en">get</span>(<span class="pl-s">'database'</span>, <span class="pl-s">'sql_alchemy_conn'</span>).<span class="pl-en">lower</span>() </pre></div>
<p dir="auto">due to the change in the configuration file done in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1169624280" data-permission-text="Title is private" data-url="https://github.com/apache/airflow/issues/22284" data-hovercard-type="pull_request" data-hovercard-url="/apache/airflow/pull/22284/hovercard" href="https://github.com/apache/airflow/pull/22284">#22284</a></p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Ubuntu 20.04</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">Virtualenv installation</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"> 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>
<p dir="auto"><strong>Apache Airflow version</strong>: 2.0.0rc3</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>: Linux</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): Ubuntu</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>):</li>
<li><strong>Install tools</strong>:</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto">After shutting down the scheduler, while tasks were in running state, trying to restart the scheduler results in pk violations..</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/home/jcoder/git/airflow_2.0/pyenv/lib/python3.7/site-packages/sqlalchemy/engine/base.py&quot;, line 1277, in _execute_context
    cursor, statement, parameters, context
  File &quot;/home/jcoder/git/airflow_2.0/pyenv/lib/python3.7/site-packages/sqlalchemy/engine/default.py&quot;, line 593, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint &quot;dag_run_dag_id_run_id_key&quot;
DETAIL:  Key (dag_id, run_id)=(example_task_group, scheduled__2020-12-14T04:31:00+00:00) already exists."><pre lang="[2020-12-15" class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "/home/jcoder/git/airflow_2.0/pyenv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    cursor, statement, parameters, context
  File "/home/jcoder/git/airflow_2.0/pyenv/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "dag_run_dag_id_run_id_key"
DETAIL:  Key (dag_id, run_id)=(example_task_group, scheduled__2020-12-14T04:31:00+00:00) already exists.
</code></pre></div>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">Scheduler restarts and picks up where it left off.</p>
<p dir="auto"><strong>How to reproduce it</strong>:</p>
<p dir="auto">Set example dag ( I used task_group) to schedule_interval <code class="notranslate">* * * * *</code> and start the scheduler and let it run for a few minutes.<br>
Shut down the scheduler<br>
Attempt to restart the scheduler</p>
<p dir="auto"><strong>Anything else we need to know</strong>:<br>
I came across this doing testing using the LocalExecutor in a virtual env. If no else is able to reproduce it, I'll try again in a clean virtual env.</p>