results = None

@app.route('/')
def index():
    global results
results = [pool.apply_async(do_work) for n in range(20)]
return render_template('index.html')

@app.route('/api/v1.0/progress')
def progress():
    global results
total = len(results)
done, errored = get_progress(results)
return jsonify({'total': total, 'done': done, 'errored': errored})
Show a progress bar for my multithreaded process