Issue 1:
Template filled out below but this is pretty clear.

This line populates Worker.task_events using either:

celery/celery/worker/worker.py

Line 377
in
04771d6

self.task_events = either('worker_send_task_events', task_events)

However, as of version 5, the task_events arg is False here when the argument is omitted from the command line, not None. So either, which looks for the first non-None value, always returns False and ignores the value from app.conf.

Works as expected in 4.4.7.

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

None

Possible Duplicates

None

Environment & Settings

Celery version: 5.2.0b1 (sun-harmonics)

celery report Output:

software -> celery:5.2.0b1 (sun-harmonics) kombu:5.1.0 py:3.7.5
billiard:3.6.4.0 py-amqp:5.0.6
platform -> system:Linux arch:64bit, ELF
kernel version:5.4.0-77-generic imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:pyamqp results:disabled

broker_url: 'amqp://guest:********@localhost:5672//'
deprecated_settings: None
worker_send_task_events: True

Steps to Reproduce

Required Dependencies

Minimal Python Version: N/A or Unknown

Minimal Celery Version: 5

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==5.0.6
billiard==3.6.4.0
cached-property==1.5.2
celery==5.2.0b1
click==8.0.1
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.2.0
importlib-metadata==4.6.3
kombu==5.1.0
pkg-resources==0.0.0
prompt-toolkit==3.0.19
pytz==2021.1
six==1.16.0
typing-extensions==3.10.0.0
vine==5.0.0
wcwidth==0.2.5
zipp==3.5.0

Other Dependencies

N/A

Minimally Reproducible Test Case

Install Celery, save the following in testapp.py

from celery import Celery

app = Celery('tasks', broker='pyamqp://guest@localhost//')
app.conf.worker_send_task_events = True

and run celery -A testapp worker --loglevel=INFO.

Expected Behavior

In the startup banner, I expect to see task events: ON and for events to be sent.

Actual Behavior

The startup banner says task events: OFF (enable -E to monitor tasks in this worker) and events are not sent.

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

None

Description

The documentation uses CELERY_TASK_RESULT_EXPIRES but that setting does not have any effect in the celery config. CELERY_RESULT_EXPIRES does.

Suggestions