All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: yocto <yocto@yoctoproject.org>,
	Burton Ross <ross.burton@intel.com>,
	"Flanagan, Elizabeth" <elizabeth.flanagan@intel.com>
Subject: [PATCH 2/2] buildslave-janitor: Add in try/except handling to make calls robust against failure
Date: Wed, 19 Mar 2014 14:03:34 +0000	[thread overview]
Message-ID: <1395237814.3808.118.camel@ted> (raw)

There is a suspicion that the command can fail causing the janitor trash
removal process to exit. This adds in some exception handling to deal
with this. It include a timeout to stop it entering nasty loops.

This combined with the previous patch should let us figure out what
error conditions its hitting.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 bin/buildslave-janitor | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/bin/buildslave-janitor b/bin/buildslave-janitor
index 153f18d..2cfef86 100755
--- a/bin/buildslave-janitor
+++ b/bin/buildslave-janitor
@@ -66,11 +66,16 @@ def trash_processor(trashdir):
         print("Not prepared to use a trashdir of /")
         return
     while True:
-        files = os.listdir(trashdir)
-        if files:
-            os.system("ionice -c 3 rm %s -rf" % trashdir)
-        else:
-            time.sleep(30*60) # 30 minutes
+        try:
+            files = os.listdir(trashdir)
+            if files:
+                os.system("ionice -c 3 rm %s -rf" % trashdir)
+            else:
+                time.sleep(30*60) # 30 minutes
+        except Exception as e:
+            print("Exception %s in trash cleaner" % str(e))
+            time.sleep(60) # 1 minute timeout to prevent crazy looping
+            pass
     return
 
 def mirror_processor(mirrordir):





             reply	other threads:[~2014-03-19 14:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 14:03 Richard Purdie [this message]
2014-03-19 14:28 ` [PATCH 2/2] buildslave-janitor: Add in try/except handling to make calls robust against failure Burton, Ross
2014-03-19 15:38   ` Flanagan, Elizabeth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395237814.3808.118.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=elizabeth.flanagan@intel.com \
    --cc=ross.burton@intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.