python - Setting CELERY_ALWAYS_EAGER to True throws Errors -
i have asynchronous calls in code. this:
send_message_to_install.delay(install, alert.message, badge, code, campaign=alert.campaign, **kwargs)
i not interested in getting results back, important function executed synchronously while running tests - without throwing errors.
while testing, tried set celery_always_eager in settings file true:
if "test" in sys.argv: celery_always_eager = true
i have tried set in tests well:
from django.conf import settings settings.celery_always_eager = true
both attempts make tests throw errors (without ".delay" works fine):
file "/opt/src/slicephone/cloud/users/api.py", line 520, in send_alert campaign=alert.campaign, **kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/celery/app/task.py", line 357, in delay return self.apply_async(args, kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/celery/app/task.py", line 463, in apply_async options = router.route(options, self.name, args, kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/celery/app/routes.py", line 44, in route route = self.lookup_route(task, args, kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/celery/app/routes.py", line 77, in lookup_route return _first_route(self.routes, task, args, kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/celery/utils/functional.py", line 196, in _matcher answer = getattr(maybe_promise(obj), method)(*args, **kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/kombu/utils/functional.py", line 50, in maybe_promise return value.evaluate() file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/celery/utils/functional.py", line 162, in evaluate self._value = super(mpromise, self).evaluate() file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/kombu/utils/functional.py", line 22, in evaluate return self._fun(*self._args, **self._kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/celery/utils/imports.py", line 48, in instantiate return symbol_by_name(name)(*args, **kwargs) file "/opt/virtenvs/django_slice/local/lib/python2.7/site-packages/kombu/utils/__init__.py", line 80, in symbol_by_name module = imp(module_name, package=package, **kwargs) file "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) importerror: no module named tasks
thanks, kev
stupid me. there 'messages.tasks' in celery_routes. no file /messages/tasks.py .
Comments
Post a Comment