aiplan4eu/unified-planning

Cleanup temp directory after generating plans.

MFaisalZaki opened this issue · 2 comments

Removing the temp directory after generating the plans will be better. Note that generating lots of plans without cleaning such a directory will take more inodes, which will impact the filesystem and would easily lead to consuming all inodes, preventing the system from creating new files.

The change is simple and can be done at this line:

tmpdir = tempfile.TemporaryDirectory()
# Do the planning stuff

# Invoke cleanup after solving the planning task.
tmpdir.cleanup()

Thanks @speckdavid for highlighting this.

We use the tempfile with the with statement. It automatically deletes the directory at the end.

See here and here.

This makes sense. Thanks a lot for highlighting this.