Issue 1:
Checklist

I have verified that the issue exists against the master branch of Celery.

This has already been asked to the discussion group first.

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues

None

Possible Duplicates

None

Environment & Settings

Celery version: 4.4.0 (cliffs)

celery report Output:

software -> celery:4.4.0 (cliffs) kombu:4.6.7 py:3.6.9
billiard:3.6.1.0 py-amqp:2.5.2
platform -> system:Linux arch:64bit, ELF
kernel version:4.15.0-76-generic imp:CPython
loader -> celery.loaders.default.Loader
settings -> transport:amqp results:disabled

Steps to Reproduce

Required Dependencies

Minimal Python Version: N/A or Unknown

Minimal Celery Version: N/A or Unknown

Minimal Kombu Version: N/A or Unknown

Minimal Broker Version: RabbitMQ 3.6.10

Minimal Result Backend Version: DB Postgres

Minimal OS and/or Kernel Version: N/A or Unknown

Minimal Broker Client Version: N/A or Unknown

Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

Other Dependencies

N/A

Minimally Reproducible Test Case

task = chain(group(AClass.execute.si("", ""),
AClass.execute.si("", ""),
AClass.execute.si("", "")),
group(AClass.execute.si("", ""),
AClass.execute.si("", ""),
AClass.execute.si("", "")),
group(AClass.execute.si("", "")),
group(AClass.execute.si("", "))
)

Expected Behavior

Group1 get executed 1 time( 3 task)

Group2 get executed 1 time( 3 task)

Group3 get executed 1 time( 1 task)

Group4 get executed 1 time( 1 task)

Actual Behavior

Group1 get executed 1 time( 3 task)

Group2 get executed 1 time( 3 task)

Group3 get executed 3 times( 1 task)

Group4 get executed 3 times( 1 task)

Issue 2:
Checklist

I have verified that the issue exists against the master branch of Celery.

This has already been asked to the discussion group first.

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

#5105

Possible Duplicates

None

Environment & Settings

Celery version: 4.4.0

celery report Output:

not possible due to unit test context

Steps to Reproduce

Required Dependencies

Minimal Python Version: 3.7.6

Minimal Celery Version: 4.4.0

Minimal Kombu Version: N/A or Unknown

Minimal Broker Version: N/A or Unknown

Minimal Result Backend Version: N/A or Unknown

Minimal OS and/or Kernel Version: N/A or Unknown

Minimal Broker Client Version: N/A or Unknown

Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

amqp==2.5.2
attrs==19.3.0
billiard==3.6.2.0
case==1.3.1
celery==4.4.0
importlib-metadata==1.5.0
kombu==4.6.7
linecache2==1.0.0
mock==4.0.1
more-itertools==8.2.0
nose==1.3.7
packaging==20.1
pluggy==0.13.1
py==1.8.1
pyparsing==2.4.6
pytest==5.3.5
pytest-mock==2.0.0
pytz==2019.3
six==1.14.0
traceback2==1.4.0
unittest2==1.1.0
vine==1.3.0
wcwidth==0.1.8
zipp==3.0.0

Other Dependencies

N/A

Minimally Reproducible Test Case

Put this snippet into t/test_tasks.py and run it.

import pytest

@pytest.fixture
def celery_includes():
return [
't.unit.contrib.proj.foo'
]

def test_pytest_import_passes(celery_app, celery_worker):
task = celery_app.send_task("t.unit.contrib.proj.foo.bar")
task.get()

def test_pytest_second_with_new_app_fixtures_also_passes(celery_app, celery_worker):
task = celery_app.send_task("t.unit.contrib.proj.foo.bar")
task.get()

The second test case fails here.

Expected Behavior

I can create two test cases that call the same task without hitting errors.

Actual Behavior

The second test case always fails.

tp = <class 'celery.exceptions.NotRegistered'>, value = Task of kind 't.unit.contrib.proj.foo.bar' never registered, please make sure it's imported., tb = None

def reraise(tp, value, tb=None):
"""Reraise exception."""
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
> raise value
E celery.exceptions.NotRegistered: 't.unit.contrib.proj.foo.bar'

../../.local/share/virtualenvs/celery-R2pj-DTl/lib/python3.7/site-packages/vine/five.py:195: NotRegistered
---------------------------------------------------------------------- Captured log call ----------------------------------------------------------------------
ERROR celery.worker.consumer.consumer:consumer.py:497 Received unregistered task of type 't.unit.contrib.proj.foo.bar'.
The message has been ignored and discarded.

Did you remember to import the module containing this task?
Or maybe you're using relative imports?

Please see
http://docs.celeryq.org/en/latest/internals/protocol.html
for more information.

The full contents of the message body was:
b'[[], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]' (77b)
Traceback (most recent call last):
File "/Users/powerjo/.local/share/virtualenvs/celery-R2pj-DTl/lib/python3.7/site-packages/celery/worker/consumer/consumer.py", line 562, in on_task_received
strategy = strategies[type_]
KeyError: 't.unit.contrib.proj.foo.bar'