From 84336a4d3c666f0a499daa3b98bcd2d82aeeb7eb Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 24 May 2017 14:37:40 -0700 Subject: [PATCH] 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 --- nodepool/builder.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nodepool/builder.py b/nodepool/builder.py index 49cd330..054ca70 100644 --- a/nodepool/builder.py +++ b/nodepool/builder.py @@ -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): '''