Package joptsimple

Examples of joptsimple.OptionParser


import voldemort.xml.ClusterMapper;

public class ReadOnlyStorePerformanceTest {

    public static void main(String[] args) throws FileNotFoundException, IOException {
        OptionParser parser = new OptionParser();
        parser.accepts("help", "print usage information");
        parser.accepts("threads", "number of threads").withRequiredArg().ofType(Integer.class);
        parser.accepts("requests", "[REQUIRED] number of requests")
              .withRequiredArg()
              .ofType(Integer.class);
        parser.accepts("store-dir", "[REQUIRED] store directory")
              .withRequiredArg()
              .describedAs("directory");
        parser.accepts("cluster-xml", "Path to cluster.xml").withRequiredArg().describedAs("path");
        parser.accepts("node-id", "Id of node")
              .withRequiredArg()
              .ofType(Integer.class)
              .describedAs("node-id");
        parser.accepts("search-strategy", "class of the search strategy to use")
              .withRequiredArg()
              .describedAs("class_name");
        parser.accepts("build", "If present, first build the data");
        parser.accepts("num-values", "The number of values in the store")
              .withRequiredArg()
              .describedAs("count")
              .ofType(Integer.class);
        parser.accepts("num-chunks", "The number of chunks per partition")
              .withRequiredArg()
              .describedAs("chunks")
              .ofType(Integer.class);
        parser.accepts("internal-sort-size", "The number of items to sort in memory at a time")
              .withRequiredArg()
              .describedAs("size")
              .ofType(Integer.class);
        parser.accepts("value-size", "The size of the values in the store")
              .withRequiredArg()
              .describedAs("size")
              .ofType(Integer.class);
        parser.accepts("working-dir", "The directory in which to store temporary data")
              .withRequiredArg()
              .describedAs("dir");
        parser.accepts("gzip", "Compress the intermediate temp files used in building the store");
        parser.accepts("request-file", "file get request ids from").withRequiredArg();
        parser.accepts("version",
                       "Version of read-only store [" + ReadOnlyStorageFormat.READONLY_V0 + ","
                               + ReadOnlyStorageFormat.READONLY_V1 + ","
                               + ReadOnlyStorageFormat.READONLY_V2 + " (default)]")
              .withRequiredArg()
              .describedAs("version");
        parser.accepts("test-gz", "Path to gzip containing data. Works with --build only")
              .withRequiredArg()
              .describedAs("path");
        OptionSet options = parser.parse(args);

        if(options.has("help")) {
            parser.printHelpOn(System.out);
            System.exit(0);
        }

        CmdUtils.croakIfMissing(parser, options, "requests", "store-dir");
View Full Code Here


        }
    }

    @SuppressWarnings("unchecked")
    public static void main(String[] args) throws Exception {
        OptionParser parser = new OptionParser();
        OptionSet options = parser.parse(args);

        List<String> nonOptions = (List<String>) options.nonOptionArguments();
        if(nonOptions.size() < 2 || nonOptions.size() > 3) {
            System.err.println("Usage: java VoldemortThinClientShell store_name coordinator_url [command_file] [options]");
            parser.printHelpOn(System.err);
            System.exit(-1);
        }

        String storeName = nonOptions.get(0);
        String bootstrapUrl = nonOptions.get(1);
View Full Code Here

    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

            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

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

     * 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

     * 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

    /**
     * @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

        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

        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

TOP

Related Classes of joptsimple.OptionParser

Copyright © 2018 www.massapicom. 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.