<p dir="auto">Apache Airflow version</p>
<p dir="auto"><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/apache/airflow/commit/6f8c204b21d6c01a192bda524db72517d41bf6e9/hovercard" href="https://github.com/apache/airflow/commit/6f8c204b21d6c01a192bda524db72517d41bf6e9"><tt>6f8c204</tt></a></p>
<p dir="auto">Environment</p>
<p dir="auto">OS (e.g. from /etc/os-release): Mac OS 11.3<br>
Kernel: Darwin Kernel Version 20.4.0<br>
Install tools: pip install -e .</p>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto">Tried to import valid connection json via the cli.  Got an error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="❯ echo '{&quot;sqlite_conn_id&quot;: {
    &quot;conn_type&quot;: &quot;sqlite&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;host&quot;: &quot;localhost&quot;,
    &quot;login&quot;: &quot;&quot;,
    &quot;password&quot;: null,
    &quot;schema&quot;: &quot;/usr/local/airflow/test.db&quot;,
    &quot;port&quot;: null,
    &quot;extra&quot;: &quot;&quot;
  }}' | jq . &gt; connections.json

❯ airflow connections import connections.json
Traceback (most recent call last):
  File &quot;/Users/matt/src/airflow/venv/bin/airflow&quot;, line 33, in &lt;module&gt;
    sys.exit(load_entry_point('apache-airflow', 'console_scripts', 'airflow')())
  File &quot;/Users/matt/src/airflow/airflow/__main__.py&quot;, line 40, in main
    args.func(args)
  File &quot;/Users/matt/src/airflow/airflow/cli/cli_parser.py&quot;, line 48, in command
    return func(*args, **kwargs)
  File &quot;/Users/matt/src/airflow/airflow/utils/cli.py&quot;, line 91, in wrapper
    return f(*args, **kwargs)
  File &quot;/Users/matt/src/airflow/airflow/cli/commands/connection_command.py&quot;, line 244, in connections_import
    _import_helper(args.file)
  File &quot;/Users/matt/src/airflow/airflow/cli/commands/connection_command.py&quot;, line 272, in _import_helper
    key: value for key, value in conn_values.items() if key in allowed_fields
AttributeError: 'Connection' object has no attribute 'items'"><pre class="notranslate"><code class="notranslate">❯ echo '{"sqlite_conn_id": {
    "conn_type": "sqlite",
    "description": "",
    "host": "localhost",
    "login": "",
    "password": null,
    "schema": "/usr/local/airflow/test.db",
    "port": null,
    "extra": ""
  }}' | jq . &gt; connections.json

❯ airflow connections import connections.json
Traceback (most recent call last):
  File "/Users/matt/src/airflow/venv/bin/airflow", line 33, in &lt;module&gt;
    sys.exit(load_entry_point('apache-airflow', 'console_scripts', 'airflow')())
  File "/Users/matt/src/airflow/airflow/__main__.py", line 40, in main
    args.func(args)
  File "/Users/matt/src/airflow/airflow/cli/cli_parser.py", line 48, in command
    return func(*args, **kwargs)
  File "/Users/matt/src/airflow/airflow/utils/cli.py", line 91, in wrapper
    return f(*args, **kwargs)
  File "/Users/matt/src/airflow/airflow/cli/commands/connection_command.py", line 244, in connections_import
    _import_helper(args.file)
  File "/Users/matt/src/airflow/airflow/cli/commands/connection_command.py", line 272, in _import_helper
    key: value for key, value in conn_values.items() if key in allowed_fields
AttributeError: 'Connection' object has no attribute 'items'
</code></pre></div>
<p dir="auto">Several of the tests assume that <code class="notranslate">load_connections_dict</code> returns a dict of dicts<br>
</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/6f8c204b21d6c01a192bda524db72517d41bf6e9/tests/cli/commands/test_connection_command.py#L790">airflow/tests/cli/commands/test_connection_command.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 790
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/6f8c204b21d6c01a192bda524db72517d41bf6e9">6f8c204</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="L790" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="790"></td>
          <td id="LC790" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c"># We're not testing the behavior of load_connections_dict, assume successfully reads JSON, YAML or env</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">Actually, <code class="notranslate">load_connections_dict</code> returns a dict of <code class="notranslate">Connection</code>s<br>
</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/6f8c204b21d6c01a192bda524db72517d41bf6e9/airflow/secrets/local_filesystem.py#L278">airflow/airflow/secrets/local_filesystem.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 278
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/6f8c204b21d6c01a192bda524db72517d41bf6e9">6f8c204</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="L278" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="278"></td>
          <td id="LC278" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">connection_by_conn_id</span>[<span class="pl-s1">key</span>] <span class="pl-c1">=</span> <span class="pl-en">_create_connection</span>(<span class="pl-s1">key</span>, <span class="pl-s1">secret_values</span>) </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">When we call <code class="notranslate">.items()</code> on the <code class="notranslate">Connection</code>, it fails.</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">The import is sucessful.</p>
<p dir="auto"><strong>How to reproduce it</strong>:</p>
<p dir="auto">See commands above.</p>
<p dir="auto"><strong>Anything else we need to know</strong>:</p>
<p dir="auto">This commit fixes it (I think): <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/MatrixManAtYrService/airflow/commit/51590596f96f079f166d6949a520c1b0a53f475a/hovercard" href="https://github.com/MatrixManAtYrService/airflow/commit/51590596f96f079f166d6949a520c1b0a53f475a">MatrixManAtYrService@<tt>5159059</tt></a></p>
<p dir="auto">I started making a PR, but while trying to make the tests pass I started to worry that I was on the wrong path, so I made an issue instead.</p>
<p dir="auto"><strong>Apache Airflow version</strong>: 1.10.10</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): centos 7.5</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>):Linux prod-auto-ops001 3.10.0-1062.4.1.el7.x86_64 <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="69689814" data-permission-text="Title is private" data-url="https://github.com/apache/airflow/issues/1" data-hovercard-type="pull_request" data-hovercard-url="/apache/airflow/pull/1/hovercard" href="https://github.com/apache/airflow/pull/1">#1</a> SMP Fri Oct 18 17:15:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux</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 have two environments, one is development, another is production. They uses CeleryExecutor and redis for broker, mysql for result backend and the airflow db. The only difference is production env got two worker.</p>
<p dir="auto">I passed the params, max_active_runs in my dag defination , eg:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dag = DAG(
    dag_id='test_max_active_runs',
    default_args=default_args,
    schedule_interval=None,
    start_date=airflow.utils.dates.days_ago(1),
    max_active_runs=1
)"><pre class="notranslate"><code class="notranslate">dag = DAG(
    dag_id='test_max_active_runs',
    default_args=default_args,
    schedule_interval=None,
    start_date=airflow.utils.dates.days_ago(1),
    max_active_runs=1
)
</code></pre></div>
<p dir="auto">In the dev env, when the task is scheduled, the dashboard will show 1/1 active dag runs in red color, while nothing happens in the production env.</p>
<p dir="auto">May I suppose that the setting max_active_runs is not working in my production env?</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">It should be exactly the same in the production env comparison to the dev env.</p>
<p dir="auto"><strong>How to reproduce it</strong>:<br>
Let me know if you need further information</p>