Skip to content
Snippets Groups Projects
Commit c49a4049 authored by Miguel Peralvo's avatar Miguel Peralvo Committed by Sean Owen
Browse files

[SPARK-5668] Display region in spark_ec2.py get_existing_cluster()

Show the region for the different messages displayed by get_existing_cluster(): The search, found and error messages.

Author: Miguel Peralvo <miguel.peralvo@gmail.com>

Closes #4457 from MiguelPeralvo/patch-2 and squashes the following commits:

a5514c8 [Miguel Peralvo] Update spark_ec2.py
0a837b0 [Miguel Peralvo] Update spark_ec2.py
3923f36 [Miguel Peralvo] Update spark_ec2.py
4ecd9f9 [Miguel Peralvo] [SPARK-5668] Display region in spark_ec2.py get_existing_cluster()
parent 59272dad
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ def parse_args():
help="Master instance type (leave empty for same as instance-type)")
parser.add_option(
"-r", "--region", default="us-east-1",
help="EC2 region zone to launch instances in")
help="EC2 region used to launch instances in, or to find them in")
parser.add_option(
"-z", "--zone", default="",
help="Availability zone to launch instances in, or 'all' to spread " +
......@@ -614,7 +614,8 @@ def launch_cluster(conn, opts, cluster_name):
# Get the EC2 instances in an existing cluster if available.
# Returns a tuple of lists of EC2 instance objects for the masters and slaves
def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
print "Searching for existing cluster " + cluster_name + "..."
print "Searching for existing cluster " + cluster_name + " in region " \
+ opts.region + "..."
reservations = conn.get_all_reservations()
master_nodes = []
slave_nodes = []
......@@ -632,9 +633,11 @@ def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
return (master_nodes, slave_nodes)
else:
if master_nodes == [] and slave_nodes != []:
print >> sys.stderr, "ERROR: Could not find master in group " + cluster_name + "-master"
print >> sys.stderr, "ERROR: Could not find master in group " + cluster_name \
+ "-master" + " in region " + opts.region
else:
print >> sys.stderr, "ERROR: Could not find any existing cluster"
print >> sys.stderr, "ERROR: Could not find any existing cluster" \
+ " in region " + opts.region
sys.exit(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment