From a2fd0e95f27d7a4abd6a7addcf5116714e41bfdf Mon Sep 17 00:00:00 2001 From: josef Date: Thu, 1 Oct 2015 08:34:13 +0200 Subject: adding error handling for incremental build --- monitor/josef_monitor.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'monitor') diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index d5e4254..7dbd3c6 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -73,18 +73,22 @@ class ctlog: if self.build: start_size = self.entries - while self.entries < self.sth["tree_size"]: - tmp_size = self.entries - self.subtree, self.entries = self.fetch_and_increment_subtree(self.entries, self.sth["tree_size"] -1, self.url, self.subtree) - if tmp_size != self.entries: - self.log("Got entries " + str(tmp_size) + " to " \ - + str(self.entries -1 ) + " of " + str(self.sth["tree_size"]-1)) - - if self.entries != start_size: - if verify_subtree(self.sth, self.subtree, self.url): - pass - else: - self.log(ERROR_STR + "Failed to verify newly built subtree!") + try: + while self.entries < self.sth["tree_size"]: + tmp_size = self.entries + self.subtree, self.entries = self.fetch_and_increment_subtree(self.entries, self.sth["tree_size"] -1, self.url, self.subtree) + if tmp_size != self.entries: + self.log("Got entries " + str(tmp_size) + " to " \ + + str(self.entries -1 ) + " of " + str(self.sth["tree_size"]-1)) + + if self.entries != start_size: + if verify_subtree(self.sth, self.subtree, self.url): + pass + else: + self.log(ERROR_STR + "Failed to verify newly built subtree!") + except Exception, e: + print "Failed incremental build for " + self.name + self.log(ERROR_STR + "Failed incremental build. Error: " + str(e)) def fetch_and_increment_subtree(self, first, last, url, subtree =[[]]): new_leafs = [] -- cgit v1.1 From 127018dc079d58b3dc73bc0bee82d83310df399c Mon Sep 17 00:00:00 2001 From: josef Date: Thu, 1 Oct 2015 08:45:45 +0200 Subject: more fine-grained erro handling --- monitor/josef_monitor.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'monitor') diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index 7dbd3c6..4b506e8 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -73,22 +73,27 @@ class ctlog: if self.build: start_size = self.entries - try: - while self.entries < self.sth["tree_size"]: - tmp_size = self.entries + # try: + while self.entries < self.sth["tree_size"]: + tmp_size = self.entries + try: self.subtree, self.entries = self.fetch_and_increment_subtree(self.entries, self.sth["tree_size"] -1, self.url, self.subtree) - if tmp_size != self.entries: - self.log("Got entries " + str(tmp_size) + " to " \ - + str(self.entries -1 ) + " of " + str(self.sth["tree_size"]-1)) - - if self.entries != start_size: - if verify_subtree(self.sth, self.subtree, self.url): - pass - else: - self.log(ERROR_STR + "Failed to verify newly built subtree!") - except Exception, e: - print "Failed incremental build for " + self.name - self.log(ERROR_STR + "Failed incremental build. Error: " + str(e)) + except Exception, e: + print ERROR_STR + "Failed fetch and increment for " + self.name + self.log(ERROR_STR + "Failed fetch and increment tree. Error: " + str(e)) + + if tmp_size != self.entries: + self.log("Got entries " + str(tmp_size) + " to " \ + + str(self.entries -1 ) + " of " + str(self.sth["tree_size"]-1)) + + if self.entries != start_size: + if verify_subtree(self.sth, self.subtree, self.url): + pass + else: + self.log(ERROR_STR + "Failed to verify newly built subtree!") + # except Exception, e: + # print "Failed incremental build for " + self.name + # self.log(ERROR_STR + "Failed incremental build. Error: " + str(e)) def fetch_and_increment_subtree(self, first, last, url, subtree =[[]]): new_leafs = [] -- cgit v1.1 From 810417bab6138470c2b0dda6e74f6ca5640f8f94 Mon Sep 17 00:00:00 2001 From: josef Date: Thu, 1 Oct 2015 08:55:52 +0200 Subject: fix --- monitor/josef_monitor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'monitor') diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index 4b506e8..7000b87 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -80,7 +80,8 @@ class ctlog: self.subtree, self.entries = self.fetch_and_increment_subtree(self.entries, self.sth["tree_size"] -1, self.url, self.subtree) except Exception, e: print ERROR_STR + "Failed fetch and increment for " + self.name - self.log(ERROR_STR + "Failed fetch and increment tree. Error: " + str(e)) + self.log(ERROR_STR + "Failed fetch and increment tree. Current Size: " + str(self.entries) + " Sth: " + str(self.sth) + " Error: " + str(e)) + return if tmp_size != self.entries: self.log("Got entries " + str(tmp_size) + " to " \ -- cgit v1.1