Skip to content

Commit ba51063

Browse files
committed
fix failure when cachefile not yet generated
1 parent 034fc87 commit ba51063

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pypop/prv.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(self, prv_path):
101101
except (pickle.UnpicklingError, ValueError):
102102
try:
103103
self._load_pickle(PRV._generate_event_cache_name(prv_path))
104-
except (pickle.UnpicklingError, ValueError):
104+
except (pickle.UnpicklingError, ValueError, FileNotFoundError):
105105
try:
106106
self._load_prv_and_pcf(prv_path)
107107
self.save(PRV._generate_event_cache_name(prv_path))
@@ -262,7 +262,9 @@ def profile_openmp_regions(self, no_progress=False, ignore_cache=False):
262262

263263
if not ignore_cache:
264264
try:
265-
with zipopen(PRV._generate_region_cache_name(self._prv_path), 'rb') as fh:
265+
with zipopen(
266+
PRV._generate_region_cache_name(self._prv_path), "rb"
267+
) as fh:
266268
self._omp_region_data = pickle.load(fh)
267269
return self._omp_region_data
268270
except (FileNotFoundError, pickle.UnpicklingError):
@@ -464,7 +466,7 @@ def profile_openmp_regions(self, no_progress=False, ignore_cache=False):
464466

465467
self._omp_region_data = pd.concat(rank_stats, names=["rank", "region"])
466468

467-
with zipopen(PRV._generate_region_cache_name(self._prv_path), 'wb') as fh:
469+
with zipopen(PRV._generate_region_cache_name(self._prv_path), "wb") as fh:
468470
pickle.dump(self._omp_region_data, fh)
469471

470472
return self._omp_region_data

0 commit comments

Comments
 (0)