python - Celery Connection Error -


i deploying django application celery heroku , struggling connection error. amqp provider claims able access resource on end, , have enough connections. think setup finding celery app in specific worker process, failing acquire proper settings in shell. there way tell connection url task being called is? should celery_app check below handle things correctly?

problem invocation:

$ heroku run bash ~$ python <app>/manage.py shell >>> <app>.management.tasks.tasks import <task> >>> t = <task>() >>> dt = '20140101' >>> t.delay(dt=dt) 

stacktrace:

traceback (most recent call last):   file "<input>", line 4, in <module>   file "/app/.heroku/python/lib/python2.7/site-packages/celery/app/task.py", line 453, in delay     return self.apply_async(args, kwargs)   file "/app/.heroku/python/lib/python2.7/site-packages/celery/app/task.py", line 555, in apply_async     **dict(self._get_exec_options(), **options)   file "/app/.heroku/python/lib/python2.7/site-packages/celery/app/base.py", line 353, in send_task     reply_to=reply_to or self.oid, **options   file "/app/.heroku/python/lib/python2.7/site-packages/celery/app/amqp.py", line 305, in publish_task     **kwargs   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/messaging.py", line 168, in publish     routing_key, mandatory, immediate, exchange, declare)   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 457, in _ensured     interval_max)   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 369, in ensure_connection     interval_start, interval_step, interval_max, callback)   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/utils/__init__.py", line 243, in retry_over_time     return fun(*args, **kwargs)   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 237, in connect     return self.connection   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 741, in connection     self._connection = self._establish_connection()   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 696, in _establish_connection     conn = self.transport.establish_connection()   file "/app/.heroku/python/lib/python2.7/site-packages/kombu/transport/pyamqp.py", line 112, in establish_connection     conn = self.connection(**opts)   file "/app/.heroku/python/lib/python2.7/site-packages/amqp/connection.py", line 165, in __init__     self.transport = create_transport(host, connect_timeout, ssl)   file "/app/.heroku/python/lib/python2.7/site-packages/amqp/transport.py", line 294, in create_transport     return tcptransport(host, connect_timeout)   file "/app/.heroku/python/lib/python2.7/site-packages/amqp/transport.py", line 95, in __init__     raise socket.error(last_err) error: [errno 111] connection refused 

checking config in shell:

~$ python <app>/manage.py shell >>> celery_app import config >>> config.broker_url '<correct amqp resource>' 

env vars:

celeryd_concurrency=1 celery_ignore_result=true celeryd_task_time_limit=60 cloudamqp_url=<amqp url> result_expiry_rate=600 broker_connection_timeout=10 pwd=/app django_settings_module=settings.production django_project_dir=/app/<app> broker_pool_limit=1 home=/app pythonpath=/app:/app/<app>:/app/<app>/<app> 

procfile invocation (works)

web: gunicorn <app>.<app>.wsgi -w 1 --log-file - worker: celery worker --app=<app>.<app> -e -q <app>,celery --loglevel=info  -c 1  --workdir=<app> 

my celery app:

from __future__ import absolute_import os import getenv kombu import exchange, queue django.conf import settings celery import celery   app = celery('<app>')  class config(object):      # list of modules import when celery starts.     celery_imports = ("<imports>",)       broker_connection_retry = true     api_rate_limit = getenv('api_rate_limit')     broker_pool_limit = int(getenv('broker_pool_limit', 1))     broker_url = getenv('cloudamqp_url')     broker_connection_timeout = int(getenv('broker_connection_timeout'))     celeryd_concurrency = int(getenv('celeryd_concurrency'))   app.config_from_object(config)  if __name__ == '__main__':     app.start() 

importing app in init.py in same dir:

from __future__ import absolute_import  # make sure app imported when # django starts shared_task use app. .celery_app import app celery_app  # nolint 

the core problem django's, celery's, , gunicorn's different expected format of django_settings_module. fixed changing django_settings_module=settings.production django_settings_module=<app>.settings.production, fixed shell broker connection broke web , worker processes. working procfile spec

web: cd <app> && gunicorn <app>.wsgi -w 1 --log-file - worker: celery worker --app=<app> -e -q <app>,celery --loglevel=info  -c 1  --workdir=<app> 

the cd before web goofy, works.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -