def main(): comm = MPI.COMM_WORLD procid = comm.Get_rank() dim = 4 if (len(sys.argv) > 1): dim = int(sys.argv[1]) if procid == 0: print("Starting master on %d ..." % (procid)) master(dim) else: print("Starting slave on %d ..." % (procid)) slave(dim) return 0
def main(): comm = MPI.COMM_WORLD procid = comm.Get_rank() dim = 16 if (len(sys.argv) > 1): dim = int(sys.argv[1]) if procid == 0: print("Starting master for async communication on %d ..." % (procid)) master(dim) else: print("Starting slave for async communication on %d ..." % (procid)) slave() return 0
def configure(self, env, upgrade_type=None, config_dir=None): import params env.set_params(params) slave()
def add_slave( self, mqtt, devices, slave_id, rfid, name, program, modes ): if not rfid in self.slaves.keys(): self.slaves[ rfid ] = slave( mqtt, devices, slave_id, name, rfid, program, modes )
def configure(self, env): import params env.set_params(params) slave()
def configure(self, env, upgrade_type=None, config_dir=None): import params env.set_params(params) Logger.info('Configure Elasticsearch data node') slave()
#help string to print when needed help_string = "SLAVE MODE: python main.py -s | MASTER MODE: python main.py -m" try: #parse arguments opts, args = getopt.getopt(sys.argv[1:], "hsm:") except getopt.GetoptError: #if error print help string and exit print help_string sys.exit(2) # iterate through arguments for opt, arg in opts: # if help mode requested, print help and exit if opt == '-h': print help_string sys.exit() # if slave set start up restful server elif opt in ("-s", "--slave"): print 'Running as a slave' slave.slave() #if master store the config file elif opt in ("-m", "--master"): print 'Running as a master' config_file = arg master.master(config_file) else: print help_string sys.exit(2) #Collect the configured information from all the machines #collect_config("spark1.local","ubuntu","key","sample1/forloop") #collect_info_from_machines(0)