def doit(self): print self.name(), ": waiting for messages" msg = self.msgfifo.read() print self.name(), ": the sender was", msg["sender"] # Get the configset inside the message configset = msg["configset"] # Did we get a configset inside the message? if gs.ismessage(configset): # Print all key->values pairs print self.name(), ": received a configset. Key-values pairs:" def printmsg(m, indent = "", newline = False): if newline: print for k,v in m.items(): print self.name(), ": ", indent, k, "=", if gs.ismessage(v): printmsg(v, indent + " ", True) else: print v printmsg(configset) # Test existence of a specific parameter print self.name(), ": testing if cache.size parameter exists: cache.size = ", if "cache" in configset and "size" in configset["cache"]: print configset["cache"]["size"] else: print "(not defined)" else: print self.name(), ": received an empty configset." # Reply print self.name(), ": replying" msg["foo"] = 123.456 gs.findReceiver(msg["reply"]).write(msg)
def printmsg(m, indent = "", newline = False): if newline: print for k,v in m.items(): print self.name(), ": ", indent, k, "=", if gs.ismessage(v): printmsg(v, indent + " ", True) else: print v