简体   繁体   中英

Celery Remote task Blocking Request

I've a problem with remote task calling via tornado app with REST call . In my case I've tasks that working on another machine , and another rest api working on another machine .

 from flask import Flask 

 celery_obj = //CELERY .

 @app.route("/task1")
 def func():
     celery_obj.send_task(name="tasks.task1", args=[])

When I start the application and send the request to the /taksk1 endpoint, flask app cannot reply anything .

What is the reason of this problem . Please help.

celery_obj needs to be the celery application that you are sending it to with a minimum of the broker url specified.

eg,


from celery.app import Celery
celery = Celery(broker='redis://127.0.0.1/1')
celery.send_task('task.name', kwargs={})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM