for service in self.node.services: msg = [service, Conf.PPP_HEARTBEAT] backend.send_multipart(msg) heartbeat_at = time.time() + Conf.HEARTBEAT_INTERVAL expired = [] t = time.time() for address,service in self.node.services.iteritems(): if t > service.expiry: # Worker expired expired.append(address) for address in expired: logger.info("Service expired: %s" % address) self.node.services.pop(address, None) #update node of factory FactoryPatternExector.updatePhysicalNode(self.node.calRes()) #end while true #end def start() #end class NodeDademon if __name__ == "__main__" : def handler(signm, frame): global pyroLoopCondition pyroLoopCondition = False logger.warning("got signal %d, exit now", signm) sys.exit(1) signal.signal(signal.SIGTERM, handler) signal.signal(signal.SIGABRT, handler) NodeDademon("localhost",Conf.getNodeDefaultPort(),socket.gethostname())
expired = [] t = time.time() for address, service in self.node.services.iteritems(): if t > service.expiry: # Worker expired expired.append(address) for address in expired: logger.info("Service expired: %s" % address) self.node.services.pop(address, None) #update node of factory FactoryPatternExector.updatePhysicalNode(self.node.calRes()) #end while true #end def start() #end class NodeDademon if __name__ == "__main__": def handler(signm, frame): global pyroLoopCondition pyroLoopCondition = False logger.warning("got signal %d, exit now", signm) sys.exit(1) signal.signal(signal.SIGTERM, handler) signal.signal(signal.SIGABRT, handler) NodeDademon("localhost", Conf.getNodeDefaultPort(), socket.gethostname())
import sys import os import socket sys.path.extend( [os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')]) from opencluster.nodedaemon import NodeDademon from opencluster.configuration import Conf if __name__ == "__main__": if len(sys.argv) != 2: print "Usage : %s LocalIP" % sys.argv[0] sys.exit(1) NodeDademon(sys.argv[1], Conf.getNodeDefaultPort(), "".join(sys.argv[1].split(".")))
import sys import os import socket sys.path.extend([os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')]) from opencluster.nodedaemon import NodeDademon from opencluster.configuration import Conf if __name__ == "__main__" : if len(sys.argv) != 2 : print "Usage : %s LocalIP" % sys.argv[0] sys.exit(1) NodeDademon(sys.argv[1],Conf.getNodeDefaultPort(),"".join(sys.argv[1].split(".")))