I just need to run the async task after calling the route. The response should be returned after starting the task. How can I do this without using RabbitMQ and Celery in python.
@app.route('/preprocess')
def pre_process():
thr = threading.Thread(target=PreProcessor().initiate_preprocess_task())
thr.start()
return "Pre-process task initiated!"
if __name__ == '__main__':
app.run(threaded=True, use_reloader=True)
source
share