Examples of OptionParser


Examples of joptsimple.OptionParser

    private final static int DEFAULT_DELAY = 500;
    private final static int DEFAULT_NUM_CLIENTS = 20;
    private final static String DEFAULT_ROUTED_STORE_TYPE = PIPELINE_ROUTED_STORE;

    public static void main(String[] args) throws Throwable {
        OptionParser parser = new OptionParser();
        parser.accepts("num-keys",
                       "The number of keys to submit for retrieval  Default = " + DEFAULT_NUM_KEYS)
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("max-connections",
                       "The maximum number of connections (sockets) per node; same value as client configuration parameter \""
                               + ClientConfig.MAX_CONNECTIONS_PER_NODE_PROPERTY
                               + "\"  Default = "
                               + DEFAULT_MAX_CONNECTIONS)
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("max-threads",
                       "The maximum number of threads used by the threaded RoutedStore implementation; same value as client configuration parameter \""
                               + ClientConfig.MAX_THREADS_PROPERTY
                               + "\"  Default = "
                               + DEFAULT_MAX_THREADS)
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("num-nodes", "The number of nodes  Default = " + DEFAULT_NUM_NODES)
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("num-slow-nodes",
                       "The number of nodes that exhibit delay Default = " + DEFAULT_NUM_SLOW_NODES)
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("delay",
                       "The millisecond delay shown by slow nodes Default = " + DEFAULT_DELAY)
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("num-clients",
                       "The number of threads to make requests concurrently  Default = "
                               + DEFAULT_NUM_CLIENTS)
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("routed-store-type",
                       "Type of routed store, either \"" + THREAD_POOL_ROUTED_STORE + "\" or \""
                               + PIPELINE_ROUTED_STORE + "\"  Default = "
                               + DEFAULT_ROUTED_STORE_TYPE).withRequiredArg();
        parser.accepts("help", "This help");

        OptionSet options = parser.parse(args);

        if(options.has("help")) {
            printUsage(System.out, parser);
        }
View Full Code Here

Examples of joptsimple.OptionParser

            System.exit(exitStatus);
        }
    }

    public static void main(String[] argv) throws Exception {
        OptionParser parser = getParser();
        OptionSet options = parser.parse(argv);
        validateOptions(options);

        String inputPath = (String) options.valueOf("input");
        String storeBdbFolderPath = (String) options.valueOf("bdb");
        String clusterXmlPath = (String) options.valueOf("cluster-xml");
View Full Code Here

Examples of joptsimple.OptionParser

public class RebalanceControllerCLI {

    private static OptionParser parser;

    private static void setupParser() {
        parser = new OptionParser();
        parser.accepts("help", "Print usage information");
        parser.accepts("url", "Url to bootstrap from ").withRequiredArg().describedAs("url");
        parser.accepts("donor-based", "Execute donor-based rebalancing.");
        parser.accepts("stealer-based", "Execute stealer-based rebalancing (default).");
        parser.accepts("parallelism",
View Full Code Here

Examples of joptsimple.OptionParser

     * Return args parser
     *
     * @return program parser
     * */
    private static OptionParser getParser() {
        OptionParser parser = new OptionParser();
        parser.accepts("help", "print help information");
        parser.accepts("src-url", "[REQUIRED] bootstrap URL of source cluster")
              .withRequiredArg()
              .describedAs("source-bootstrap-url")
              .ofType(String.class);
        parser.accepts("dst-url", "[REQUIRED] bootstrap URL of destination cluster")
              .withRequiredArg()
              .describedAs("destination-bootstrap-url")
              .ofType(String.class);
        parser.accepts("stores",
                       "Store names to forklift. Comma delimited list or singleton. [Default: ALL SOURCE STORES]")
              .withRequiredArg()
              .describedAs("stores")
              .withValuesSeparatedBy(',')
              .ofType(String.class);
        parser.accepts("partitions",
                       "partitions to forklift. Comma delimited list or singleton. [Default: ALL SOURCE PARTITIONS]")
              .withRequiredArg()
              .describedAs("partitions")
              .withValuesSeparatedBy(',')
              .ofType(Integer.class);
        parser.accepts("max-puts-per-second",
                       "Maximum number of put(...) operations issued against destination cluster per second. [Default: "
                               + DEFAULT_MAX_PUTS_PER_SEC + " ]")
              .withRequiredArg()
              .describedAs("maxPutsPerSecond")
              .ofType(Integer.class);
        parser.accepts("progress-period-ops",
                       "Number of operations between progress info is displayed. [Default: "
                               + DEFAULT_PROGRESS_PERIOD_OPS + " ]")
              .withRequiredArg()
              .describedAs("progressPeriodOps")
              .ofType(Integer.class);
        parser.accepts("parallelism",
                       "Number of partitions to fetch in parallel. [Default: "
                               + DEFAULT_PARTITION_PARALLELISM + " ]")
              .withRequiredArg()
              .describedAs("partitionParallelism")
              .ofType(Integer.class);
        parser.accepts("mode",
                       "Determines if a thorough global resolution needs to be done, by comparing all replicas. [Default: "
                               + ForkLiftTaskMode.primary_resolution.toString()
                               + " Fetch from primary alone ]");

        parser.accepts(OVERWRITE_OPTION, OVERWRITE_WARNING_MESSAGE)
              .withOptionalArg()
              .describedAs("overwriteExistingValue")
              .ofType(Boolean.class)
              .defaultsTo(false);

View Full Code Here

Examples of joptsimple.OptionParser

     * Return args parser
     *
     * @return program parser
     * */
    private static OptionParser getParser() {
        OptionParser parser = new OptionParser();
        parser.accepts("help", "print help information");
        parser.accepts("url", "[REQUIRED] bootstrap URL")
              .withRequiredArg()
              .describedAs("bootstrap-url")
              .ofType(String.class);
        parser.accepts("out-dir",
                       "[REQUIRED] Directory in which to output the key files (named \"{storeName}.keys\".")
              .withRequiredArg()
              .describedAs("outputDirectory")
              .ofType(String.class);
        parser.accepts("store-names",
                       "Store names to sample. Comma delimited list or singleton. [Default: ALL]")
              .withRequiredArg()
              .describedAs("storeNames")
              .withValuesSeparatedBy(',')
              .ofType(String.class);
        parser.accepts("partition-ids",
                       "Partition IDs to sample for each store. Comma delimited list or singleton. [Default: ALL]")
              .withRequiredArg()
              .describedAs("partitionIds")
              .withValuesSeparatedBy(',')
              .ofType(Integer.class);
        parser.accepts("parallelism",
                       "Number of nodes to sample in parallel. [Default: "
                               + DEFAULT_NODE_PARALLELISM + " ]")
              .withRequiredArg()
              .describedAs("storeParallelism")
              .ofType(Integer.class);
        parser.accepts("records-per-partition",
                       "Number of keys sampled per partition. [Default: INF]")
              .withRequiredArg()
              .describedAs("recordsPerPartition")
              .ofType(Integer.class);
        parser.accepts("keys-per-second-limit",
                       "Number of keys sampled per second limit. [Default: "
                               + DEFAULT_KEYS_PER_SECOND_LIMIT + " ]")
              .withRequiredArg()
              .describedAs("keysPerSecondLimit")
              .ofType(Integer.class);
        parser.accepts("progress-period-ops",
                       "Number of operations between progress info is displayed. [Default: "
                               + DEFAULT_PROGRESS_PERIOD_OPS + " ]")
              .withRequiredArg()
              .describedAs("progressPeriodOps")
              .ofType(Integer.class);
View Full Code Here

Examples of joptsimple.OptionParser

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        OptionParser parser = null;
        OptionSet options = null;
        try {
            parser = getParser();
            options = parser.parse(args);
        } catch(Exception oe) {
            logger.error("Exception processing command line options", oe);
            parser.printHelpOn(System.out);
            return;
        }

        /* validate options */
        if(options.has("help")) {
            parser.printHelpOn(System.out);
            return;
        }

        if(!options.has("src-url") || !options.has("dst-url")) {
            logger.error("Both 'src-url' and 'dst-url' options are mandatory");
            parser.printHelpOn(System.out);
            return;
        }

        String srcBootstrapUrl = (String) options.valueOf("src-url");
        String dstBootstrapUrl = (String) options.valueOf("dst-url");
View Full Code Here

Examples of joptsimple.OptionParser

        benchmark.warmUpAndRun();
        benchmark.close();
    }

    public static void main(String[] args) throws IOException {
        OptionParser parser = new OptionParser();
        parser.accepts(Benchmark.RECORD_COUNT, "number of records inserted during warmup phase")
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts(Benchmark.OPS_COUNT, "number of operations to do")
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts(Benchmark.HELP);

        OptionSet options = parser.parse(args);

        if(options.has(Benchmark.HELP)) {
            parser.printHelpOn(System.out);
            System.exit(0);
        }

        if(!options.has(Benchmark.RECORD_COUNT) || !options.has(Benchmark.OPS_COUNT)) {
            parser.printHelpOn(System.out);
            Utils.croak("Missing params");
            System.exit(0);
        }

        Props props = new Props();
View Full Code Here

Examples of joptsimple.OptionParser

        printUsage();
        Utils.croak("\n" + errMessage);
    }

    public static void main(String[] args) throws Exception {
        OptionParser parser = null;
        OptionSet options = null;
        try {
            parser = getParser();
            options = parser.parse(args);
        } catch(OptionException oe) {
            parser.printHelpOn(System.out);
            printUsageAndDie("Exception when parsing arguments : " + oe.getMessage());
            return;
        }

        /* validate options */
        if(options.hasArgument("help")) {
            parser.printHelpOn(System.out);
            printUsage();
            return;
        }
        if(!options.hasArgument("url") || !options.hasArgument("out-dir")) {
            parser.printHelpOn(System.out);
            printUsageAndDie("Missing a required argument.");
            return;
        }

        String url = (String) options.valueOf("url");
View Full Code Here

Examples of joptsimple.OptionParser

public class Main {

  private static ExecutorService threadPool;

  public static void main(String[] args) throws Exception {
    OptionParser parser = new OptionParser();
    parser.accepts("e", "Evaluate 'EXPR' and exit")
        .withRequiredArg()
        .describedAs("EXPR");

    parser.accepts("f", "Take input from 'FILE'")
        .withRequiredArg()
        .describedAs("FILE");

    OptionSet options;
    try {
      options = parser.parse(args);
    } catch(OptionException e) {
      System.err.println(e.getMessage());
      parser.printHelpOn(System.out);
      System.exit(-1);
      return;
    }

    configureLogging();
View Full Code Here

Examples of joptsimple.OptionParser

  }

  public static void main(String[] args) throws Exception {

    OptionParser parser = new OptionParser();

    parser.accepts("cmd").withRequiredArg();
    parser.accepts("ranking");

    /*
     * Bin generation arguments
     */
    parser.accepts("folder").withRequiredArg();
    parser.accepts("file").withRequiredArg();

    /*
     * Training arguments
     */
    parser.accepts("config-file").withRequiredArg();
    parser.accepts("train-file").withRequiredArg();
    parser.accepts("validation-file").withRequiredArg();
    parser.accepts("output-model").withRequiredArg();

    /*
     * Prediction arguments
     */
    parser.accepts("model-file").withRequiredArg();
    parser.accepts("tree-type").withRequiredArg();
    parser.accepts("test-file").withRequiredArg();
    parser.accepts("output-file").withRequiredArg();

    OptionSet options = parser.parse(args);

    if (!options.has("cmd")) {
      System.err.println("You must specify the command through 'cmd' parameter.");
      return;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.