Celery 3 and bulb integration

I am trying to get a basic example of this:

http://flask.pocoo.org/docs/patterns/celery/

Therefore, the article proposes to place this in the task module:

from celery import Celery

def make_celery(app):
    celery = Celery(app.import_name, broker=app.config['CELERY_BROKER_URL'])
    celery.conf.update(app.config)
    TaskBase = celery.Task
    class ContextTask(TaskBase):
        abstract = True
        def __call__(self, *args, **kwargs):
            with app.app_context():
                return TaskBase.__call__(self, *args, **kwargs)
    celery.Task = ContextTask
    return celery

and this is a flask application.

from flask import Flask

flask_app = Flask(__name__)
flask_app.config.update(
    CELERY_BROKER_URL='redis://localhost:6379',
    CELERY_RESULT_BACKEND='redis://localhost:6379'
)
celery = make_celery(flask_app)


@celery.task()
def add_together(a, b):
    return a + b    

But for now, this makes no sense what is happening.

Can anyone suggest a simple working example of Flask-Celery 3.

Hello,

Charles

+4
source share
1 answer

Github Repo for celery cones

I quote the author

FROM CELERY 3.0 THIS LIBRARY IS NOT MORE NEEDED, INSTEAD OF YOU SHOULD USE THE STANDARD CELERY API

For this reason, there is no need to use celery cones; celery is independent of the bulb. Please use good Flask samples.

-2

Source: https://habr.com/ru/post/1529888/


All Articles