You're right, there should be a final unprotected shutil.rmtree in there.
 I'll add a logger as well.  I'll get to this in the afternoon.


On Thu, Oct 3, 2013 at 11:08 AM, Dag Sverre Seljebotn <
notifications@github.com> wrote:

> In hashdist/core/fileutils.py:
>
> > @@ -43,6 +44,19 @@ def silent_unlink(path):
> >          if e.errno != errno.ENOENT:
> >              raise
> >
> > +def robust_rmtree(path):
> > +    """Robustly tries to delete paths.
> > +
> > +    Retries several times (with increasing delays) if an OSError occurs.
> > +    """
> > +
> > +    for i in range(5):
> > +        try:
> > +            shutil.rmtree(path)
> > +            break
> > +        except OSError, e:
> > +            time.sleep(i)
>
> I'd take a logger as input, and logg INFO on retrying. The caller could
> catch the OSError and do logger.warning if it couldn't be removed (but
> silently continue...)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/hashdist/hashdist/pull/116/files#r6743609>
> .
>