return (_ple_deployment['path']) try: from yanoama.core.essential import Essential, \ check_hostname, log, build_hosts_file from yanoama.backend.mongo import Mongo except ImportError: sys.path.append(get_install_path()) #import yanoama modules alternatively from yanoama.core.essential import Essential, \ check_hostname, log, build_hosts_file from yanoama.backend.mongo import Mongo if __name__ == '__main__': db=Mongo() kernel=Essential() for coordinator in kernel.get_coordinators(): if db.am_i_a_member_of_this(coordinator): build_hosts_file(coordinator) sys.exit(0) build_hosts_file() hostname='coordinator' log(hostname+' ('+check_hostname(hostname)+'), done.') sys.exit(0)
if __name__ == '__main__': if not online(): log('offline') sys.exit(-1) log('run get_rtt... ') config=ConfigObj(PLE_CONF_FILE) nodes,filename=getIntialNodes(config['username'],config['password'],config['host'],config['slice'],config['key'],sys.argv) alive_nodes={} try: myops_nodes=MyOps().getAvailableNodes() monitor_nodes=Monitor(config['username'],config['password'],config['host'],config['slice'],config['key'],myops_nodes.keys()).getHealthyNodes() alive_nodes=dict(myops_nodes.items()+monitor_nodes.items()) except: print 'failed to get myops information: myops_nodes=MyOps().getAvailableNodes()' bad_nodes=[] #checking existing nodes, and excluding bad nodes checkNodes(nodes, alive_nodes, bad_nodes) #checking remaining potential new nodes checkNodes(nodes, {}, [], alive_nodes) #clean up bad nodes for hostname in bad_nodes: del nodes[hostname] saveNodes(nodes, filename) db=Mongo() db.save_raw_nodes(nodes) log('done. ') sys.exit(0)
from yanoama.core.essential import Essential, \ get_hostname, log from yanoama.backend.mongo import Mongo except ImportError: sys.path.append(get_install_path()) #import yanoama modules alternatively from yanoama.core.essential import Essential, \ get_hostname, log from yanoama.backend.mongo import Mongo if __name__ == '__main__': kernel=Essential() db = Mongo() local_peers=db.get_peers() for coordinator in kernel.get_coordinators(get_hostname()): peers=db.get_peers(coordinator) to_be_removed=[] for hostname in peers.keys(): if hostname in local_peers: if local_peers[hostname]>peers[hostname]: to_be_removed.append(hostname) for hostname in to_be_removed: del local_peers[hostname] db.save_peers(local_peers) #log/print out to the standard output log('current number of members:'+str(len(local_peers.keys()))+', done.')
raise e _ple_deployment = config.get('ple_deployment', {"path":"/home/upmc_aren/yanoama"}) return (_ple_deployment['path']) try: from yanoama.backend.mongo import Mongo from yanoama.core.essential import log,\ online,getIntialNodes except ImportError: sys.path.append(get_install_path()) #import yanoama modules alternatively from yanoama.backend.mongo import Mongo from yanoama.core.essential import log,\ online,getIntialNodes if __name__ == '__main__': if not online(): log('offline') sys.exit(-1) log('run get_rtt... ') config=ConfigObj(PLE_CONF_FILE) nodes,filename=getIntialNodes(config['username'],config['password'],config['host'],config['slice'],config['key'],sys.argv) print "nodes:"+str(len(nodes)) db=Mongo() db.save_raw_nodes(nodes) print len(db.get_peers().keys()) print 'ok'