Module: Mesa
Branch: main
Commit: c4b8c030125a9c69fdd6804f6258d937359363f9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4b8c030125a9c69fdd6804f6258d937359363f9

Author: Guilherme Gallo <guilherme.ga...@collabora.com>
Date:   Mon Nov  6 22:49:48 2023 -0300

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.ga...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>

---

 bin/ci/gitlab_gql.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/ci/gitlab_gql.py b/bin/ci/gitlab_gql.py
index 3ef6363fe6d..605a0c852d9 100755
--- a/bin/ci/gitlab_gql.py
+++ b/bin/ci/gitlab_gql.py
@@ -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,

Reply via email to