When I run celery workers with sudo, i get the following error:
Running a worker with superuser privileges when the
worker accepts messages serialized with pickl
OK I found the solution!
In celery 3.1 and above, workers with pickle serialization will crash as mentioned in documentation:
Worker will now crash if running as the root user with pickle enabled.
So to use sudo, you need to disable pickle serialization in celery configs.I did it by using json:
app.conf.update(
CELERY_ACCEPT_CONTENT = ['json'],
CELERY_TASK_SERIALIZER = 'json',
CELERY_RESULT_SERIALIZER = 'json',
)
and then if you run using sudo, it will work!