You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:55:14 UTC

svn commit: r1132179 - /incubator/mesos/trunk/ec2/mesos_ec2.py

Author: benh
Date: Sun Jun  5 08:55:13 2011
New Revision: 1132179

URL: http://svn.apache.org/viewvc?rev=1132179&view=rev
Log:
Added --wait option to mesos_ec2.py script

Modified:
    incubator/mesos/trunk/ec2/mesos_ec2.py

Modified: incubator/mesos/trunk/ec2/mesos_ec2.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/ec2/mesos_ec2.py?rev=1132179&r1=1132178&r2=1132179&view=diff
==============================================================================
--- incubator/mesos/trunk/ec2/mesos_ec2.py (original)
+++ incubator/mesos/trunk/ec2/mesos_ec2.py Sun Jun  5 08:55:13 2011
@@ -25,6 +25,8 @@ def parse_args():
                     help="Show this help message and exit")
   parser.add_option("-s", "--slaves", type="int", default=1,
       help="Number of slaves to launch (default: 1)")
+  parser.add_option("-w", "--wait", type="int", default=60,
+      help="Number of seconds to wait for cluster to come up (default: 60)")
   parser.add_option("-k", "--key-pair",
       help="Key pair to use on instances")
   parser.add_option("-i", "--identity-file", 
@@ -273,15 +275,15 @@ def setup_cluster(conn, master_res, slav
 
 
 # Wait for a whole cluster (masters, slaves and ZooKeeper) to start up
-def wait_for_cluster(conn, master_res, slave_res, zoo_res):
+def wait_for_cluster(conn, wait_secs, master_res, slave_res, zoo_res):
   print "Waiting for instances to start up..."
   time.sleep(5)
   wait_for_instances(conn, master_res)
   wait_for_instances(conn, slave_res)
   if zoo_res != None:
     wait_for_instances(conn, zoo_res)
-  print "Waiting 60 more seconds..."
-  time.sleep(60)
+  print "Waiting %d more seconds..." % wait_secs
+  time.sleep(wait_secs)
 
 
 # Get number of local disks available for a given EC2 instance type.
@@ -380,7 +382,7 @@ def main():
     else:
       (master_res, slave_res, zoo_res) = launch_cluster(
           conn, opts, cluster_name)
-      wait_for_cluster(conn, master_res, slave_res, zoo_res)
+      wait_for_cluster(conn, opts.wait, master_res, slave_res, zoo_res)
     setup_cluster(conn, master_res, slave_res, zoo_res, opts, True)
 
   elif action == "destroy":