Bug 1408224 - Avoid confusing errors in automation logs when failing to purge toolchain cache. r?mshal
For some reason, Windows builders are setup in a way that prevents a
task from purging the toolchain cache of old files. Until that is
figured out and fixed, all the error message related to that achieves is
confuse people because the treeherder Failure Classification tab shows
them first. Practically speaking, the error doesn't prevent anything
from working properly. The worst that can happen is disk space running
out because of the toolchain cache being filled up, which would lead to
actual errors.
As the error happens on very many windows build, that leads to a lot of
errors being bucketed on
bug 1391811, while they may well be varying
unrelated issues.
It also leads to people thinking their try builds fail because of that,
when they aren't (e.g.
bug 1408212).
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -739,17 +739,23 @@ class ArtifactPersistLimit(PersistLimit)
files = sorted(self.files, key=lambda f: f.stat.st_atime)
kept = []
while len(files) > self.file_limit and \
self._files_size >= self.size_limit:
f = files.pop(0)
if f.path in self._downloaded_now:
kept.append(f)
continue
- fs.remove(f.path)
+ try:
+ fs.remove(f.path)
+ except WindowsError:
+ # For some reason, on automation, we can't remove those files.
+ # So for now, ignore the error.
+ kept.append(f)
+ continue
self.log(logging.INFO, 'artifact',
{'filename': f.path},
'Purged artifact {filename}')
self._files_size -= f.stat.st_size
self.files = files + kept
def remove_all(self):
from dlmanager import fs