def parse_args(force_action=True):
  parser = OptionParser(usage="sparrow-exp <action> <cluster> [options]" +
    "\n\n<action> can be: launch, deploy, start-sparrow, stop-sparrow, start-proto, stop-proto, start-hdfs, stop-hdfs, start-sparrow-throughput, start-spark-shark, stop-spark, restart-spark-shark, command, collect-logs, destroy, login-fe, login-be, create-database, create-tpch-tables, start-shark-tpch")
  parser.add_option("-z", "--zone", default="us-east-1d",
      help="Availability zone to launch instances in")
  parser.add_option("-a", "--ami", default="ami-533a733a",
      help="Amazon Machine Image ID to use (use ami-894801e0 for HVM instance types)")
  parser.add_option("-t", "--instance-type", default="m2.2xlarge",
      help="Type of instance to launch (default: m2.2xlarge). " +
           "WARNING: must be 64 bit, thus small instances won't work")
  parser.add_option("-l", "--arrival-rate", type="float", default=1,
      help = "Arrival rate of jobs in proto frontends (jobs/s)")
  parser.add_option("-k", "--key-pair",
      help="Key pair to use on instances")
  parser.add_option("-i", "--identity-file",
      help="SSH private key file to use for logging into instances")
  parser.add_option("-f", "--frontends", type="int", default=1,
      help="Number of frontends to launch (default: 1)")
  parser.add_option("-b", "--backends", type="int", default=1,
      help="Number of backends to launch (default: 1)")
  parser.add_option("-w", "--wait", type="int", default=0,
      help="Number of seconds to wait for cluster nodes to boot (default: 0)")
  parser.add_option("-g", "--branch", default="master",
      help="Which git branch to checkout")
  parser.add_option("-s", "--spark-branch", default="sparrow",
      help="Which git branch to checkout (for spark)")
  parser.add_option("-d", "--log-dir", default="/tmp/",
      help="Local directory into which log files are copied")
  parser.add_option("-n", "--tasks-per-job", type="int", default=1,
      help="Number of tasks to launch for each job in prototype")
  parser.add_option("-x", "--num-preferred-nodes", type="int", default=0,
      help="Number of preferred nodes to use in the prototype frontend (0 means unconstrained)")
  parser.add_option("-c", "--benchmark-id", type="int", default=1,
      help="Which benchmark to run")
  parser.add_option("-e", "--benchmark-iterations", type="int", default=100,
      help="Iterations of benchmark to run")
  parser.add_option("-p", "--sample-ratio", type="float", default=2,
      help="Sample ratio for unconstrained tasks")
  parser.add_option("-q", "--sample-ratio-constrained", type=int, default=2,
      help="Sample ratio for constrained tasks")
  parser.add_option("-y", "--kill-delay", type="int", default=1,
      help="Time to wait between killing backends and frontends")
  parser.add_option("-v", "--inter-query-delay", type="int", default=100,
      help="How many ms to wait between shark queries")
  parser.add_option("-m", "--scheduler", type="string", default="sparrow",
      help="Which scheduler to use for running spark (mesos/sparrow)")
  parser.add_option("--spot-price", type="float", default=None,
      help="If specified, launch slaves as spot instances with the given " +
            "maximum price (in dollars). To see current spot prices, visit "
            "http://aws.amazon.com/ec2/spot-instances/#7")
  parser.add_option("--cpus", type="int", default=4,
      help="Number of cpus on the machine, used to determine how many concurrent tasks "
           "to run")
  parser.add_option("--frontend-type", type="string", default="ProtoFrontend",
      help="Classname (not fully qualified!) of the frontend to use")
  parser.add_option("-r", "--parallelism", type="int", default=8,
      help="Level of parallelism for dummy queries.")
  parser.add_option("-u", "--num_partitions", type="int", default=1,
      help="Number of partitions for shark tables.")
  parser.add_option("--reduce-tasks", type="int", default=5,
      help="Number of reduce tasks to use for Shark queries.")
  parser.add_option("--spark-backend-mem", default="2g",
      help="Amount of memory to give spark backends."),
  parser.add_option("--scale-factor", default="2.5",
      help="Scale factor to use when creating TPCH database (used with create-database)")
  parser.add_option("--total-cores", default="200",
      help="Total number of cores in the cluster (used to determine launch rate for "
           "throughput experiments)")

  (opts, args) = parser.parse_args()
  if 2 < len(args) and force_action:
    parser.print_help()
    sys.exit(1)
  if os.getenv('AWS_ACCESS_KEY_ID') == None:
    print >> sys.stderr, ("ERROR: The environment variable AWS_ACCESS_KEY_ID " +
                          "must be set")
    sys.exit(1)
  if os.getenv('AWS_SECRET_ACCESS_KEY') == None:
    print >> sys.stderr, ("ERROR: The environment variable " +
                          "AWS_SECRET_ACCESS_KEY must be set")
    sys.exit(1)

  return (opts, args)

# Get the EC2 security group of the given name, creating it if it doesn't exist
dataset/ETHPy150Open radlab/sparrow/deploy/ec2/ec2_exp.py/parse_args/swapped operands of `<`