def create_celery(name, config_obj, inject_version=True, **kwargs):
"""Creates a celery app.
:param config_obj: The configuration object to initiaze with
:param inject_version: bool: Whether or not to inject the application's
version number. Attempts to get version number
using
:func:`twopi_flask_utils.deployment_release.get_release`
:param kwargs: Other arguments to pass to the ``Celery`` instantiation.
:returns: An initialized celery application.
"""
celery = Celery(name, broker=config_obj.CELERY_BROKER_URL, **kwargs)
celery.config_from_object(config_obj)
if inject_version:
celery.version = get_release()
return celery
评论列表
文章目录