def get_recent_failed_runs_by_run_metadata(key, value, num_runs=10,
                                           start_date=None, session=None):
    session = session or get_session()
    query = db_utils.model_query(models.Run, session).join(
        models.RunMetadata, models.Run.id == models.RunMetadata.run_id).filter(
            models.RunMetadata.key == key,
            models.RunMetadata.value == value)
    query = _filter_runs_by_date(query, start_date)
    return query.filter(models.Run.fails > 0).order_by(
        models.Run.run_at.desc()).limit(num_runs).all()
Get a list of recent failed runs for a given run metadata pair
dataset/ETHPy150Open openstack-infra/subunit2sql/subunit2sql/db/api.py/get_recent_failed_runs_by_run_metadata