Search in sources :

Example 56 with Options

use of org.apache.commons.cli.Options in project GNS by MobilityFirst.

the class ThroughputAsynchMultiClientTest method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option helpOption = new Option("help", "Prints Usage");
    Option aliasOption = OptionBuilder.withArgName("alias").hasArg().withDescription("the alias (HRN) to use").create("alias");
    Option operationOption = OptionBuilder.withArgName("op").hasArg().withDescription("the operation to perform (read or update - default is read)").create("op");
    Option rateOption = OptionBuilder.withArgName("rate").hasArg().withDescription("the rate in ops per second").create("rate");
    Option incOption = OptionBuilder.withArgName("inc").hasArg().withDescription("the increment used with rate").create("inc");
    Option clientsOption = OptionBuilder.withArgName("clients").hasArg().withDescription("number of clients used to send (default 10)").create("clients");
    Option requestsPerClientOption = OptionBuilder.withArgName("requests").hasArg().withDescription("number of requests sent by each client each time").create("requests");
    Option guidsPerRequestOption = OptionBuilder.withArgName("guids").hasArg().withDescription("number of guids for each request").create("guids");
    Option useExistingGuidsOption = new Option("useExistingGuids", "use guids in account Guid instead of creating new ones");
    Option updateAliasOption = new Option("updateAlias", true, "Alias of guid to update/read");
    Option updateFieldOption = new Option("updateField", true, "Field to read/update");
    Option updateValueOption = new Option("updateValue", true, "Value to use in read/update");
    commandLineOptions = new Options();
    commandLineOptions.addOption(aliasOption);
    commandLineOptions.addOption(operationOption);
    commandLineOptions.addOption(rateOption);
    commandLineOptions.addOption(incOption);
    commandLineOptions.addOption(clientsOption);
    commandLineOptions.addOption(requestsPerClientOption);
    commandLineOptions.addOption(guidsPerRequestOption);
    commandLineOptions.addOption(helpOption);
    commandLineOptions.addOption(updateAliasOption);
    commandLineOptions.addOption(updateFieldOption);
    commandLineOptions.addOption(updateValueOption);
    commandLineOptions.addOption(useExistingGuidsOption);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 57 with Options

use of org.apache.commons.cli.Options in project GNS by MobilityFirst.

the class ReplicaLatencyTest method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option help = new Option("help", "Prints Usage");
    Option alias = OptionBuilder.withArgName("alias").hasArg().withDescription("the alias (HRN) to use for the account").create("alias");
    Option host = OptionBuilder.withArgName("host").hasArg().withDescription("the GNS host").create("host");
    Option port = OptionBuilder.withArgName("port").hasArg().withDescription("the GNS port").create("port");
    Option debug = new Option("debug", "show output");
    Option closeActiveReplica = OptionBuilder.withArgName("closeAR").hasArg().withDescription("the active replica close to you").create("closeAR");
    commandLineOptions = new Options();
    commandLineOptions.addOption(alias);
    commandLineOptions.addOption(host);
    commandLineOptions.addOption(port);
    commandLineOptions.addOption(debug);
    commandLineOptions.addOption(closeActiveReplica);
    commandLineOptions.addOption(help);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 58 with Options

use of org.apache.commons.cli.Options in project GNS by MobilityFirst.

the class CommandLineInterface method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option help = new Option("help", "Prints Usage");
    Option silent = new Option("silent", "Disables output");
    Option noDefaults = new Option("noDefaults", "Don't use server and guid defaults");
    commandLineOptions = new Options();
    commandLineOptions.addOption(help);
    commandLineOptions.addOption(silent);
    commandLineOptions.addOption(noDefaults);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args, false);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 59 with Options

use of org.apache.commons.cli.Options in project GNS by MobilityFirst.

the class GNSInstaller method initializeOptions.

private static CommandLine initializeOptions(String[] args) throws ParseException {
    Option help = new Option("help", "Prints Usage");
    Option update = OptionBuilder.withArgName("installation name").hasArg().withDescription("updates GNS files and restarts servers in a installation").create("update");
    Option restart = OptionBuilder.withArgName("installation name").hasArg().withDescription("restarts GNS servers in a installation").create("restart");
    Option removeLogs = new Option("removeLogs", "remove paxos and Logger log files (use with -restart or -update)");
    Option deleteDatabase = new Option("deleteDatabase", "delete the databases in a installation (use with -restart or -update)");
    Option dataStore = OptionBuilder.withArgName("data store type").hasArg().withDescription("data store type").create("datastore");
    Option scriptFile = OptionBuilder.withArgName("install script file").hasArg().withDescription("specifies the location of a bash script file that will install MongoDB and Java").create("scriptFile");
    Option runscript = OptionBuilder.withArgName("installation name").hasArg().withDescription("just runs the script file").create("runscript");
    Option stop = OptionBuilder.withArgName("installation name").hasArg().withDescription("stops GNS servers in a installation").create("stop");
    Option root = new Option("root", "run the installation as root");
    Option noopTest = new Option("noopTest", "starts noop test servers instead of GNS APP servers");
    commandLineOptions = new Options();
    commandLineOptions.addOption(update);
    commandLineOptions.addOption(restart);
    commandLineOptions.addOption(stop);
    commandLineOptions.addOption(removeLogs);
    commandLineOptions.addOption(deleteDatabase);
    commandLineOptions.addOption(dataStore);
    commandLineOptions.addOption(scriptFile);
    commandLineOptions.addOption(runscript);
    commandLineOptions.addOption(root);
    commandLineOptions.addOption(noopTest);
    commandLineOptions.addOption(help);
    CommandLineParser parser = new GnuParser();
    return parser.parse(commandLineOptions, args);
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser)

Example 60 with Options

use of org.apache.commons.cli.Options in project heron by twitter.

the class SchedulerMain method constructOptions.

// Construct all required command line options
private static Options constructOptions() {
    Options options = new Options();
    Option cluster = Option.builder("c").desc("Cluster name in which the topology needs to run on").longOpt("cluster").hasArgs().argName("cluster").required().build();
    Option role = Option.builder("r").desc("Role under which the topology needs to run").longOpt("role").hasArgs().argName("role").required().build();
    Option environment = Option.builder("e").desc("Environment under which the topology needs to run").longOpt("environment").hasArgs().argName("environment").required().build();
    Option topologyName = Option.builder("n").desc("Name of the topology").longOpt("topology_name").hasArgs().argName("topology name").required().build();
    Option topologyJar = Option.builder("f").desc("Topology jar/pex file path").longOpt("topology_bin").hasArgs().argName("topology binary file").required().build();
    Option schedulerHTTPPort = Option.builder("p").desc("Http Port number on which the scheduler listens for requests").longOpt("http_port").hasArgs().argName("http port").required().build();
    Option property = Option.builder(SchedulerUtils.SCHEDULER_COMMAND_LINE_PROPERTIES_OVERRIDE_OPTION).desc("use value for given property").longOpt("property_override").hasArgs().valueSeparator().argName("property=value").build();
    Option verbose = Option.builder("v").desc("Enable debug logs").longOpt("verbose").build();
    options.addOption(cluster);
    options.addOption(role);
    options.addOption(environment);
    options.addOption(topologyName);
    options.addOption(topologyJar);
    options.addOption(schedulerHTTPPort);
    options.addOption(property);
    options.addOption(verbose);
    return options;
}
Also used : Options(org.apache.commons.cli.Options) Option(org.apache.commons.cli.Option)

Aggregations

Options (org.apache.commons.cli.Options)1086 CommandLine (org.apache.commons.cli.CommandLine)557 CommandLineParser (org.apache.commons.cli.CommandLineParser)382 ParseException (org.apache.commons.cli.ParseException)341 Option (org.apache.commons.cli.Option)325 HelpFormatter (org.apache.commons.cli.HelpFormatter)275 GnuParser (org.apache.commons.cli.GnuParser)207 DefaultParser (org.apache.commons.cli.DefaultParser)166 Test (org.junit.Test)148 PosixParser (org.apache.commons.cli.PosixParser)135 IOException (java.io.IOException)118 File (java.io.File)97 OptionGroup (org.apache.commons.cli.OptionGroup)56 DMLScript (org.apache.sysml.api.DMLScript)56 Path (org.apache.hadoop.fs.Path)54 ArrayList (java.util.ArrayList)38 BasicParser (org.apache.commons.cli.BasicParser)36 Properties (java.util.Properties)33 Configuration (org.apache.hadoop.conf.Configuration)31 FileInputStream (java.io.FileInputStream)29