Skip to content

Commit

Permalink
[SPARK-5668] Display region in spark_ec2.py get_existing_cluster()
Browse files Browse the repository at this point in the history
Show the region for the different messages displayed by get_existing_cluster(): The search, found and error messages.
  • Loading branch information
MiguelPeralvo committed Feb 8, 2015
1 parent 75fdccc commit 4ecd9f9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ec2/spark_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,8 @@ def launch_cluster(conn, opts, cluster_name):


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 = []
Expand All @@ -607,14 +608,17 @@ def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
elif (cluster_name + "-slaves") in group_names:
slave_nodes.append(inst)
if any((master_nodes, slave_nodes)):
print "Found %d master(s), %d slaves" % (len(master_nodes), len(slave_nodes))
print "Found %d master(s), %d slaves" % (len(master_nodes), len(slave_nodes)) \
+ " in region " + opts.region
if master_nodes != [] or not die_on_error:
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)


Expand Down

0 comments on commit 4ecd9f9

Please sign in to comment.