[gnome-continuous] ircbot: skip task if status cannot be read
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous] ircbot: skip task if status cannot be read
- Date: Mon, 19 May 2014 12:35:31 +0000 (UTC)
commit 05c7537cd768223f905daf09aa46f01ad12f0275
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Thu May 15 16:52:22 2014 +0200
ircbot: skip task if status cannot be read
extras/ircbot/bot.py | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/extras/ircbot/bot.py b/extras/ircbot/bot.py
index 4d81158..ae3aa35 100644
--- a/extras/ircbot/bot.py
+++ b/extras/ircbot/bot.py
@@ -92,22 +92,23 @@ class BuildGnomeOrg(irc.IRCClient):
def _get_task_state(self, taskname):
current_task_path = os.path.join(self._workdir, 'results/tasks/%s/%s/' % (taskname, taskname))
meta_path = os.path.join(current_task_path, 'meta.json')
- if not os.path.exists(meta_path):
- return None, ""
-
- f = open(meta_path)
- metadata = json.load(f)
- f.close()
-
- status_path = os.path.join(current_task_path, 'status.txt')
- if os.path.exists(status_path):
- f = open(status_path)
- status_msg = f.read().strip()
+ try:
+ f = open(meta_path)
+ metadata = json.load(f)
f.close()
- else:
- status_msg = ''
- return metadata, status_msg
+ status_path = os.path.join(current_task_path, 'status.txt')
+ if os.path.exists(status_path):
+ f = open(status_path)
+ status_msg = f.read().strip()
+ f.close()
+ else:
+ status_msg = ''
+
+ return metadata, status_msg
+ except Exception as e:
+ print("Error occurred in _get_task_state(%s): %s" % (taskname, e.message))
+ return None, ""
def _update_task_state(self, taskname):
metadata, status_msg = self._get_task_state(taskname)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]