def execute(args: typing.NamedTuple): spark_client = aztk.spark.Client(config.load_aztk_screts()) if spark_client.stop_job_app(args.job_id, args.app_name): log.info("Stopped app {0}".format(args.app_name)) else: log.error("App with name {0} does not exist or was already deleted")
def execute(args: typing.NamedTuple): spark_client = aztk.spark.Client(config.load_aztk_screts()) cluster_id = args.cluster_id if not args.force: confirmation_cluster_id = input( "Please confirm the id of the cluster you wish to delete: ") if confirmation_cluster_id != cluster_id: log.error( "Confirmation cluster id does not match. Please try again.") return if spark_client.delete_cluster(cluster_id): log.info("Deleting cluster %s", cluster_id) else: log.error("Cluster with id '%s' doesn't exist or was already deleted.", cluster_id)
def execute(args: typing.NamedTuple): spark_client = aztk.spark.Client(config.load_aztk_screts()) job_id = args.job_id if not args.force: # check if job exists before prompting for confirmation spark_client.get_job(job_id) confirmation_cluster_id = input( "Please confirm the id of the cluster you wish to delete: ") if confirmation_cluster_id != job_id: log.error( "Confirmation cluster id does not match. Please try again.") return if spark_client.delete_job(job_id): log.info("Deleting Job %s", job_id) else: log.error("Job with id '%s' doesn't exist or was already deleted.", job_id)
def main(): parser = argparse.ArgumentParser(prog=constants.CLI_EXE) setup_common_args(parser) subparsers = parser.add_subparsers( title="Available Softwares", dest="software", metavar="<software>") subparsers.required = True spark_parser = subparsers.add_parser( "spark", help="Commands to run spark jobs") spark.setup_parser(spark_parser) args = parser.parse_args() parse_common_args(args) try: run_software(args) except batch_error.BatchErrorException as e: utils.print_batch_exception(e) except aztk.error.AztkError as e: log.error(e.message)