I am using beaker cache to cache the output of a function.
When I invalidate the cache from flask uwsgi app, it did not reflect in celery app and vice versa.
On further investigation found that beaker using inspect.getsourcefile(func)
for unique key to store in redis.
Now the problem is: In flask uwsgi app, the path to load function shows up as
./myproject/db_api.py
while in celery it shows up as:
/opt/myproject/db_api.py.
How do I make sure that the inspect.getsourcefile(func)
function returns same path in both cases?
Either making celery set the path as ./myporject/db_api.py or flask load the path as /opt/myproject/db_api.py is fine.
Celery is being run as a daemon with CELERYD_CHDIR='/opt'
in /etc/default/celeryd. In celeryconfig.py
I have CELERY_IMPORTS = ('myproject.controllers.celerytasks.cache_invalidate')
Flask is being run by uwsig with an .ini file on ubuntu with following config:
[uwsgi]
module = myproject
callable = app
chdir = /opt