Skip to content

Commit

Permalink
Some very minor improvement in one error handling and one warning mes…
Browse files Browse the repository at this point in the history
…sage. (#1686)

1. Do not throw error if `clear_instrumentation_reports()` does not have
anything to clear. (The function is useful to avoid accumulating many,
many obsolete profile data files over time)
2. Put some more information in a warning message.
  • Loading branch information
pratyai authored Oct 18, 2024
1 parent 653ec33 commit 4fbeba4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dace/sdfg/sdfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,11 @@ def clear_instrumentation_reports(self):
Clears the instrumentation report folder of this SDFG.
"""
path = os.path.join(self.build_folder, 'perf')
for fname in os.listdir(path):
try:
files = os.listdir(path)
except FileNotFoundError:
return
for fname in files:
if not fname.startswith('report-'):
continue
os.unlink(os.path.join(path, fname))
Expand Down Expand Up @@ -2288,8 +2292,8 @@ def compile(self, output_file=None, validate=True) -> 'CompiledSDFG':
sdfg.name = f'{self.name}_{index}'
index += 1
if self.name != sdfg.name:
warnings.warn('SDFG "%s" is already loaded by another object, '
'recompiling under a different name.' % self.name)
warnings.warn(f"SDFG '{self.name}' is already loaded by another object, recompiling under a different "
f"name '{sdfg.name}'.")

try:
# Fill in scope entry/exit connectors
Expand Down

0 comments on commit 4fbeba4

Please sign in to comment.