Skip to content

Commit 2b9c24e

Browse files
authored
[CACHE] Handle corrupted cache (#8923)
1 parent 5d17897 commit 2b9c24e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

backends/nvidia/driver.py

Whitespace-only changes.

python/triton/runtime/cache.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ def get_group(self, filename: str) -> Optional[Dict[str, str]]:
7575
if not self.has_file(grp_filename):
7676
return None
7777
grp_filepath = self._make_path(grp_filename)
78-
with open(grp_filepath) as f:
79-
grp_data = json.load(f)
78+
try:
79+
with open(grp_filepath) as f:
80+
grp_data = json.load(f)
81+
except Exception:
82+
# exit on corrupted cache.
83+
return None
8084
child_paths = grp_data.get("child_paths", None)
8185
# Invalid group data.
8286
if child_paths is None:
@@ -214,8 +218,12 @@ def get_group(self, filename: str) -> Optional[Dict[str, str]]:
214218
grp_filepath = self.get_file(grp_filename)
215219
if grp_filepath is None:
216220
return None
217-
with open(grp_filepath) as f:
218-
grp_data = json.load(f)
221+
try:
222+
with open(grp_filepath) as f:
223+
grp_data = json.load(f)
224+
except Exception:
225+
# exit on corrupted cache.
226+
return None
219227
child_paths = grp_data.get("child_paths", None)
220228

221229
result = None

0 commit comments

Comments
 (0)