<p dir="auto">This issue is part of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="613956970" data-permission-text="Title is private" data-url="https://github.com/apache/airflow/issues/8765" data-hovercard-type="issue" data-hovercard-url="/apache/airflow/issues/8765/hovercard" href="https://github.com/apache/airflow/issues/8765">#8765</a></p>
<h2 dir="auto">Rule</h2>
<p dir="auto">Create <code class="notranslate">TaskHandlersMovedRule</code> which corresponds to</p>
<blockquote>
<p dir="auto">GCSTaskHandler has been moved, WasbTaskHandler has been moved, StackdriverTaskHandler has been moved , S3TaskHandler has been moved, ElasticsearchTaskHandler has been moved, CloudwatchTaskHandler has been  moved</p>
</blockquote>
<p dir="auto">entry in UPDATING.md. This rule should allow users to check if their current configuration needs any adjusting<br>
before migration to Airflow 2.0.</p>
<h2 dir="auto">How to guide</h2>
<p dir="auto">To implement a new rule, create a class that inherits from <code class="notranslate">airflow.upgrade.rules.base_rule.BaseRule</code>.<br>
It will be auto-registered and used by <code class="notranslate">airflow upgrade-check</code> command. The custom rule class has to have <code class="notranslate">title</code>,<br>
<code class="notranslate">description</code> properties and should implement <code class="notranslate">check</code> method which returns a list of error messages in case of<br>
incompatibility.</p>
<p dir="auto">For example:<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/ea36166961ca35fc51ddc262ec245590c3e236fb/airflow/upgrade/rules/conn_type_is_not_nullable.py#L25-L42">airflow/airflow/upgrade/rules/conn_type_is_not_nullable.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 25 to 42
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/ea36166961ca35fc51ddc262ec245590c3e236fb">ea36166</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="L25" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="25"></td>
          <td id="LC25" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">class</span> <span class="pl-v">ConnTypeIsNotNullableRule</span>(<span class="pl-v">BaseRule</span>): </td>
        </tr>

        <tr class="border-0">
          <td id="L26" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="26"></td>
          <td id="LC26" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">  </td>
        </tr>

        <tr class="border-0">
          <td id="L27" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="27"></td>
          <td id="LC27" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">title</span> <span class="pl-c1">=</span> <span class="pl-s">"Connection.conn_type is not nullable"</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L28" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="28"></td>
          <td id="LC28" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">  </td>
        </tr>

        <tr class="border-0">
          <td id="L29" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="29"></td>
          <td id="LC29" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">description</span> <span class="pl-c1">=</span> <span class="pl-s">"""<span class="pl-cce">\</span></span> </td>
        </tr>

        <tr class="border-0">
          <td id="L30" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="30"></td>
          <td id="LC30" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-cce"></span>The `conn_type` column in the `connection` table must contain content. Previously, this rule was <span class="pl-cce">\</span></span> </td>
        </tr>

        <tr class="border-0">
          <td id="L31" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="31"></td>
          <td id="LC31" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-cce"></span>enforced by application logic, but was not enforced by the database schema.</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L32" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="32"></td>
          <td id="LC32" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s"></span> </td>
        </tr>

        <tr class="border-0">
          <td id="L33" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="33"></td>
          <td id="LC33" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s">If you made any modifications to the table directly, make sure you don't have null in the conn_type column.<span class="pl-cce">\</span></span> </td>
        </tr>

        <tr class="border-0">
          <td id="L34" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="34"></td>
          <td id="LC34" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-cce"></span>"""</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L35" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="35"></td>
          <td id="LC35" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">  </td>
        </tr>

        <tr class="border-0">
          <td id="L36" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="36"></td>
          <td id="LC36" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-en">@<span class="pl-s1">provide_session</span></span> </td>
        </tr>

        <tr class="border-0">
          <td id="L37" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="37"></td>
          <td id="LC37" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">def</span> <span class="pl-en">check</span>(<span class="pl-s1">self</span>, <span class="pl-s1">session</span><span class="pl-c1">=</span><span class="pl-c1">None</span>): </td>
        </tr>

        <tr class="border-0">
          <td id="L38" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="38"></td>
          <td id="LC38" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1">invalid_connections</span> <span class="pl-c1">=</span> <span class="pl-s1">session</span>.<span class="pl-en">query</span>(<span class="pl-v">Connection</span>).<span class="pl-en">filter</span>(<span class="pl-v">Connection</span>.<span class="pl-s1">conn_type</span>.<span class="pl-en">is_</span>(<span class="pl-c1">None</span>)) </td>
        </tr>

        <tr class="border-0">
          <td id="L39" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="39"></td>
          <td id="LC39" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-k">return</span> ( </td>
        </tr>

        <tr class="border-0">
          <td id="L40" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="40"></td>
          <td id="LC40" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">             <span class="pl-s">'Connection&lt;id={}", conn_id={}&gt; have empty conn_type field.'</span>.<span class="pl-en">format</span>(<span class="pl-s1">conn</span>.<span class="pl-s1">id</span>, <span class="pl-s1">conn</span>.<span class="pl-s1">conn_id</span>) </td>
        </tr>

        <tr class="border-0">
          <td id="L41" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="41"></td>
          <td id="LC41" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">             <span class="pl-k">for</span> <span class="pl-s1">conn</span> <span class="pl-c1">in</span> <span class="pl-s1">invalid_connections</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L42" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="42"></td>
          <td id="LC42" 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>
<p dir="auto"><strong>Remember</strong> to open the PR against <code class="notranslate">v1-10-test</code> branch.</p>
<h3 dir="auto">Apache Airflow Provider(s)</h3>
<p dir="auto">celery</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto">apache-airflow==2.1.3<br>
apache-airflow-providers-celery==2.1.0<br>
celery==5.1.2<br>
flower==1.0.0</p>
<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.1.3 (latest released)</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Ubuntu 20.04.1 LTS (Focal Fossa)</p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Virtualenv installation</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto">executor = CeleryExecutor</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">When issuing <strong>apache celery worker</strong> or <strong>apache celery flower</strong> I receive the following error:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "/home/airflow/sandbox/bin/airflow", line 8, in <br>
sys.exit(main())<br>
File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/<strong>main</strong>.py", line 40, in main<br>
args.func(args)<br>
File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/cli/cli_parser.py", line 47, in command<br>
func = import_string(import_path)<br>
File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/utils/module_loading.py", line 32, in import_string<br>
module = import_module(module_path)<br>
File "/usr/lib/python3.8/importlib/<strong>init</strong>.py", line 127, in import_module<br>
return _bootstrap._gcd_import(name[level:], package, level)<br>
File "", line 1014, in _gcd_import<br>
File "", line 991, in _find_and_load<br>
File "", line 975, in _find_and_load_unlocked<br>
File "", line 671, in _load_unlocked<br>
File "", line 848, in exec_module<br>
File "", line 219, in _call_with_frames_removed<br>
File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/cli/commands/celery_command.py", line 29, in <br>
from flower.command import FlowerCommand<br>
ImportError: cannot import name 'FlowerCommand' from 'flower.command' (/home/airflow/sandbox/lib/python3.8/site-packages/flower/command.py)</p>
<h3 dir="auto">What you expected to happen</h3>
<p dir="auto">I would expect the Flower UI to be loaded or a celery worker to be started.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Configure apache-airflow with the CeleryExecutor<br>
Issue the following commands: <strong>apache celery worker</strong> or <strong>apache celery flower</strong></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>