私はdjangoプロジェクトにRedisとCeleryを一緒に使用しています。
【前提条件】
django==1.5.4
Redis==2.2.4
Celery==3.0.23
django-redis==3.7.1
django-celery==3.0.23
【ディレクトリ構成】
Project/
apps/
app_1/
views.py
def get_something():
utils/
redis.py
def do_stuff(): // do something related with Redis
tasks.py
@task()
def do_stuff(): // execute do_stuff() at redis.py
[問題]
views.pyで、
from utils.redis import do_stuff
from utils.tasks import do_stuff
def get_something():
do_stuff.delay() => Execute task by celery (Normal)
do_stuff() => Executed do_stuff from tasks.py, not from redis.py
Making a recursion error (Unusual)
Expected to execute do_stuff from redis.py
関数名が重なったときに「遅延メソッド」だけで実行するようにCeleryを処理するにはどうすればよいですか?
前もって感謝します。