dmwm / CRABServer

15 stars 38 forks source link

[cleanup] Make sure that files are closed after being opened. #6934

Open mapellidario opened 2 years ago

mapellidario commented 2 years ago

description

During the python3 migration, we notices a couple of occurrences of files that are opened, read but not closed.

A couple of examples are

desired solution

We should make sure that every file is opened within a context manager, so that we are sure it is going to be properly closed, eventually.

belforte commented 2 years ago

of course cmscp.py is a script which is executed once in per job in the WorkerNode. So everything is closed when it exits. ANd besides this, cmscp.py could surely use a good cleanup and refactoring. But we need to be very careful with persistent processes which may result in file descriptor leaks.