def AddStats(ClientStats): """Test function""" global NodesCheckedin, NodesLock # print "In AddStats" stats = json.loads(ClientStats) for host in stats.keys(): for filesystem in stats[host]: if filesystem not in BWFileSystems.keys(): sys.stderr.write ("skipping " + filesystem + ", not a known file system \n") continue else: AggrQueueDict[filesystem].put(stats[host][filesystem]) with NodesLock: NodesCheckedin += 1 return True
sys.exit(-1) try: NumNodes = int(NumNodes) except ValueError: sys.stderr.write("Invalid PBS_NUM_NODES value,", NumNodes," exiting. \n") sys.exit(-1) try: Port = int(JobID.split(".")[0]) except ValueError: sys.stderr.write("Invalid PBS_JOBID value,", JobID," exiting. \n") sys.exit(-1) # print "JobID is", JobID for fs in BWFileSystems.keys(): AggrQueueDict[fs] = Queue.Queue() AggrThreads.append(Thread(target=AggregateStats, args=(fs,))) AggrThreads[-1].start() http_server = pyjsonrpc.ThreadingHttpServer( server_address=(gethostname(), Port), RequestHandlerClass=RequestHandler ) # Start server in a different thread ServerThread = Thread(target=runServer) ServerThread.start() for thrd in AggrThreads: