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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -