Skip to content

Commit

Permalink
Remove generator cache directory if it failed
Browse files Browse the repository at this point in the history
If the generator invocation failed for any reason, its output directory
is removed. While this is bad for debugging failing generators, it at
least prevents the next FuseSoC-run to assume, that the generator was
successful and hence a failed generator is retried on the next FuseSoC
run. Since the stderr of the executed command is printed to the user,
the harm for debugging is not that large, so this should be fine.

As an alternative, one could store a file `.success` (or similar) in the
generator directory and only use the cache directory if that file is
present there.
  • Loading branch information
jfrimmel authored and olofk committed Mar 3, 2025
1 parent ce8c933 commit 663b348
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fusesoc/edalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,17 @@ def generate(self):
)
else:
shutil.rmtree(generator_cwd, ignore_errors=True)
self._run(generator_cwd)
try:
self._run(generator_cwd)
except:
# If the generator invocation failed for any reason, its output
# directory is removed. While this is bad for debugging failing
# generators, it at least prevents the next FuseSoC-run to
# assume, that the generator was successful and hence a failed
# generator is retried on the next FuseSoC-run.
logger.debug("Generator failed, removing its output files")
shutil.rmtree(generator_cwd, ignore_errors=False)
raise
# TODO: Release cache lock

cores = []
Expand Down

0 comments on commit 663b348

Please sign in to comment.