1

Basically, I have flask app which is hosted on Azure instance. when I post some data at API endpoint celery start a process in background and API send a response immediately to the client.

here is tasks.py basic sample:

from celery import Celery

app = Celery('tasks', broker ='amqp://localhost//')

@app.task
def reverse(main):
        return main[::-1]

Error:enter image description here

Basic flask Example:

from flask import Flask
from flask import request
from tasks import *

app = Flask(__name__)

@app.route('/params',methods =['POST'])
def get_url():
    main = request.args.get('main')
    reverse.delay(main)
    return main
if __name__ == "__main__":
    app.run()

again, flask app is running on azure instance. do I have change localhost to a IP in tasks.py

wizard
  • 336
  • 3
  • 18
  • There are a few possible causes for this. Have you seen: https://stackoverflow.com/questions/9769496/celery-received-unregistered-task-of-type-run-example Setting the public IP of the instance is helpful in these situations too, if you can do that – duhaime Aug 29 '18 at 13:39
  • @duhaime acutally, setting public ip is excellent choice. can you guide me how to do that. – wizard Aug 29 '18 at 14:41
  • sure, you just need to run `curl ipinfo.io/ip` from the Azure instance itself – duhaime Aug 29 '18 at 14:59
  • Have you register your task in the configuration file of Celery? – stamaimer Aug 30 '18 at 01:30
  • @duhaime i set public ip in broker_url. still getting same error. – wizard Aug 30 '18 at 09:23

0 Answers0