ci/bin: gql: Log the caching errors

When using cache and it fails, log the errors, clear the cache and retry
the query bypassing the cache

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
This commit is contained in:
Guilherme Gallo
2023-11-06 22:49:48 -03:00
committed by Marge Bot
parent aa2586b315
commit c4b8c03012

View File

@@ -3,6 +3,7 @@
import logging
import re
import traceback
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
from collections import OrderedDict, defaultdict
from copy import deepcopy
@@ -75,7 +76,17 @@ class GitlabGQL:
if disable_cache:
return run_uncached()
return self._query_cached(gql_file, params, operation_name)
try:
return self._query_cached(gql_file, params, operation_name)
except Exception as ex:
logging.error(f"Cached query failed with {ex}")
# print exception traceback
traceback_str = "".join(traceback.format_exception(ex))
logging.error(traceback_str)
self.invalidate_query_cache()
logging.error("Cache invalidated, retrying without cache")
finally:
return run_uncached()
def _query(
self,