<h1 dir="auto">Checklist</h1>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>
<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="201701532" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/3772" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/3772/hovercard" href="https://github.com/celery/celery/issues/3772">#3772</a></li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>: <code class="notranslate">celery:4.3.0 (rhubarb)</code></p>
<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="software -&gt; celery:4.3.0 (rhubarb) kombu:4.6.1 py:3.7.3
            billiard:3.6.0.0 redis:3.2.1
platform -&gt; system:Darwin arch:64bit
            kernel version:18.6.0 imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:redis results:disabled

BROKER_URL: 'redis://localhost:6379/0'
CELERY_DEFAULT_QUEUE: 'test'"><pre class="notranslate"><code class="notranslate">software -&gt; celery:4.3.0 (rhubarb) kombu:4.6.1 py:3.7.3
            billiard:3.6.0.0 redis:3.2.1
platform -&gt; system:Darwin arch:64bit
            kernel version:18.6.0 imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:redis results:disabled

BROKER_URL: 'redis://localhost:6379/0'
CELERY_DEFAULT_QUEUE: 'test'
</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="amqp==2.5.0
billiard==3.6.0.0
celery==4.3.0
kombu==4.6.1
pytz==2019.1
redis==3.2.1
vine==1.3.0"><pre class="notranslate"><code class="notranslate">amqp==2.5.0
billiard==3.6.0.0
celery==4.3.0
kombu==4.6.1
pytz==2019.1
redis==3.2.1
vine==1.3.0
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from celery import Celery


class BaseConfig:
    BROKER_URL = 'redis://localhost:6379/0'
    CELERY_TASK_DEFAULT_QUEUE = 'test'

celery_app = Celery()
celery_app.config_from_object(BaseConfig)

@celery_app.task
def simple_task():
    raise Exception(&quot;Testing Celery exception&quot;)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-v">Celery</span>


<span class="pl-k">class</span> <span class="pl-v">BaseConfig</span>:
    <span class="pl-v">BROKER_URL</span> <span class="pl-c1">=</span> <span class="pl-s">'redis://localhost:6379/0'</span>
    <span class="pl-v">CELERY_TASK_DEFAULT_QUEUE</span> <span class="pl-c1">=</span> <span class="pl-s">'test'</span>

<span class="pl-s1">celery_app</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>()
<span class="pl-s1">celery_app</span>.<span class="pl-en">config_from_object</span>(<span class="pl-v">BaseConfig</span>)

<span class="pl-en">@<span class="pl-s1">celery_app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">simple_task</span>():
    <span class="pl-k">raise</span> <span class="pl-v">Exception</span>(<span class="pl-s">"Testing Celery exception"</span>)</pre></div>
<p dir="auto">Then run with cmd:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery worker -A app:celery_app -l debug -f celery.log"><pre class="notranslate"><code class="notranslate">celery worker -A app:celery_app -l debug -f celery.log
</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">I expect the routing <code class="notranslate">key=test</code> and <code class="notranslate">exchange=test</code>.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">The configuration <code class="notranslate">CELERY_TASK_DEFAULT_QUEUE = 'test'</code> is not picked up and defaults are used instead:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" -------------- celery@Olegs-MBP.homenet.telecomitalia.it v4.3.0 (rhubarb)
---- **** ----- 
--- * ***  * -- Darwin-18.6.0-x86_64-i386-64bit 2019-06-09 01:15:55
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .&gt; app:         __main__:0x10d316518
- ** ---------- .&gt; transport:   redis://localhost:6379/0
- ** ---------- .&gt; results:     disabled://
- *** --- * --- .&gt; concurrency: 8 (prefork)
-- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .&gt; celery           exchange=celery(direct) key=celery
                

[tasks]
  . app.simple_task
  . celery.accumulate
  . celery.backend_cleanup
  . celery.chain
  . celery.chord
  . celery.chord_unlock
  . celery.chunks
  . celery.group
  . celery.map
  . celery.starmap"><pre class="notranslate"><code class="notranslate"> -------------- celery@Olegs-MBP.homenet.telecomitalia.it v4.3.0 (rhubarb)
---- **** ----- 
--- * ***  * -- Darwin-18.6.0-x86_64-i386-64bit 2019-06-09 01:15:55
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .&gt; app:         __main__:0x10d316518
- ** ---------- .&gt; transport:   redis://localhost:6379/0
- ** ---------- .&gt; results:     disabled://
- *** --- * --- .&gt; concurrency: 8 (prefork)
-- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .&gt; celery           exchange=celery(direct) key=celery
                

[tasks]
  . app.simple_task
  . celery.accumulate
  . celery.backend_cleanup
  . celery.chain
  . celery.chord
  . celery.chord_unlock
  . celery.chunks
  . celery.group
  . celery.map
  . celery.starmap
</code></pre></div>
<p dir="auto">Dropping the <code class="notranslate">TASK_</code> from the config property name to <code class="notranslate">CELERY_DEFAULT_QUEUE = 'test'</code> works as intended:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" -------------- celery@Olegs-MBP.homenet.telecomitalia.it v4.3.0 (rhubarb)
---- **** ----- 
--- * ***  * -- Darwin-18.6.0-x86_64-i386-64bit 2019-06-09 01:19:19
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .&gt; app:         __main__:0x1085be2b0
- ** ---------- .&gt; transport:   redis://localhost:6379/0
- ** ---------- .&gt; results:     disabled://
- *** --- * --- .&gt; concurrency: 8 (prefork)
-- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .&gt; test             exchange=test(direct) key=test
                

[tasks]
  . app.simple_task
  . celery.accumulate
  . celery.backend_cleanup
  . celery.chain
  . celery.chord
  . celery.chord_unlock
  . celery.chunks
  . celery.group
  . celery.map
  . celery.starmap"><pre class="notranslate"><code class="notranslate"> -------------- celery@Olegs-MBP.homenet.telecomitalia.it v4.3.0 (rhubarb)
---- **** ----- 
--- * ***  * -- Darwin-18.6.0-x86_64-i386-64bit 2019-06-09 01:19:19
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .&gt; app:         __main__:0x1085be2b0
- ** ---------- .&gt; transport:   redis://localhost:6379/0
- ** ---------- .&gt; results:     disabled://
- *** --- * --- .&gt; concurrency: 8 (prefork)
-- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .&gt; test             exchange=test(direct) key=test
                

[tasks]
  . app.simple_task
  . celery.accumulate
  . celery.backend_cleanup
  . celery.chain
  . celery.chord
  . celery.chord_unlock
  . celery.chunks
  . celery.group
  . celery.map
  . celery.starmap
</code></pre></div>
<p dir="auto">Now, issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="201701532" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/3772" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/3772/hovercard" href="https://github.com/celery/celery/issues/3772">#3772</a> was reporting incorrect documentation, i.e. <code class="notranslate">CELERY_DEFAULT_QUEUE</code> should be <code class="notranslate">CELERY_TASK_DEFAULT_QUEUE</code> and so all old configs without the <code class="notranslate">TASK_</code> have been updated in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="236581455" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/4094" data-hovercard-type="pull_request" data-hovercard-url="/celery/celery/pull/4094/hovercard" href="https://github.com/celery/celery/pull/4094">#4094</a> to have it. However, since the fix to the docs, the code actually <strong>regressed</strong> and now accepts the older settings.</p>
<h1 dir="auto">Checklist</h1>

<ul dir="auto">
<li>[ x ] I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Enhancement%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical enhancement to an existing feature.</li>
<li>[ x ] I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Issue+Type%3A+Enhancement%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed enhancements.</li>
<li>[ x ] I have checked the <a href="https://github.com/celery/celery/commits/main">commit log</a><br>
to find out if the if the same enhancement was already implemented in the<br>
main branch.</li>
<li>[ x ] I have included all related issues and possible duplicate issues in this issue<br>
(If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1717873059" data-permission-text="Title is private" data-url="https://github.com/sontek/pyramid_celery/issues/101" data-hovercard-type="issue" data-hovercard-url="/sontek/pyramid_celery/issues/101/hovercard" href="https://github.com/sontek/pyramid_celery/issues/101">sontek/pyramid_celery#101</a></p>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h1 dir="auto">Brief Summary</h1>

<p dir="auto">The  <a href="https://github.com/sontek/pyramid_celery">pyramid-celery</a> package adds <code class="notranslate">ini</code> and <code class="notranslate">ini-var</code> options to the standard commands. These allow the standard Pyramid <code class="notranslate">ini</code> configuration files to config Celery. With current Celery however, only the <code class="notranslate">worker</code>, <code class="notranslate">beat</code>, and <code class="notranslate">events</code> are able to be hooked into pyramid-celery's approach because those commands are set with.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="context_settings={
    'allow_extra_args': True
}"><pre class="notranslate"><code class="notranslate">context_settings={
    'allow_extra_args': True
}
</code></pre></div>
<p dir="auto">See <code class="notranslate">beat</code> for example: </p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/celery/celery/blob/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3/celery/bin/beat.py#L11">celery/celery/bin/beat.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 11
      in
      <a data-pjax="true" class="commit-tease-sha" href="/celery/celery/commit/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3">f3a2cf4</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="L11" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="11"></td>
          <td id="LC11" 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-s">'allow_extra_args'</span>: <span class="pl-c1">True</span></span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">The <code class="notranslate">shell</code> and <code class="notranslate">purge</code> commands for some reason do not have context_settings and so do not set <code class="notranslate">allow_extra_args</code>. See for example in <code class="notranslate">shell</code>, <a href="https://github.com/celery/celery/blob/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3/celery/bin/shell.py#LL82C1-L117C24">https://github.com/celery/celery/blob/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3/celery/bin/shell.py#LL82C1-L117C24</a></p>
<p dir="auto">The consequence is that the <code class="notranslate">ini</code> command options cause errors since these are extra and unknown args to these commands. Excluding the <code class="notranslate">ini</code> config casues  <code class="notranslate">shell</code> when it comes up to not get the task registration configs and <code class="notranslate">purge</code> isn't able to see queues.</p>
<h1 dir="auto">Design</h1>
<h2 dir="auto">Architectural Considerations</h2>

<p dir="auto"><a href="https://github.com/sontek/pyramid_celery">pyramid-celery</a> is on <a href="https://pypi.org/project/pyramid-celery" rel="nofollow">pypi</a>. Allows you to use pyramid .ini files to configure celery and have your pyramid configuration inside celery tasks.</p>
<h2 dir="auto">Proposed Behavior</h2>

<p dir="auto">This should not affect Celery functionality, but will allow pyramid-celery to function as expected. See related issue tracked in pyramid-celery here <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1717873059" data-permission-text="Title is private" data-url="https://github.com/sontek/pyramid_celery/issues/101" data-hovercard-type="issue" data-hovercard-url="/sontek/pyramid_celery/issues/101/hovercard" href="https://github.com/sontek/pyramid_celery/issues/101">sontek/pyramid_celery#101</a></p>
<h2 dir="auto">Proposed UI/UX</h2>

<p dir="auto">Celery should add <code class="notranslate">context_settings</code> with <code class="notranslate">allow_extra_args</code>,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="context_settings={
    'allow_extra_args': True
}"><pre class="notranslate"><code class="notranslate">context_settings={
    'allow_extra_args': True
}
</code></pre></div>
<p dir="auto">to both the <code class="notranslate">shell</code> and <code class="notranslate">purge</code> commands. This will allow projects like pyramid-celery to hook in their own custom configuration options using the recommended (by Celery) <code class="notranslate">celery_app.user_options['preload'].add()</code> and/or <code class="notranslate">celery_app.user_options[option].add()</code> approaches. See <a href="https://github.com/celery/celery/blob/e7b47a62d789557cf18ed0e56e2dfb99a51a62f7/docs/userguide/extending.rst#adding-new-command-line-options">here</a>. This will also make <code class="notranslate">shell</code> and <code class="notranslate">purge</code> commands consistent with other commands like <code class="notranslate">worker</code>, <code class="notranslate">beat</code>, and <code class="notranslate">events</code> that already have these settings.</p>
<h2 dir="auto">Diagrams</h2>

<p dir="auto">N/A</p>
<h2 dir="auto">Alternatives</h2>

<p dir="auto">None</p>