@app.route('/global/<clusterid>/checks/state/<state>')
@login_required
def global_check_state(clusterid, state):
    """Get a list of all checks in provided state for a given cluster"""
    if clusterid not in app.config['GLOBAL_CLUSTERS']:
        abort(400)
    if state in VALID_STATES:
        ckey = '%s:%s' % (clusterid, state)
        cached = cache.get(ckey)
        if cached:
            return jsonify({clusterid: cached})
        else:
            q = _get_remote_checks(clusterid, state)
        if q:
            cache.set(ckey, q)
            return jsonify({clusterid: q})
        else:
            abort(500)
    else:
        abort(400)
dataset/ETHPy150Open pandemicsyn/stalker/stalkerweb/stalkerweb/views.py/global_check_state/original