We are using Celery and RabbitMQ to process jobs. They are both being run by Supervisor so that they can be alive.
Some jobs expect a file in the home directory of a user A. So we run the celery worker as user A in supervisor. But when the job is being processed it is expanding the '~' as '/root'. Why is this happening? How can we ensure that it is able to find the home directory by expanding '~' as our code expects files following a '~' in a lot of places?
You probably need to use
supervisord
'suser
configuration directive to run the celery processes as a dedicated user instead ofroot
.also you should explicity chdir to a working dir - either in your celery code or use the supervisor
directory
setting.If you want to rely on
~
working you should probably set the invironment variable$HOME
also. However~
is a shell expansion which may not always work. The most portable solution is to rely on thedirectory
setting./etc/supervisor.d/celery.conf