flask - How to have server call another server in Python with threading? -


i have pipeline request hits 1 server, , server calls server , 1 executes job 2 seconds, should return main server minor computation, return client. problem current setup blocks if number of concurrent requests > number of workers, , don't know how use python threading make async. ideas on how implement this?

main server -> outside server -> 2 seconds -> main server

:edit

the line takes 2 seconds 1 "find_most_similar_overall(image_name, classifier, labels)" call. function takes 2 seconds, means worker stops right there.

@app.route("/shoes/<_id>") def classify_shoe(_id):

if request.method == 'get':     unique_user = request.cookies.get('uniqueuser')      shoe = shoe.query.filter_by(id = _id)      if shoe.count() not 0:         shoe = shoe.first()         image_name = shoe.image_name         shoes,category = find_most_similar_overall(image_name, classifier, labels)         return render_template('category.html', same_shoes = similar_shoes,shoes=shoes,main_shoe=shoe,category=category, categories=shoe_categories) 


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -