def status(address: str): app_status = ServeSubmissionClient(address).get_status() if app_status is not None: print( yaml.safe_dump(app_status, default_flow_style=False, sort_keys=False))
def info(address: str, json_format=bool): app_info = ServeSubmissionClient(address).get_info() if app_info is not None: if json_format: print(json.dumps(app_info, indent=4)) else: print(yaml.dump(app_info))
def delete(address: str, yes: bool): if not yes: click.confirm( f"\nThis will shutdown the Serve application at address " f'"{address}" and delete all deployments there. Do you ' "want to continue?", abort=True, ) ServeSubmissionClient(address).delete_application() cli_logger.newline() cli_logger.success("\nSent delete request successfully!\n") cli_logger.newline()
def deploy(config_file_name: str, address: str): with open(config_file_name, "r") as config_file: config = yaml.safe_load(config_file) # Schematize config to validate format. ServeApplicationSchema.parse_obj(config) ServeSubmissionClient(address).deploy_application(config) cli_logger.newline() cli_logger.success( "\nSent deploy request successfully!\n " "* Use `serve status` to check deployments' statuses.\n " "* Use `serve config` to see the running app's config.\n") cli_logger.newline()
def status(address: str): app_status = ServeSubmissionClient(address).get_status() if app_status is not None: print(json.dumps(app_status["statuses"], indent=4))
def config(address: str): app_info = ServeSubmissionClient(address).get_info() if app_info is not None: print(yaml.safe_dump(app_info, sort_keys=False))