Cleanup failed upload records

Failed uploads happen when things like clouds disappearing happen. This
then results in hundreds or even thousands of upload records all failed
while we wait for the cloud to return. THis is noise that makes it hard
to debug actual problems with image uploads as you can't easily see what
is current.

Avoid this noise in output by cleaning up Failed records after they have
been recorded.

Change-Id: Ife0cf3dd0d9af6cf7a587e9906726c67271b0d5c
This commit is contained in:
Clark Boylan 2017-05-24 14:37:40 -07:00
parent 6e34b65d62
commit 84336a4d3c
1 changed files with 6 additions and 1 deletions

View File

@ -367,7 +367,9 @@ class CleanupWorker(BaseWorker):
marked for deleting.
'''
cruft = self._zk.getUploads(image, build_id, provider,
states=[zk.UPLOADING, zk.DELETING])
states=[zk.UPLOADING,
zk.DELETING,
zk.FAILED])
for upload in cruft:
if (upload.state == zk.UPLOADING and
not self._inProgressUpload(upload)
@ -385,6 +387,9 @@ class CleanupWorker(BaseWorker):
elif upload.state == zk.DELETING:
self.log.info("Removing deleted upload and record: %s" % upload)
self._deleteUpload(upload)
elif upload.state == zk.FAILED:
self.log.info("Removing failed upload and record: %s" % upload)
self._deleteUpload(upload)
def _cleanupImage(self, known_providers, image):
'''