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.')
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)
"""Deploy yanoama based on the node role, either peer or coordinator. """ kernel=Essential() #update services file with temp file, #rest must be done by command line temp_services_file='/tmp/services' f = open(temp_services_file, 'w') f.write('#local services'+'\n') f.write('pilot\t\t'+str(kernel.get_pilot_port())+'/tcp\n') f.write('mongo\t\t'+str(kernel.get_db_port())+'/tcp\n') f.write('mongo_replication\t\t'+str(kernel.get_db_replication_port())+'/tcp\n') f.close() if get_hostname() in kernel.get_coordinators().keys(): """this is a coordinator #here the two-step installation procedure #1) install cron jobs: get_rtt.py and # peering.py #2) install mongodb database as part of amen # monitoring system. """ # # #(1)installing cron jobs ## get_rtt kernel.install_runnable_script('/yanoama/monitoring/get_rtt.py') #install as a cron job install_cron_job("get_rtt.py > /tmp/get_rtt_output.log 2>&1")