<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 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=""> This has already been asked to the <a href="https://github.com/celery/celery/discussions">discussions forum</a> first.</li>
<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" checked=""> 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" checked=""> 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>None</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>5.1.2 (sun-harmonics)</strong>:</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="pi@raspberrypi:~/restart/headunit $ /usr/bin/python3.7 -m celery -A pylibs.sidecars.metrics.app.celery report
/home/pi/restart/headunit/pylibs/sidecars
import name: pylibs.sidecars.metrics.metrics

software -&gt; celery:5.1.2 (sun-harmonics) kombu:5.2.1 py:3.7.3
            billiard:3.6.4.0 py-amqp:5.0.6
platform -&gt; system:Linux arch:32bit, ELF
            kernel version:5.10.60-v7l+ imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:pyamqp results:rpc:///

broker_url: 'amqp://guest:********@localhost:5672//'
result_backend: 'rpc:///'
deprecated_settings: None
ENV: 'production'
DEBUG: False
TESTING: False
PROPAGATE_EXCEPTIONS: None
PRESERVE_CONTEXT_ON_EXCEPTION: None
SECRET_KEY: '********'
PERMANENT_SESSION_LIFETIME: datetime.timedelta(days=31)
USE_X_SENDFILE: False
SERVER_NAME: None
APPLICATION_ROOT: '/'
SESSION_COOKIE_NAME: 'session'
SESSION_COOKIE_DOMAIN: None
SESSION_COOKIE_PATH: None
SESSION_COOKIE_HTTPONLY: True
SESSION_COOKIE_SECURE: False
SESSION_COOKIE_SAMESITE: None
SESSION_REFRESH_EACH_REQUEST: True
MAX_CONTENT_LENGTH: None
SEND_FILE_MAX_AGE_DEFAULT: None
TRAP_BAD_REQUEST_ERRORS: None
TRAP_HTTP_EXCEPTIONS: False
EXPLAIN_TEMPLATE_LOADING: False
PREFERRED_URL_SCHEME: 'http'
JSON_AS_ASCII: True
JSON_SORT_KEYS: '********'
JSONIFY_PRETTYPRINT_REGULAR: False
JSONIFY_MIMETYPE: 'application/json'
TEMPLATES_AUTO_RELOAD: None
MAX_COOKIE_SIZE: 4093
MONGODB_SETTINGS: {
    'db': 'static',
    'host': 'mongodb://root:toor@mongo.darkphotonworks-labs.io:27017/static'}
task_create_missing_queues: False
task_queues: 
    (&lt;unbound Queue default -&gt; [default-&gt;default]&gt;,
 &lt;unbound Queue metrics.system -&gt; [metrics-&gt;metrics.system]&gt;,
 &lt;unbound Queue metrics.system.vmem -&gt; [metrics-&gt;metrics.system.vmem]&gt;,
 &lt;unbound Queue metrics.system.swap -&gt; [metrics-&gt;metrics.system.swap]&gt;,
 &lt;unbound Queue metrics.system.cputime -&gt; [metrics-&gt;metrics.system.cputime]&gt;,
 &lt;unbound Queue metrics.system.cpustats -&gt; [metrics-&gt;metrics.system.cpustats]&gt;,
 &lt;unbound Queue metrics.system.temps -&gt; [metrics-&gt;metrics.system.temps]&gt;,
 &lt;unbound Queue metrics.system.diskusage -&gt; [metrics-&gt;metrics.system.diskusage]&gt;,
 &lt;unbound Queue metrics.system.netio -&gt; [metrics-&gt;metrics.system.netio]&gt;)
default_queue: 'metrics.system'
task_default_queue: 'metrics.system'
task_default_exchange: 'metrics'
task_default_exchange_type: 'direct'
task_default_routing_key: '********'
task_routes: {
    'pylibs.sidecars.metrics.app.publish_vmem': {   'queue': 'metrics.system.vmem',
                                                    'routing_key': '********'}}
beat_schedule: {
    'publish-cpustats-60s': {   'options': {   'exchange_type': 'direct',
                                               'priority': 1,
                                               'queue': 'metrics.system.cpustats',
                                               'routing_key': '********'},
                                'schedule': 60.0,
                                'task': 'pylibs.sidecars.metrics.app.publish_cpustats'},
    'publish-cputime-60s': {   'options': {   'exchange_type': 'direct',
                                              'priority': 1,
                                              'queue': 'metrics.system.cputime',
                                              'routing_key': '********'},
                               'schedule': 60.0,
                               'task': 'pylibs.sidecars.metrics.app.publish_cputime'},
    'publish-disk-usage-60s': {   'options': {   'exchange_type': 'direct',
                                                 'priority': 1,
                                                 'queue': 'metrics.system.diskusage',
                                                 'routing_key': '********'},
                                  'schedule': 60.0,
                                  'task': 'pylibs.sidecars.metrics.app.publish_diskusage'},
    'publish-netio-60s': {   'options': {   'exchange_type': 'direct',
                                            'priority': 1,
                                            'queue': 'metrics.system.netio',
                                            'routing_key': '********'},
                             'schedule': 60.0,
                             'task': 'pylibs.sidecars.metrics.app.publish_netio'},
    'publish-swap-60s': {   'options': {   'exchange_type': 'direct',
                                           'priority': 1,
                                           'queue': 'metrics.system.swap',
                                           'routing_key': '********'},
                            'schedule': 60.0,
                            'task': 'pylibs.sidecars.metrics.app.publish_swap'},
    'publish-temperature-60s': {   'options': {   'exchange_type': 'direct',
                                                  'priority': 1,
                                                  'queue': 'metrics.system.temps',
                                                  'routing_key': '********'},
                                   'schedule': 60.0,
                                   'task': 'pylibs.sidecars.metrics.app.publish_temps'},
    'publish-vmem-60s': {   'options': {   'exchange_type': 'direct',
                                           'priority': 1,
                                           'queue': 'metrics.system.vmem',
                                           'routing_key': '********'},
                            'schedule': 60.0,
                            'task': 'pylibs.sidecars.metrics.app.publish_vmem'}}
timezone: 'UTC'"><pre class="notranslate"><code class="notranslate">pi@raspberrypi:~/restart/headunit $ /usr/bin/python3.7 -m celery -A pylibs.sidecars.metrics.app.celery report
/home/pi/restart/headunit/pylibs/sidecars
import name: pylibs.sidecars.metrics.metrics

software -&gt; celery:5.1.2 (sun-harmonics) kombu:5.2.1 py:3.7.3
            billiard:3.6.4.0 py-amqp:5.0.6
platform -&gt; system:Linux arch:32bit, ELF
            kernel version:5.10.60-v7l+ imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:pyamqp results:rpc:///

broker_url: 'amqp://guest:********@localhost:5672//'
result_backend: 'rpc:///'
deprecated_settings: None
ENV: 'production'
DEBUG: False
TESTING: False
PROPAGATE_EXCEPTIONS: None
PRESERVE_CONTEXT_ON_EXCEPTION: None
SECRET_KEY: '********'
PERMANENT_SESSION_LIFETIME: datetime.timedelta(days=31)
USE_X_SENDFILE: False
SERVER_NAME: None
APPLICATION_ROOT: '/'
SESSION_COOKIE_NAME: 'session'
SESSION_COOKIE_DOMAIN: None
SESSION_COOKIE_PATH: None
SESSION_COOKIE_HTTPONLY: True
SESSION_COOKIE_SECURE: False
SESSION_COOKIE_SAMESITE: None
SESSION_REFRESH_EACH_REQUEST: True
MAX_CONTENT_LENGTH: None
SEND_FILE_MAX_AGE_DEFAULT: None
TRAP_BAD_REQUEST_ERRORS: None
TRAP_HTTP_EXCEPTIONS: False
EXPLAIN_TEMPLATE_LOADING: False
PREFERRED_URL_SCHEME: 'http'
JSON_AS_ASCII: True
JSON_SORT_KEYS: '********'
JSONIFY_PRETTYPRINT_REGULAR: False
JSONIFY_MIMETYPE: 'application/json'
TEMPLATES_AUTO_RELOAD: None
MAX_COOKIE_SIZE: 4093
MONGODB_SETTINGS: {
    'db': 'static',
    'host': 'mongodb://root:toor@mongo.darkphotonworks-labs.io:27017/static'}
task_create_missing_queues: False
task_queues: 
    (&lt;unbound Queue default -&gt; [default-&gt;default]&gt;,
 &lt;unbound Queue metrics.system -&gt; [metrics-&gt;metrics.system]&gt;,
 &lt;unbound Queue metrics.system.vmem -&gt; [metrics-&gt;metrics.system.vmem]&gt;,
 &lt;unbound Queue metrics.system.swap -&gt; [metrics-&gt;metrics.system.swap]&gt;,
 &lt;unbound Queue metrics.system.cputime -&gt; [metrics-&gt;metrics.system.cputime]&gt;,
 &lt;unbound Queue metrics.system.cpustats -&gt; [metrics-&gt;metrics.system.cpustats]&gt;,
 &lt;unbound Queue metrics.system.temps -&gt; [metrics-&gt;metrics.system.temps]&gt;,
 &lt;unbound Queue metrics.system.diskusage -&gt; [metrics-&gt;metrics.system.diskusage]&gt;,
 &lt;unbound Queue metrics.system.netio -&gt; [metrics-&gt;metrics.system.netio]&gt;)
default_queue: 'metrics.system'
task_default_queue: 'metrics.system'
task_default_exchange: 'metrics'
task_default_exchange_type: 'direct'
task_default_routing_key: '********'
task_routes: {
    'pylibs.sidecars.metrics.app.publish_vmem': {   'queue': 'metrics.system.vmem',
                                                    'routing_key': '********'}}
beat_schedule: {
    'publish-cpustats-60s': {   'options': {   'exchange_type': 'direct',
                                               'priority': 1,
                                               'queue': 'metrics.system.cpustats',
                                               'routing_key': '********'},
                                'schedule': 60.0,
                                'task': 'pylibs.sidecars.metrics.app.publish_cpustats'},
    'publish-cputime-60s': {   'options': {   'exchange_type': 'direct',
                                              'priority': 1,
                                              'queue': 'metrics.system.cputime',
                                              'routing_key': '********'},
                               'schedule': 60.0,
                               'task': 'pylibs.sidecars.metrics.app.publish_cputime'},
    'publish-disk-usage-60s': {   'options': {   'exchange_type': 'direct',
                                                 'priority': 1,
                                                 'queue': 'metrics.system.diskusage',
                                                 'routing_key': '********'},
                                  'schedule': 60.0,
                                  'task': 'pylibs.sidecars.metrics.app.publish_diskusage'},
    'publish-netio-60s': {   'options': {   'exchange_type': 'direct',
                                            'priority': 1,
                                            'queue': 'metrics.system.netio',
                                            'routing_key': '********'},
                             'schedule': 60.0,
                             'task': 'pylibs.sidecars.metrics.app.publish_netio'},
    'publish-swap-60s': {   'options': {   'exchange_type': 'direct',
                                           'priority': 1,
                                           'queue': 'metrics.system.swap',
                                           'routing_key': '********'},
                            'schedule': 60.0,
                            'task': 'pylibs.sidecars.metrics.app.publish_swap'},
    'publish-temperature-60s': {   'options': {   'exchange_type': 'direct',
                                                  'priority': 1,
                                                  'queue': 'metrics.system.temps',
                                                  'routing_key': '********'},
                                   'schedule': 60.0,
                                   'task': 'pylibs.sidecars.metrics.app.publish_temps'},
    'publish-vmem-60s': {   'options': {   'exchange_type': 'direct',
                                           'priority': 1,
                                           'queue': 'metrics.system.vmem',
                                           'routing_key': '********'},
                            'schedule': 60.0,
                            'task': 'pylibs.sidecars.metrics.app.publish_vmem'}}
timezone: 'UTC'
</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>: 3.7</li>
<li><strong>Minimal Celery Version</strong>: 5.1.2</li>
<li><strong>Minimal Kombu Version</strong>: 5.2.0</li>
<li><strong>Minimal Broker Version</strong>: rabbit mq 3.x</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: Raspbian 10</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="pi@raspberrypi:~/restart/headunit $ pip3 freeze
aiofiles==0.7.0
ajsonrpc==1.2.0
alabaster==0.7.12
amqp==5.0.6
aniso8601==7.0.0
anyio==3.3.2
arduino-sketch==0.2
asgiref==3.4.1
asn1crypto==0.24.0
astroid==2.8.0
asttokens==1.1.13
attrs==21.2.0
automationhat==0.2.0
Babel==2.9.1
backcall==0.2.0
backports.entry-points-selectable==1.1.0
beautifulsoup4==4.7.1
billiard==3.6.4.0
black==21.9b0
blinker==1.4
blinkt==0.1.2
bottle==0.12.19
buttonshim==0.0.2
cached-property==1.5.1
Cap1xxx==0.1.3
celery==5.1.2
certifi==2018.8.24
cfgv==3.3.1
chardet==3.0.4
click==7.1.2
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
colorama==0.3.7
colorzero==1.1
cookies==2.2.1
coverage==6.0.2
cryptography==2.6.1
cupshelpers==1.0
decorator==5.1.0
distlib==0.3.2
dnspython==1.16.0
docker==3.4.1
docker-compose==1.21.0
docker-pycreds==0.3.0
dockerpty==0.4.1
docopt==0.6.2
docutils==0.14
drumhat==0.1.0
email-validator==1.1.3
entrypoints==0.3
envirophat==1.0.0
ExplorerHAT==0.4.2
filelock==3.0.12
flake8==3.9.2
Flask==2.0.1
Flask-GraphQL==2.0.1
Flask-MongoAlchemy==0.7.2
flask-mongoengine==1.0.0
Flask-WTF==0.15.1
fourletterphat==0.1.0
gpiozero==1.6.2
graphene==2.1.9
graphene-mongo==0.2.13
graphql-core==2.3.2
graphql-relay==2.0.1
graphql-server-core==1.2.0
h11==0.12.0
html5lib==1.0.1
identify==2.2.15
idna==3.2
ifaddr==0.1.7
imagesize==1.2.0
importlib-metadata==4.8.1
iniconfig==1.1.1
ipython==7.28.0
iso8601==0.1.16
isort==5.9.3
itsdangerous==2.0.1
jedi==0.18.0
Jinja2==3.0.1
jsonschema==2.6.0
keyring==17.1.1
keyrings.alt==3.1.1
kombu==5.2.1
lazy-object-proxy==1.6.0
librabbitmq==2.0.0
logilab-common==1.4.2
lxml==4.3.2
MarkupSafe==2.0.1
marshmallow==3.13.0
matplotlib-inline==0.1.3
mccabe==0.6.1
microdotphat==0.2.1
MongoAlchemy==0.19
mongoengine==0.23.1
mote==0.0.4
motephat==0.0.3
mypy==0.670
mypy-extensions==0.4.3
nodeenv==1.6.0
numpy==1.16.2
oauthlib==2.1.0
olefile==0.46
packaging==21.0
pantilthat==0.0.7
parso==0.8.2
pathspec==0.9.0
pexpect==4.6.0
pgzero==1.2
phatbeat==0.1.1
pianohat==0.1.0
picamera==1.13
pickleshare==0.7.5
piglow==1.2.5
pigpio==1.78
pika==1.2.0
Pillow==5.4.1
platformdirs==2.3.0
platformio==5.2.0
pluggy==1.0.0
pre-commit==2.15.0
promise==2.3
prompt-toolkit==3.0.20
psutil==5.5.1
py==1.10.0
pycairo==1.16.2
pycodestyle==2.7.0
pycrypto==2.6.1
pycups==1.9.73
pyelftools==0.27
pyFirmata==1.1.0
pyflakes==2.3.1
pygame==1.9.4.post1
Pygments==2.3.1
PyGObject==3.30.4
pyinotify==0.9.6
PyJWT==1.7.0
pylint==2.11.1
pymata4==1.11
pymongo==3.12.0
pyOpenSSL==19.0.0
pyparsing==2.4.7
pyserial==3.5
pysmbc==1.0.15.6
pytest==6.2.5
pytest-cov==3.0.0
pytest-mock-resources==2.1.3
python-apt==1.8.4.3
python-dotenv==0.19.0
python-settings==0.2.2
pytz==2021.3
pyudev==0.22.0
pyxdg==0.25
PyYAML==5.4.1
rainbowhat==0.1.0
regex==2021.9.30
reportlab==3.5.13
requests==2.21.0
requests-oauthlib==1.0.0
responses==0.9.0
roman==2.0.0
RPi.GPIO==0.7.0
RTIMULib==7.2.1
Rx==1.6.1
SCons==4.2.0
scrollphat==0.0.7
scrollphathd==1.2.1
SecretStorage==2.3.1
semantic-version==2.8.5
Send2Trash==1.5.0
sense-hat==2.2.0
simplejson==3.16.0
singledispatch==3.7.0
six==1.12.0
skywriter==0.0.7
sn3218==1.2.7
sniffio==1.2.0
snowballstemmer==2.1.0
soupsieve==1.8
Sphinx==4.2.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
spidev==3.5
SQLAlchemy==1.4.25
ssh-import-id==5.7
starlette==0.16.0
tabulate==0.8.9
texttable==1.6.0
thonny==3.3.10
toml==0.10.2
tomli==1.2.1
touchphat==0.0.1
traitlets==5.1.0
twython==3.7.0
typed-ast==1.4.3
typing-extensions==3.10.0.2
unicornhathd==0.0.4
urllib3==1.24.1
uvicorn==0.15.0
vine==5.0.0
virtualenv==20.8.0
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==0.53.0
Werkzeug==2.0.1
wrapt==1.12.1
wsproto==1.0.0
WTForms==2.3.3
yapf==0.31.0
zeroconf==0.36.7
zipp==3.5.0"><pre class="notranslate"><code class="notranslate">pi@raspberrypi:~/restart/headunit $ pip3 freeze
aiofiles==0.7.0
ajsonrpc==1.2.0
alabaster==0.7.12
amqp==5.0.6
aniso8601==7.0.0
anyio==3.3.2
arduino-sketch==0.2
asgiref==3.4.1
asn1crypto==0.24.0
astroid==2.8.0
asttokens==1.1.13
attrs==21.2.0
automationhat==0.2.0
Babel==2.9.1
backcall==0.2.0
backports.entry-points-selectable==1.1.0
beautifulsoup4==4.7.1
billiard==3.6.4.0
black==21.9b0
blinker==1.4
blinkt==0.1.2
bottle==0.12.19
buttonshim==0.0.2
cached-property==1.5.1
Cap1xxx==0.1.3
celery==5.1.2
certifi==2018.8.24
cfgv==3.3.1
chardet==3.0.4
click==7.1.2
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
colorama==0.3.7
colorzero==1.1
cookies==2.2.1
coverage==6.0.2
cryptography==2.6.1
cupshelpers==1.0
decorator==5.1.0
distlib==0.3.2
dnspython==1.16.0
docker==3.4.1
docker-compose==1.21.0
docker-pycreds==0.3.0
dockerpty==0.4.1
docopt==0.6.2
docutils==0.14
drumhat==0.1.0
email-validator==1.1.3
entrypoints==0.3
envirophat==1.0.0
ExplorerHAT==0.4.2
filelock==3.0.12
flake8==3.9.2
Flask==2.0.1
Flask-GraphQL==2.0.1
Flask-MongoAlchemy==0.7.2
flask-mongoengine==1.0.0
Flask-WTF==0.15.1
fourletterphat==0.1.0
gpiozero==1.6.2
graphene==2.1.9
graphene-mongo==0.2.13
graphql-core==2.3.2
graphql-relay==2.0.1
graphql-server-core==1.2.0
h11==0.12.0
html5lib==1.0.1
identify==2.2.15
idna==3.2
ifaddr==0.1.7
imagesize==1.2.0
importlib-metadata==4.8.1
iniconfig==1.1.1
ipython==7.28.0
iso8601==0.1.16
isort==5.9.3
itsdangerous==2.0.1
jedi==0.18.0
Jinja2==3.0.1
jsonschema==2.6.0
keyring==17.1.1
keyrings.alt==3.1.1
kombu==5.2.1
lazy-object-proxy==1.6.0
librabbitmq==2.0.0
logilab-common==1.4.2
lxml==4.3.2
MarkupSafe==2.0.1
marshmallow==3.13.0
matplotlib-inline==0.1.3
mccabe==0.6.1
microdotphat==0.2.1
MongoAlchemy==0.19
mongoengine==0.23.1
mote==0.0.4
motephat==0.0.3
mypy==0.670
mypy-extensions==0.4.3
nodeenv==1.6.0
numpy==1.16.2
oauthlib==2.1.0
olefile==0.46
packaging==21.0
pantilthat==0.0.7
parso==0.8.2
pathspec==0.9.0
pexpect==4.6.0
pgzero==1.2
phatbeat==0.1.1
pianohat==0.1.0
picamera==1.13
pickleshare==0.7.5
piglow==1.2.5
pigpio==1.78
pika==1.2.0
Pillow==5.4.1
platformdirs==2.3.0
platformio==5.2.0
pluggy==1.0.0
pre-commit==2.15.0
promise==2.3
prompt-toolkit==3.0.20
psutil==5.5.1
py==1.10.0
pycairo==1.16.2
pycodestyle==2.7.0
pycrypto==2.6.1
pycups==1.9.73
pyelftools==0.27
pyFirmata==1.1.0
pyflakes==2.3.1
pygame==1.9.4.post1
Pygments==2.3.1
PyGObject==3.30.4
pyinotify==0.9.6
PyJWT==1.7.0
pylint==2.11.1
pymata4==1.11
pymongo==3.12.0
pyOpenSSL==19.0.0
pyparsing==2.4.7
pyserial==3.5
pysmbc==1.0.15.6
pytest==6.2.5
pytest-cov==3.0.0
pytest-mock-resources==2.1.3
python-apt==1.8.4.3
python-dotenv==0.19.0
python-settings==0.2.2
pytz==2021.3
pyudev==0.22.0
pyxdg==0.25
PyYAML==5.4.1
rainbowhat==0.1.0
regex==2021.9.30
reportlab==3.5.13
requests==2.21.0
requests-oauthlib==1.0.0
responses==0.9.0
roman==2.0.0
RPi.GPIO==0.7.0
RTIMULib==7.2.1
Rx==1.6.1
SCons==4.2.0
scrollphat==0.0.7
scrollphathd==1.2.1
SecretStorage==2.3.1
semantic-version==2.8.5
Send2Trash==1.5.0
sense-hat==2.2.0
simplejson==3.16.0
singledispatch==3.7.0
six==1.12.0
skywriter==0.0.7
sn3218==1.2.7
sniffio==1.2.0
snowballstemmer==2.1.0
soupsieve==1.8
Sphinx==4.2.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
spidev==3.5
SQLAlchemy==1.4.25
ssh-import-id==5.7
starlette==0.16.0
tabulate==0.8.9
texttable==1.6.0
thonny==3.3.10
toml==0.10.2
tomli==1.2.1
touchphat==0.0.1
traitlets==5.1.0
twython==3.7.0
typed-ast==1.4.3
typing-extensions==3.10.0.2
unicornhathd==0.0.4
urllib3==1.24.1
uvicorn==0.15.0
vine==5.0.0
virtualenv==20.8.0
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==0.53.0
Werkzeug==2.0.1
wrapt==1.12.1
wsproto==1.0.0
WTForms==2.3.3
yapf==0.31.0
zeroconf==0.36.7
zipp==3.5.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=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>
<ul dir="auto">
<li>Background tasks are defined in a Flask application namespace using Celery and the <code class="notranslate">@app.task()</code> decorator</li>
<li>The results of each task is routed to a different queue on the broker</li>
</ul>
<p dir="auto">Celery is loaded</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="app = create_app()
celery = middleware(
    app=app
)

def middleware(
    app: Flask = None,
    mq_host: str = None,
    mq_port: int = None,
    mq_user: str = None,
    mq_password: str = None,
) -&gt; Celery:
    mq_host = &quot;127.0.0.1&quot; if mq_host is None else mq_host 
    mq_port = 5726 if mq_port is None else mq_port
    # print(f&quot;import name: {app.import_name}&quot;)
    celery = Celery(
       app.import_name,
       backend='rpc://',
       broker=broker_connection_string()
    )
    #celery.conf.task_default_queue = &quot;metrics.system&quot;
    celery.conf.update(app.config)

    class ContextTask(celery.Task):
        def __call__(self, *args, **kwargs):
            with app.app_context():
                return self.run(*args, **kwargs)

    celery.Task = ContextTask
    return celery
"><pre class="notranslate"><span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-en">create_app</span>()
<span class="pl-s1">celery</span> <span class="pl-c1">=</span> <span class="pl-en">middleware</span>(
    <span class="pl-s1">app</span><span class="pl-c1">=</span><span class="pl-s1">app</span>
)

<span class="pl-k">def</span> <span class="pl-en">middleware</span>(
    <span class="pl-s1">app</span>: <span class="pl-v">Flask</span> <span class="pl-c1">=</span> <span class="pl-c1">None</span>,
    <span class="pl-s1">mq_host</span>: <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-c1">None</span>,
    <span class="pl-s1">mq_port</span>: <span class="pl-s1">int</span> <span class="pl-c1">=</span> <span class="pl-c1">None</span>,
    <span class="pl-s1">mq_user</span>: <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-c1">None</span>,
    <span class="pl-s1">mq_password</span>: <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-c1">None</span>,
) <span class="pl-c1">-&gt;</span> <span class="pl-v">Celery</span>:
    <span class="pl-s1">mq_host</span> <span class="pl-c1">=</span> <span class="pl-s">"127.0.0.1"</span> <span class="pl-k">if</span> <span class="pl-s1">mq_host</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span> <span class="pl-k">else</span> <span class="pl-s1">mq_host</span> 
    <span class="pl-s1">mq_port</span> <span class="pl-c1">=</span> <span class="pl-c1">5726</span> <span class="pl-k">if</span> <span class="pl-s1">mq_port</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span> <span class="pl-k">else</span> <span class="pl-s1">mq_port</span>
    <span class="pl-c"># print(f"import name: {app.import_name}")</span>
    <span class="pl-s1">celery</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>(
       <span class="pl-s1">app</span>.<span class="pl-s1">import_name</span>,
       <span class="pl-s1">backend</span><span class="pl-c1">=</span><span class="pl-s">'rpc://'</span>,
       <span class="pl-s1">broker</span><span class="pl-c1">=</span><span class="pl-en">broker_connection_string</span>()
    )
    <span class="pl-c">#celery.conf.task_default_queue = "metrics.system"</span>
    <span class="pl-s1">celery</span>.<span class="pl-s1">conf</span>.<span class="pl-en">update</span>(<span class="pl-s1">app</span>.<span class="pl-s1">config</span>)

    <span class="pl-k">class</span> <span class="pl-v">ContextTask</span>(<span class="pl-s1">celery</span>.<span class="pl-v">Task</span>):
        <span class="pl-k">def</span> <span class="pl-en">__call__</span>(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>):
            <span class="pl-k">with</span> <span class="pl-s1">app</span>.<span class="pl-en">app_context</span>():
                <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">run</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)

    <span class="pl-s1">celery</span>.<span class="pl-v">Task</span> <span class="pl-c1">=</span> <span class="pl-v">ContextTask</span>
    <span class="pl-k">return</span> <span class="pl-s1">celery</span></pre></div>
<p dir="auto">source is located <a href="https://github.com/apsamuel/workshop-ctrl-system/tree/main/pylibs/sidecars/metrics">here</a></p>
<p dir="auto">tasks are defined in the <code class="notranslate">app.py</code> file</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@celery.task(
    bind=True, 
    queue='metrics.system.vmem', 
    reply_to='metrics.system.vmem',
    name='pylibs.sidecars.metrics.app.publish_vmem' 
)
def publish_vmem(self):
    metrics = SystemMetrics(interval=30)
    mem = metrics.vmem()
    return dumps(mem)

@celery.task(
    bind=True, 
    queue='metrics.system.swap', 
    name='pylibs.sidecars.metrics.app.publish_swap'
)
def publish_swap(self):
    metrics = SystemMetrics(interval=30)
    swap = metrics.swap()
    return dumps(swap)
#..."><pre class="notranslate"><span class="pl-en">@<span class="pl-s1">celery</span>.<span class="pl-en">task</span>(</span>
<span class="pl-en">    <span class="pl-s1">bind</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, </span>
<span class="pl-en">    <span class="pl-s1">queue</span><span class="pl-c1">=</span><span class="pl-s">'metrics.system.vmem'</span>, </span>
<span class="pl-en">    <span class="pl-s1">reply_to</span><span class="pl-c1">=</span><span class="pl-s">'metrics.system.vmem'</span>,</span>
<span class="pl-en">    <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">'pylibs.sidecars.metrics.app.publish_vmem'</span> </span>
<span class="pl-en">)</span>
<span class="pl-k">def</span> <span class="pl-en">publish_vmem</span>(<span class="pl-s1">self</span>):
    <span class="pl-s1">metrics</span> <span class="pl-c1">=</span> <span class="pl-v">SystemMetrics</span>(<span class="pl-s1">interval</span><span class="pl-c1">=</span><span class="pl-c1">30</span>)
    <span class="pl-s1">mem</span> <span class="pl-c1">=</span> <span class="pl-s1">metrics</span>.<span class="pl-en">vmem</span>()
    <span class="pl-k">return</span> <span class="pl-en">dumps</span>(<span class="pl-s1">mem</span>)

<span class="pl-en">@<span class="pl-s1">celery</span>.<span class="pl-en">task</span>(</span>
<span class="pl-en">    <span class="pl-s1">bind</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, </span>
<span class="pl-en">    <span class="pl-s1">queue</span><span class="pl-c1">=</span><span class="pl-s">'metrics.system.swap'</span>, </span>
<span class="pl-en">    <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">'pylibs.sidecars.metrics.app.publish_swap'</span></span>
<span class="pl-en">)</span>
<span class="pl-k">def</span> <span class="pl-en">publish_swap</span>(<span class="pl-s1">self</span>):
    <span class="pl-s1">metrics</span> <span class="pl-c1">=</span> <span class="pl-v">SystemMetrics</span>(<span class="pl-s1">interval</span><span class="pl-c1">=</span><span class="pl-c1">30</span>)
    <span class="pl-s1">swap</span> <span class="pl-c1">=</span> <span class="pl-s1">metrics</span>.<span class="pl-en">swap</span>()
    <span class="pl-k">return</span> <span class="pl-en">dumps</span>(<span class="pl-s1">swap</span>)
<span class="pl-c">#...</span></pre></div>
<p dir="auto">Example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [84]: pylibs.sidecars.metrics.app.celery
Out[84]: &lt;Celery pylibs.sidecars.metrics.metrics at 0xaff9d690&gt;

In [91]: pylibs.sidecars.metrics.app.celery.amqp.queues
Out[91]: 
{'default': &lt;unbound Queue default -&gt; [default-&gt;default]&gt;,
 'metrics.system': &lt;unbound Queue metrics.system -&gt; [metrics-&gt;metrics.system]&gt;,
 'metrics.system.vmem': &lt;unbound Queue metrics.system.vmem -&gt; [metrics-&gt;metrics.system.vmem]&gt;,
 'metrics.system.swap': &lt;unbound Queue metrics.system.swap -&gt; [metrics-&gt;metrics.system.swap]&gt;,
 'metrics.system.cputime': &lt;unbound Queue metrics.system.cputime -&gt; [metrics-&gt;metrics.system.cputime]&gt;,
 'metrics.system.cpustats': &lt;unbound Queue metrics.system.cpustats -&gt; [metrics-&gt;metrics.system.cpustats]&gt;,
 'metrics.system.temps': &lt;unbound Queue metrics.system.temps -&gt; [metrics-&gt;metrics.system.temps]&gt;,
 'metrics.system.diskusage': &lt;unbound Queue metrics.system.diskusage -&gt; [metrics-&gt;metrics.system.diskusage]&gt;,
 'metrics.system.netio': &lt;unbound Queue metrics.system.netio -&gt; [metrics-&gt;metrics.system.netio]&gt;}
 
In [93]: pylibs.sidecars.metrics.app.celery.conf.task_queues
Out[93]: 
(&lt;unbound Queue default -&gt; [default-&gt;default]&gt;,
 &lt;unbound Queue metrics.system -&gt; [metrics-&gt;metrics.system]&gt;,
 &lt;unbound Queue metrics.system.vmem -&gt; [metrics-&gt;metrics.system.vmem]&gt;,
 &lt;unbound Queue metrics.system.swap -&gt; [metrics-&gt;metrics.system.swap]&gt;,
 &lt;unbound Queue metrics.system.cputime -&gt; [metrics-&gt;metrics.system.cputime]&gt;,
 &lt;unbound Queue metrics.system.cpustats -&gt; [metrics-&gt;metrics.system.cpustats]&gt;,
 &lt;unbound Queue metrics.system.temps -&gt; [metrics-&gt;metrics.system.temps]&gt;,
 &lt;unbound Queue metrics.system.diskusage -&gt; [metrics-&gt;metrics.system.diskusage]&gt;,
 &lt;unbound Queue metrics.system.netio -&gt; [metrics-&gt;metrics.system.netio]&gt;)"><pre lang="ipython" class="notranslate"><code class="notranslate">In [84]: pylibs.sidecars.metrics.app.celery
Out[84]: &lt;Celery pylibs.sidecars.metrics.metrics at 0xaff9d690&gt;

In [91]: pylibs.sidecars.metrics.app.celery.amqp.queues
Out[91]: 
{'default': &lt;unbound Queue default -&gt; [default-&gt;default]&gt;,
 'metrics.system': &lt;unbound Queue metrics.system -&gt; [metrics-&gt;metrics.system]&gt;,
 'metrics.system.vmem': &lt;unbound Queue metrics.system.vmem -&gt; [metrics-&gt;metrics.system.vmem]&gt;,
 'metrics.system.swap': &lt;unbound Queue metrics.system.swap -&gt; [metrics-&gt;metrics.system.swap]&gt;,
 'metrics.system.cputime': &lt;unbound Queue metrics.system.cputime -&gt; [metrics-&gt;metrics.system.cputime]&gt;,
 'metrics.system.cpustats': &lt;unbound Queue metrics.system.cpustats -&gt; [metrics-&gt;metrics.system.cpustats]&gt;,
 'metrics.system.temps': &lt;unbound Queue metrics.system.temps -&gt; [metrics-&gt;metrics.system.temps]&gt;,
 'metrics.system.diskusage': &lt;unbound Queue metrics.system.diskusage -&gt; [metrics-&gt;metrics.system.diskusage]&gt;,
 'metrics.system.netio': &lt;unbound Queue metrics.system.netio -&gt; [metrics-&gt;metrics.system.netio]&gt;}
 
In [93]: pylibs.sidecars.metrics.app.celery.conf.task_queues
Out[93]: 
(&lt;unbound Queue default -&gt; [default-&gt;default]&gt;,
 &lt;unbound Queue metrics.system -&gt; [metrics-&gt;metrics.system]&gt;,
 &lt;unbound Queue metrics.system.vmem -&gt; [metrics-&gt;metrics.system.vmem]&gt;,
 &lt;unbound Queue metrics.system.swap -&gt; [metrics-&gt;metrics.system.swap]&gt;,
 &lt;unbound Queue metrics.system.cputime -&gt; [metrics-&gt;metrics.system.cputime]&gt;,
 &lt;unbound Queue metrics.system.cpustats -&gt; [metrics-&gt;metrics.system.cpustats]&gt;,
 &lt;unbound Queue metrics.system.temps -&gt; [metrics-&gt;metrics.system.temps]&gt;,
 &lt;unbound Queue metrics.system.diskusage -&gt; [metrics-&gt;metrics.system.diskusage]&gt;,
 &lt;unbound Queue metrics.system.netio -&gt; [metrics-&gt;metrics.system.netio]&gt;)
</code></pre></div>
<p dir="auto">I have defined a beat schedule a follows, these tasks execute with no problem, however they are not routed to the queues defined in beat schedules.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="celery.conf.update(beat_schedule = {
    'publish-vmem-60s': {
        'task': 'pylibs.sidecars.metrics.app.publish_vmem',
        'schedule': 60.0,
        'options': {
            'queue': 'metrics.system.vmem',
            'routing_key': 'metrics.system.vmem',
            # 'exchange': 'metrics',            
            'exchange_type': 'direct',
            'priority': 1,
        },
    },
    'publish-swap-60s': {
        'task': 'pylibs.sidecars.metrics.app.publish_swap',
        'schedule': 60.0,
        'options': {
            'queue': 'metrics.system.swap',
            'routing_key': 'metrics.system.swap',
            # 'exchange': 'metrics',            
            'exchange_type': 'direct',
            'priority': 1,
        },
    },
    'publish-cputime-60s': {
        'task': 'pylibs.sidecars.metrics.app.publish_cputime',
        'schedule': 60.0,
        'options': {
            'queue': 'metrics.system.cputime',
            'routing_key': 'metrics.system.cputime',
            # 'exchange': 'metrics',            
            'exchange_type': 'direct',
            'priority': 1,
        },
    },
    'publish-cpustats-60s': {
        'task': 'pylibs.sidecars.metrics.app.publish_cpustats',
        'schedule': 60.0,
        'options': {
            'queue': 'metrics.system.cpustats',
            'routing_key': 'metrics.system.cpustats',
            #'exchange': 'metrics',            
            'exchange_type': 'direct',
            'priority': 1,
        },
    },
    'publish-temperature-60s': {
        'task': 'pylibs.sidecars.metrics.app.publish_temps',
        'schedule': 60.0,
        'options': {
            'queue': 'metrics.system.temps',
            'routing_key': 'metrics.system.temps',
            # 'exchange': 'metrics',            
            'exchange_type': 'direct',
            'priority': 1,
        },
    },
    'publish-disk-usage-60s': {
        'task': 'pylibs.sidecars.metrics.app.publish_diskusage',
        'schedule': 60.0,
        'options': {
            'queue': 'metrics.system.diskusage',
            'routing_key': 'metrics.system.diskusage',
            # 'exchange': 'metrics',            
            'exchange_type': 'direct',
            'priority': 1,

        },
    },
    'publish-netio-60s': {
        'task': 'pylibs.sidecars.metrics.app.publish_netio',
        'schedule': 60.0,
        'options': {
            'queue': 'metrics.system.netio',
            'routing_key': 'metrics.system.netio',
            # 'exchange': 'metrics',         
            'exchange_type': 'direct',
            'priority': 1,
        },
    },
})"><pre class="notranslate"><span class="pl-s1">celery</span>.<span class="pl-s1">conf</span>.<span class="pl-en">update</span>(<span class="pl-s1">beat_schedule</span> <span class="pl-c1">=</span> {
    <span class="pl-s">'publish-vmem-60s'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'pylibs.sidecars.metrics.app.publish_vmem'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">60.0</span>,
        <span class="pl-s">'options'</span>: {
            <span class="pl-s">'queue'</span>: <span class="pl-s">'metrics.system.vmem'</span>,
            <span class="pl-s">'routing_key'</span>: <span class="pl-s">'metrics.system.vmem'</span>,
            <span class="pl-c"># 'exchange': 'metrics',            </span>
            <span class="pl-s">'exchange_type'</span>: <span class="pl-s">'direct'</span>,
            <span class="pl-s">'priority'</span>: <span class="pl-c1">1</span>,
        },
    },
    <span class="pl-s">'publish-swap-60s'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'pylibs.sidecars.metrics.app.publish_swap'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">60.0</span>,
        <span class="pl-s">'options'</span>: {
            <span class="pl-s">'queue'</span>: <span class="pl-s">'metrics.system.swap'</span>,
            <span class="pl-s">'routing_key'</span>: <span class="pl-s">'metrics.system.swap'</span>,
            <span class="pl-c"># 'exchange': 'metrics',            </span>
            <span class="pl-s">'exchange_type'</span>: <span class="pl-s">'direct'</span>,
            <span class="pl-s">'priority'</span>: <span class="pl-c1">1</span>,
        },
    },
    <span class="pl-s">'publish-cputime-60s'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'pylibs.sidecars.metrics.app.publish_cputime'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">60.0</span>,
        <span class="pl-s">'options'</span>: {
            <span class="pl-s">'queue'</span>: <span class="pl-s">'metrics.system.cputime'</span>,
            <span class="pl-s">'routing_key'</span>: <span class="pl-s">'metrics.system.cputime'</span>,
            <span class="pl-c"># 'exchange': 'metrics',            </span>
            <span class="pl-s">'exchange_type'</span>: <span class="pl-s">'direct'</span>,
            <span class="pl-s">'priority'</span>: <span class="pl-c1">1</span>,
        },
    },
    <span class="pl-s">'publish-cpustats-60s'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'pylibs.sidecars.metrics.app.publish_cpustats'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">60.0</span>,
        <span class="pl-s">'options'</span>: {
            <span class="pl-s">'queue'</span>: <span class="pl-s">'metrics.system.cpustats'</span>,
            <span class="pl-s">'routing_key'</span>: <span class="pl-s">'metrics.system.cpustats'</span>,
            <span class="pl-c">#'exchange': 'metrics',            </span>
            <span class="pl-s">'exchange_type'</span>: <span class="pl-s">'direct'</span>,
            <span class="pl-s">'priority'</span>: <span class="pl-c1">1</span>,
        },
    },
    <span class="pl-s">'publish-temperature-60s'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'pylibs.sidecars.metrics.app.publish_temps'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">60.0</span>,
        <span class="pl-s">'options'</span>: {
            <span class="pl-s">'queue'</span>: <span class="pl-s">'metrics.system.temps'</span>,
            <span class="pl-s">'routing_key'</span>: <span class="pl-s">'metrics.system.temps'</span>,
            <span class="pl-c"># 'exchange': 'metrics',            </span>
            <span class="pl-s">'exchange_type'</span>: <span class="pl-s">'direct'</span>,
            <span class="pl-s">'priority'</span>: <span class="pl-c1">1</span>,
        },
    },
    <span class="pl-s">'publish-disk-usage-60s'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'pylibs.sidecars.metrics.app.publish_diskusage'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">60.0</span>,
        <span class="pl-s">'options'</span>: {
            <span class="pl-s">'queue'</span>: <span class="pl-s">'metrics.system.diskusage'</span>,
            <span class="pl-s">'routing_key'</span>: <span class="pl-s">'metrics.system.diskusage'</span>,
            <span class="pl-c"># 'exchange': 'metrics',            </span>
            <span class="pl-s">'exchange_type'</span>: <span class="pl-s">'direct'</span>,
            <span class="pl-s">'priority'</span>: <span class="pl-c1">1</span>,

        },
    },
    <span class="pl-s">'publish-netio-60s'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'pylibs.sidecars.metrics.app.publish_netio'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">60.0</span>,
        <span class="pl-s">'options'</span>: {
            <span class="pl-s">'queue'</span>: <span class="pl-s">'metrics.system.netio'</span>,
            <span class="pl-s">'routing_key'</span>: <span class="pl-s">'metrics.system.netio'</span>,
            <span class="pl-c"># 'exchange': 'metrics',         </span>
            <span class="pl-s">'exchange_type'</span>: <span class="pl-s">'direct'</span>,
            <span class="pl-s">'priority'</span>: <span class="pl-c1">1</span>,
        },
    },
})</pre></div>
<h1 dir="auto">Actual Behavior</h1>
<p dir="auto">tasks don't get routed to the queues defined in the beat schedule but instead are routed to the auto-generated task queue for celery (or hardcoded in <code class="notranslate">@app.task(queue=&lt;queue&gt;)</code></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pi@raspberrypi:~/restart/headunit $ ./dev/rabbitmqadmin list queues
+-----------------------------------------------+----------+
|                     name                      | messages |
+-----------------------------------------------+----------+
| 2aa4c2ac-4f30-348f-9eec-44103f41a86f          | 535      | &lt;-- wrong queue
| celery@raspberrypi.celery.pidbox              | 0        |
| celeryev.4ccf8ffd-cfa4-4143-a0b2-3fc51576d695 | 0        |
| celeryev.7e381597-0755-4c91-84aa-88faee6d8f7c | 0        |
| default                                       | 0        |
| metrics.system                                | 0        |
| metrics.system.cpustats                       | 0        |
| metrics.system.cputime                        | 0        |
| metrics.system.diskusage                      | 0        |
| metrics.system.netio                          | 0        |
| metrics.system.swap                           | 0        |
| metrics.system.temps                          | 0        |
| metrics.system.vmem                           | 0        |
+-----------------------------------------------+----------+"><pre class="notranslate">pi@raspberrypi:<span class="pl-k">~</span>/restart/headunit $ ./dev/rabbitmqadmin list queues
+-----------------------------------------------+----------+
<span class="pl-k">|</span>                     name                      <span class="pl-k">|</span> messages <span class="pl-k">|</span>
+-----------------------------------------------+----------+
<span class="pl-k">|</span> 2aa4c2ac-4f30-348f-9eec-44103f41a86f          <span class="pl-k">|</span> 535      <span class="pl-k">|</span> <span class="pl-k">&lt;</span>-- wrong queue
<span class="pl-k">|</span> celery@raspberrypi.celery.pidbox              <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> celeryev.4ccf8ffd-cfa4-4143-a0b2-3fc51576d695 <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> celeryev.7e381597-0755-4c91-84aa-88faee6d8f7c <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> default                                       <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system                                <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system.cpustats                       <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system.cputime                        <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system.diskusage                      <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system.netio                          <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system.swap                           <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system.temps                          <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
<span class="pl-k">|</span> metrics.system.vmem                           <span class="pl-k">|</span> 0        <span class="pl-k">|</span>
+-----------------------------------------------+----------+</pre></div>
<p dir="auto">This doesn't happen on 4.4.3, only on 4.4.4.</p>
<p dir="auto">Here is a traceback:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery_default_1      | [2020-06-04 19:51:47,723: ERROR/MainProcess] Pool callback raised exception: TypeError('set() takes 3 positional arguments but 4 were given',)
celery_default_1      | Traceback (most recent call last):
celery_default_1      |   File &quot;/usr/share/dashboard/venv/lib/python3.6/site-packages/billiard/pool.py&quot;, line 1796, in safe_apply_callback
celery_default_1      |     fun(*args, **kwargs)
celery_default_1      |   File &quot;/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/worker/request.py&quot;, line 528, in on_failure
celery_default_1      |     store_result=self.store_errors,
celery_default_1      |   File &quot;/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/backends/base.py&quot;, line 169, in mark_as_failure
celery_default_1      |     traceback=traceback, request=request)
celery_default_1      |   File &quot;/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/backends/base.py&quot;, line 443, in store_result
celery_default_1      |     request=request, **kwargs)
celery_default_1      |   File &quot;/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/backends/base.py&quot;, line 858, in _store_result
celery_default_1      |     self.set(self.get_key_for_task(task_id), self.encode(meta), state)
celery_default_1      | TypeError: set() takes 3 positional arguments but 4 were given"><pre class="notranslate"><code class="notranslate">celery_default_1      | [2020-06-04 19:51:47,723: ERROR/MainProcess] Pool callback raised exception: TypeError('set() takes 3 positional arguments but 4 were given',)
celery_default_1      | Traceback (most recent call last):
celery_default_1      |   File "/usr/share/dashboard/venv/lib/python3.6/site-packages/billiard/pool.py", line 1796, in safe_apply_callback
celery_default_1      |     fun(*args, **kwargs)
celery_default_1      |   File "/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/worker/request.py", line 528, in on_failure
celery_default_1      |     store_result=self.store_errors,
celery_default_1      |   File "/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/backends/base.py", line 169, in mark_as_failure
celery_default_1      |     traceback=traceback, request=request)
celery_default_1      |   File "/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/backends/base.py", line 443, in store_result
celery_default_1      |     request=request, **kwargs)
celery_default_1      |   File "/usr/share/dashboard/venv/lib/python3.6/site-packages/celery/backends/base.py", line 858, in _store_result
celery_default_1      |     self.set(self.get_key_for_task(task_id), self.encode(meta), state)
celery_default_1      | TypeError: set() takes 3 positional arguments but 4 were given
</code></pre></div>
<p dir="auto">I am running on Python 3.6 on Bionic.</p>
<p dir="auto">For now I've stuck to 4.4.3 as 4.4.4 keeps throwing this exception.</p>

<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"> 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"> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> 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"> 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"> 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"> 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"> 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>None</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">4.4.4</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.4.4 (cliffs) kombu:4.6.10 py:3.6.10
            billiard:3.6.3.0 py-amqp:2.6.0
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.3.0-51-generic imp:CPython
loader   -&gt; celery.loaders.default.Loader
settings -&gt; transport:amqp results:disabled"><pre class="notranslate"><code class="notranslate">software -&gt; celery:4.4.4 (cliffs) kombu:4.6.10 py:3.6.10
            billiard:3.6.3.0 py-amqp:2.6.0
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.3.0-51-generic imp:CPython
loader   -&gt; celery.loaders.default.Loader
settings -&gt; transport:amqp results:disabled
</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>: 3.6.10</li>
<li><strong>Minimal Celery Version</strong>: 4.4.4</li>
<li><strong>Minimal Kombu Version</strong>: 4.6.10</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>: Ubuntu 18.04 + 5.3 kernel</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.6.0
argh==0.26.2
asgiref==3.2.7
Babel==2.8.0
backcall==0.1.0
billiard==3.6.3.0
celery==4.4.4
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.2
coverage==5.1
decorator==4.4.2
defusedxml==0.5.0
Django==2.2.13
django-celery-beat==2.0.0
django-celery-results==1.2.1
django-crispy-forms==1.9.1
django-csp==3.6
django-extensions==2.2.9
django-nose==1.4.6
django-redis==4.12.1
django-timezone-field==4.0
djangorestframework==3.11.0
flower==0.9.3
ftputil==3.4
future==0.18.2
gunicorn==20.0.4
hiredis==1.0.1
icalendar==4.0.6
idna==2.9
importlib-metadata==1.6.0
ipdb==0.13.2
ipdbplugin==1.5.0
ipython==7.15.0
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.17.0
jsonfield==2.0.2
kombu==4.6.10
lxml==4.3.5
nose==1.3.7
parso==0.7.0
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==5.4.1
prompt-toolkit==3.0.5
psycopg2==2.8.5
ptyprocess==0.6.0
pycodestyle==2.6.0
pyflakes==2.2.0
Pygments==2.6.1
python-crontab==2.5.1
python-dateutil==2.8.1
pytz==2020.1
PyYAML==5.2
raven==6.10.0
redis==3.5.3
requests==2.23.0
single-beat==0.4.1
six==1.15.0
sqlparse==0.3.1
suds-jurko==0.6
tornadis==0.8.1
tornado==5.1.1
traitlets==4.3.3
urllib3==1.25.9
vine==1.3.0
watchdog==0.9.0
wcwidth==0.2.3
whitenoise==5.1.0
zipp==3.1.0"><pre class="notranslate"><code class="notranslate">amqp==2.6.0
argh==0.26.2
asgiref==3.2.7
Babel==2.8.0
backcall==0.1.0
billiard==3.6.3.0
celery==4.4.4
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.2
coverage==5.1
decorator==4.4.2
defusedxml==0.5.0
Django==2.2.13
django-celery-beat==2.0.0
django-celery-results==1.2.1
django-crispy-forms==1.9.1
django-csp==3.6
django-extensions==2.2.9
django-nose==1.4.6
django-redis==4.12.1
django-timezone-field==4.0
djangorestframework==3.11.0
flower==0.9.3
ftputil==3.4
future==0.18.2
gunicorn==20.0.4
hiredis==1.0.1
icalendar==4.0.6
idna==2.9
importlib-metadata==1.6.0
ipdb==0.13.2
ipdbplugin==1.5.0
ipython==7.15.0
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.17.0
jsonfield==2.0.2
kombu==4.6.10
lxml==4.3.5
nose==1.3.7
parso==0.7.0
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==5.4.1
prompt-toolkit==3.0.5
psycopg2==2.8.5
ptyprocess==0.6.0
pycodestyle==2.6.0
pyflakes==2.2.0
Pygments==2.6.1
python-crontab==2.5.1
python-dateutil==2.8.1
pytz==2020.1
PyYAML==5.2
raven==6.10.0
redis==3.5.3
requests==2.23.0
single-beat==0.4.1
six==1.15.0
sqlparse==0.3.1
suds-jurko==0.6
tornadis==0.8.1
tornado==5.1.1
traitlets==4.3.3
urllib3==1.25.9
vine==1.3.0
watchdog==0.9.0
wcwidth==0.2.3
whitenoise==5.1.0
zipp==3.1.0
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Ubuntu 18.04
Redis
Postgres 10"><pre class="notranslate"><code class="notranslate">Ubuntu 18.04
Redis
Postgres 10
</code></pre></div>
<p dir="auto"></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=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<h1 dir="auto">Actual Behavior</h1>