X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=monitor%2Fwrapper%2Fplc.py;h=d2d627fad32a347087b82ce1ff14f503e73339ed;hb=af5e1cdc43c4b779a34015cc71433bdac3cd9806;hp=37519a5d6ec2383147293e3135122eb713f2fbb0;hpb=66c4742c05622d6c53368e2890670eaefa5345f3;p=monitor.git diff --git a/monitor/wrapper/plc.py b/monitor/wrapper/plc.py index 37519a5..d2d627f 100644 --- a/monitor/wrapper/plc.py +++ b/monitor/wrapper/plc.py @@ -56,6 +56,8 @@ except: api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True) +global_error_count = 0 + class PLC: def __init__(self, auth, url): self.auth = auth @@ -67,7 +69,17 @@ class PLC: if method is None: raise AssertionError("method does not exist") - return lambda *params : method(self.auth, *params) + try: + return lambda *params : method(self.auth, *params) + except ProtocolError: + traceback.print_exc() + global_error_count += 1 + if global_error_count >= 10: + print "maximum error count exceeded; exiting..." + sys.exit(1) + else: + print "%s errors have occurred" % global_error_count + raise Exception("ProtocolError continuing") def __repr__(self): return self.api.__repr__()