def main(args=None): arg_parser = ArgumentParser(description=DESCRIPTION) arg_parser.add_argument("--file", default=None) arg_parser.add_argument("--base64", default=None) PulsarManagerConfigBuilder.populate_options(arg_parser) args = arg_parser.parse_args(args) config_builder = PulsarManagerConfigBuilder(args) manager, app = manager_from_args(config_builder) try: job_config = __load_job_config(args) submit_job(manager, job_config) wait_for_job(manager, job_config) except BaseException: log.exception("Failure submitting or waiting on job.") finally: app.shutdown()
def run_server_for_job(args): config_builder = PulsarManagerConfigBuilder(args) manager, app = manager_from_args(config_builder) try: job_config = _load_job_config(args) submit_job(manager, job_config) wait_for_job(manager, job_config) except BaseException: log.exception("Failure submitting or waiting on job.") finally: app.shutdown()
def main(argv=None): arg_parser = ArgumentParser(description=DESCRIPTION, ) arg_parser.add_argument("--master", default=None, required=True) PulsarManagerConfigBuilder.populate_options(arg_parser) args = arg_parser.parse_args(argv) ensure_mesos_libs() config_builder = PulsarManagerConfigBuilder(args) config_builder.setup_logging() config = config_builder.load() run(master=args.master, manager_options=config_builder.to_dict(), config=config)
def run_task(): try: log.info("Running task %s" % task.task_id.value) task_data = from_base64_json(task.data) manager_options = task_data["manager"] config_builder = PulsarManagerConfigBuilder(**manager_options) manager, pulsar_app = manager_from_args(config_builder) job_config = task_data["job"] submit_job(manager, job_config) self.__task_update(driver, task, mesos_pb2.TASK_RUNNING) wait_for_job(manager, job_config) self.__task_update(driver, task, mesos_pb2.TASK_FINISHED) pulsar_app.shutdown() except Exception: log.exception("Failed to run, update, or monitor task %s" % task) raise
def main(): ensure_mesos_libs() arg_parser = ArgumentParser( description=DESCRIPTION, ) arg_parser.add_argument("--master", default=None, required=True) PulsarManagerConfigBuilder.populate_options(arg_parser) args = arg_parser.parse_args() config_builder = PulsarManagerConfigBuilder(args) config_builder.setup_logging() config = config_builder.load() run( master=args.master, manager_options=config_builder.to_dict(), config=config )
def add_common_submit_args(arg_parser): arg_parser.add_argument("--file", default=None) arg_parser.add_argument("--base64", default=None) PulsarManagerConfigBuilder.populate_options(arg_parser)