INNER CODE UNIT · Python
kill_cluster
aehrc/VariantSpark · cloud/aws-emr/python/vs_emr/cli.py:289
def kill_cluster(aws_ctx, cluster_id, cluster_id_file):
cluster_id = resolve_cluster_id(aws_ctx, cluster_id, cluster_id_file)
aws_ctx.echo("Stopping cluster with id: %s" % cluster_id)
cmd = " ".join(['aws', 'emr', 'terminate-clusters', '--cluster-id', cluster_id])
output = aws_ctx.aws_run(cmd)
aws_ctx.echo(output)
# add waiting for termination aws emr wait cluster-running/cluster-terminated --cluster-id j-3SD91U2E1L2QX
@cli.command(name='submit-cmd', context_settings=dict(
ignore_unknown_options=True),
help='''Submit a variant-spark step to the EMR cluster created with `start-cluster`.
Multiple steps can be submitted to a single cluster.'''
)
@click.option("--cluster-id", required = False,
help='EMR cluster id e.g. "j-2XON221YYVZMQ".')
@click.option("--cluster-id-file", required = False,
help='Path to the file with the cluster id (as saved by `create-cluster`).')