Issue 1:
Checklist

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

This has already been asked to the discussions forum 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

None

Possible Duplicates

None

Environment & Settings

Celery version:

celery report Output:

Steps to Reproduce

celery dockerfile build failed

I want to build a base image for my django project,my project dependencies requirements.txt like below

requirements.txt

amqp==2.6.1
anyjson==0.3.3
appdirs==1.4.4
asgiref==3.2.7
billiard==3.6.3.0
celery==4.4.0
celery-with-redis==3.0
certifi==2020.6.20
cffi==1.14.0
chardet==3.0.4
click==7.1.2
click-didyoumean==0.0.3
click-repl==0.1.6
coreapi==2.3.3
coreschema==0.0.4
cryptography==3.2
distlib==0.3.1
Django==2.2.16
django-celery-beat==1.1.0
django-celery-results==1.0.0
django-cors-headers==3.5.0
django-extensions==3.1.0
django-filter==2.4.0
django-timezone-field==4.0
django-werkzeug-debugger-runserver==0.3.1
djangorestframework==3.12.1
dnspython==1.16.0
drf-extensions==0.6.0
ephem==3.7.7.1
eventlet==0.25.2
filelock==3.0.12
flower==0.9.5
greenlet==0.4.15
humanize==3.0.1
idna==2.10
importlib-metadata==2.0.0
importlib-resources==3.0.0
install==1.3.4
itypes==1.2.0
Jinja2==2.11.2
kombu==4.6.11
Markdown==3.3.3
MarkupSafe==1.1.1
monotonic==1.5
msgpack-python==0.5.6
prometheus-client==0.8.0
prompt-toolkit==3.0.8
pycparser==2.20
PyMySQL==0.10.1
pyOpenSSL==19.1.0
python-crontab==2.4.2
python-dateutil==2.8.1
pytz==2020.1
redis==3.2.0
requests==2.24.0
six==1.15.0
sqlparse==0.4.1
tornado==6.0.4
uritemplate==3.0.1
urllib3==1.25.10
vine==1.3.0
virtualenv==20.0.35
wcwidth==0.2.5
Werkzeug==1.0.1
zipp==3.3.1
gunicorn==19.8.1
gevent==1.3.4

my Dockerfile

FROM python3.6.4
WORKDIR /data/project
COPY . /data/project

RUN pip install -r requirements.txt

my docker version

Docker version 20.10.12, build e91ed57

when i run

docker build . -t project

however, an error occured like below

ERROR: Cannot install -r ./requirements.txt (line 51) and celery==4.4.0 because these package versions have conflicting dependencies.

The conflict is caused by:
The user requested celery==4.4.0
celery-with-redis 3.0 depends on celery<4.0 and >=3.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
The command '/bin/sh -c rm -f /etc/localtime && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone && chmod 777 /opt && pip3 install -U pip setuptools && pip install -r ./requirements.txt' returned a non-zero code: 1
ERROR: Job failed: exit code 1
``
## Required Dependencies
<!-- Please fill the required dependencies to reproduce this issue -->
* **Minimal Python Version**: N/A or Unknown
* **Minimal Celery Version**: N/A or Unknown
* **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

# Expected Behavior
<!-- Describe in detail what you expect to happen -->
excepted to build docker image success
# Actual Behavior
<!--
Describe in detail what actually happened.
Please include a backtrace and surround it with triple backticks (```).
In addition, include the Celery daemon logs, the broker logs,
the result backend logs and system logs below if they will help us debug
the issue.
-->
how can i solve the celery dependency conflicts,thanks~

Issue 2:
Checklist

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).

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

#4993

Description

The Abstract Tasks section of your documentation says that if you override __call__() to do something every time the task body is run, then you should call super().__call__() to run that task. This breaks some tests in my app which I'll describe below. calling self.run() instead of super().__call__() from within __call__() to run the body works properly. #4993 specifically asked about this and the recommendation was to use super().__call__(), not self.run().

The test code that is failing effectively does the following:

enqueue task with the delay() method

process task, - fail and enqueue for retry

process task

We have mimicked the code here to manually process a task by creating a WorkerController and calling wait_for_task() followed by process_queued_task().

When I use super().__call__() instead of self.run(), the second call to process the task fails with a TimeoutError. Effectively, the initial running of the task works, but something with the retry flow is failing to re-enqueue the task.

Running in the debugger, I discovered

The celery.app.task.Task.__call__() method is never called if I don't call this manually with super().__call__() from my custom Task class' __call__() method.

The execution of the task body is triggered from celery.app.trace.build_tracer.trace_task(), which directly calls the run() function if the custom task class has not defined __call__()

The task_trace function calls the same surrounding management code as Task.__call__() (in addition to a bunch of other things), so it seems like it would be a bad idea to call Task.__call__() from within this.

I'm not sure if anything particular to my configuration is causing the flow to go through trace_task() rather than Task.__call__().

Here are some code comments and snippets which may be useful:

https://github.com/celery/celery/blob/v4.1.0/celery/app/trace.py#L284

# If the task doesn't define a custom __call__ method
# we optimize it away by simply calling the run method directly,
# saving the extra method call and a line less in the stack trace.
fun = task if task_has_custom(task, '__call__') else task.run

https://github.com/celery/celery/blob/v4.1.0/celery/app/task.py#L146

"""Task base class.
Note:
When called tasks apply the :meth:`run` method. This method must
be defined by all tasks (that is unless the :meth:`__call__` method
is overridden).
"""

Suggestions

Either help me understand what I'm doing wrong and provide documentation to explain that to future users in the Abstract Tasks section of the documentation, or change the code snippet to the following:

from celery import Task

class DebugTask(Task):

def __call__(self, *args, **kwargs):
print('TASK STARTING: {0.name}[{0.request.id}]'.format(self))
return self.run(*args, **kwargs)