Skip to content

Commit 4ecd9f9

Browse files
committed
[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.
1 parent 75fdccc commit 4ecd9f9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ec2/spark_ec2.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,8 @@ def launch_cluster(conn, opts, cluster_name):
594594

595595

596596
def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
597-
print "Searching for existing cluster " + cluster_name + "..."
597+
print "Searching for existing cluster " + cluster_name + " in region " \
598+
+ opts.region + "..."
598599
reservations = conn.get_all_reservations()
599600
master_nodes = []
600601
slave_nodes = []
@@ -607,14 +608,17 @@ def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
607608
elif (cluster_name + "-slaves") in group_names:
608609
slave_nodes.append(inst)
609610
if any((master_nodes, slave_nodes)):
610-
print "Found %d master(s), %d slaves" % (len(master_nodes), len(slave_nodes))
611+
print "Found %d master(s), %d slaves" % (len(master_nodes), len(slave_nodes)) \
612+
+ " in region " + opts.region
611613
if master_nodes != [] or not die_on_error:
612614
return (master_nodes, slave_nodes)
613615
else:
614616
if master_nodes == [] and slave_nodes != []:
615-
print >> sys.stderr, "ERROR: Could not find master in group " + cluster_name + "-master"
617+
print >> sys.stderr, "ERROR: Could not find master in group " + cluster_name \
618+
+ "-master" + " in region " + opts.region
616619
else:
617-
print >> sys.stderr, "ERROR: Could not find any existing cluster"
620+
print >> sys.stderr, "ERROR: Could not find any existing cluster" \
621+
+ " in region " + opts.region
618622
sys.exit(1)
619623

620624

0 commit comments

Comments
 (0)