c24e4e3 Group `shutil.rmtree` errors by directory to not flood the ODCS logs.

Authored and Committed by jkaluza 4 years ago
    Group `shutil.rmtree` errors by directory to not flood the ODCS logs.
    
    Without this commit, when `shutil.rmtree` cannot remove some file,
    it prints `log.warning` with a reason. This is OK in most cases, but
    if there are lot of files (like thousands) which cannot be removed,
    the ODCS log file starts growing very fast and eats all the free
    space on filesystem.
    
    In this commit, this is fixed by grouping the errors by directory
    in which they happened. In case some directory contains thousands
    of files which fail to be removed, we only print single log line
    with error related to last file which failed to be removed.
    
    We loose some information by this grouping strategy, but this is OK,
    because in case the files cannot be removed, we need to debug it
    and remove the files manually anyway, so it is OK to just use `ls`
    to find out what's the complete list of files.
    
        
file modified
+23 -5