def run(self, args): if args.start is not None and args.master is not None: ctx = Context(master_addr=args.master, ip=args.start) ctx.start_worker() self.logger.info('start worker at: %s' % ctx.worker_addr) else: self.logger.error('unknown command options')
def testMasterWorker(self): ctx = Context(is_master=True, master_addr='127.0.0.1', working_dir=self.working_dir) master = ctx.start_master() ctx.start_worker() master.run_job(self.job_name, wait_for_workers=True) while master.has_running_jobs(): time.sleep(5) master.shutdown()