def run(self, args): if args.start is not None: ctx = Context(is_master=True, master_addr=args.start, working_dir=args.working) ctx.start_master() self.logger.info("start master at: %s" % ctx.master_addr) elif args.kill is not None: ctx = Context(is_client=True, master_addr=args.kill) ctx.kill_master() self.logger.info("kill master at: %s" % ctx.master_addr) elif args.list is not None: ctx = Context(is_client=True, master_addr=args.list) self.logger.info("list workers at master: %s" % ctx.master_addr) for worker, status in ctx.list_workers(): self.logger.info("====> worker: %s, status: %s" % (worker, status)) else: self.logger.error("unknown command options")
def run(self, args): if args.start is not None: ctx = Context(is_master=True, master_addr=args.start) ctx.start_master() self.logger.info('start master at: %s' % ctx.master_addr) elif args.kill is not None: ctx = Context(is_client=True, master_addr=args.kill) ctx.kill_master() self.logger.info('kill master at: %s' % ctx.master_addr) elif args.list is not None: ctx = Context(is_client=True, master_addr=args.list) self.logger.info('list workers at master: %s' % ctx.master_addr) for worker, status in ctx.list_workers(): self.logger.info('====> worker: %s, status: %s' % (worker, status)) 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()