From: Claudio-Daniel Freire Date: Sat, 24 Sep 2011 07:21:20 +0000 (+0200) Subject: Trap errors in dropped packet trace dumps - no need to break the whole overlay if... X-Git-Tag: nepi-3.0.0~223 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=cb617cf5a39c6222701ca4cb43eaa668ea2a2885;p=nepi.git Trap errors in dropped packet trace dumps - no need to break the whole overlay if something goes wrong there --- diff --git a/src/nepi/testbeds/planetlab/scripts/classqueue.py b/src/nepi/testbeds/planetlab/scripts/classqueue.py index cfc1c2b8..412a0a49 100644 --- a/src/nepi/testbeds/planetlab/scripts/classqueue.py +++ b/src/nepi/testbeds/planetlab/scripts/classqueue.py @@ -229,11 +229,15 @@ class ClassQueue(object): def dump_stats(self, astats=astats, dstats=dstats, dump_count=dump_count): if dump_count[0] >= 10000: - dstatsstr = "".join(['%s:%s\n' % (key, value) for key, value in dstats.items()]) - astatsstr = "".join(['%s:%s\n' % (key, value) for key, value in astats.items()]) - fd = open('dropped_stats', 'w') - iovec.writev(fd.fileno(), "Dropped:\n", dstatsstr, "Accepted:\n", astatsstr) - fd.close() + try: + dstatsstr = "".join(['%s:%s\n' % (key, value) for key, value in dstats.items()]) + astatsstr = "".join(['%s:%s\n' % (key, value) for key, value in astats.items()]) + fd = open('dropped_stats', 'w') + iovec.writev(fd.fileno(), "Classes: ", _classes, "\nDropped:\n", dstatsstr, "Accepted:\n", astatsstr) + fd.close() + except: + # who cares + pass dump_count[0] = 0 else: dump_count[0] += 1