Search in sources :

Example 41 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project asterixdb by apache.

the class SpatialQueryGeneratorDriver method main.

public static void main(String[] args) throws Exception {
    SpatialQueryGeneratorConfig clientConfig = new SpatialQueryGeneratorConfig();
    CmdLineParser clp = new CmdLineParser(clientConfig);
    try {
        clp.parseArgument(args);
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        clp.printUsage(System.err);
        System.exit(1);
    }
    SpatialQueryGenerator client = new SpatialQueryGenerator(clientConfig);
    client.start();
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 42 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project asterixdb by apache.

the class NCDriver method main.

public static void main(String[] args) {
    try {
        final String nodeId = ConfigUtils.getOptionValue(args, NCConfig.Option.NODE_ID);
        final ConfigManager configManager = new ConfigManager(args);
        INCApplication application = getApplication(args);
        application.registerConfig(configManager);
        NCConfig ncConfig = new NCConfig(nodeId, configManager);
        final NodeControllerService ncService = new NodeControllerService(ncConfig, application);
        ncService.start();
        while (true) {
            Thread.sleep(10000);
        }
    } catch (CmdLineException e) {
        LOGGER.log(Level.FINE, "Exception parsing command line: " + Arrays.toString(args), e);
        System.exit(2);
    } catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Exiting NCDriver due to exception", e);
        System.exit(1);
    }
}
Also used : INCApplication(org.apache.hyracks.api.application.INCApplication) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) ConfigManager(org.apache.hyracks.control.common.config.ConfigManager) CmdLineException(org.kohsuke.args4j.CmdLineException) CmdLineException(org.kohsuke.args4j.CmdLineException) IOException(java.io.IOException)

Example 43 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project Anserini by castorini.

the class LookupObjectTriples method main.

public static void main(String[] args) throws Exception {
    Args searchArgs = new Args();
    // Parse args
    CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        System.err.println("Example command: " + LookupObjectTriples.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED));
        return;
    }
    new LookupObjectTriples(searchArgs.index).search(searchArgs.subject, searchArgs.predicate);
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 44 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project Anserini by castorini.

the class TrainingDataGenerator method main.

public static void main(String[] args) throws Exception {
    Args trainingDataGeneratorArgs = new Args();
    CmdLineParser parser = new CmdLineParser(trainingDataGeneratorArgs, ParserProperties.defaults().withUsageWidth(90));
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        System.err.println("Example command: " + TrainingDataGenerator.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED));
        return;
    }
    LOG.info("Generating training data started...");
    new TrainingDataGenerator(trainingDataGeneratorArgs).generateTrainingData();
    LOG.info("Generating training data completed.");
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 45 with CmdLineException

use of org.kohsuke.args4j.CmdLineException in project Anserini by castorini.

the class JsonStatusCorpusReader method main.

public static void main(String[] argv) throws IOException {
    Args args = new Args();
    CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(100));
    try {
        parser.parseArgument(argv);
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        System.exit(-1);
    }
    long minId = Long.MAX_VALUE, maxId = Long.MIN_VALUE, cnt = 0;
    JsonStatusCorpusReader tweets = new JsonStatusCorpusReader(new File(args.input));
    Status tweet = null;
    while ((tweet = tweets.next()) != null) {
        cnt++;
        long id = tweet.getId();
        System.out.println("id: " + id);
        if (id < minId)
            minId = id;
        if (id > maxId)
            maxId = id;
        if (cnt % 100000 == 0) {
            System.out.println("Read " + cnt + " tweets");
        }
    }
    tweets.close();
    System.out.println("Read " + cnt + " in total.");
    System.out.println("MaxId = " + maxId);
    System.out.println("MinId = " + minId);
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) File(java.io.File) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

CmdLineException (org.kohsuke.args4j.CmdLineException)105 CmdLineParser (org.kohsuke.args4j.CmdLineParser)80 IOException (java.io.IOException)16 File (java.io.File)14 ArrayList (java.util.ArrayList)11 PrintStream (java.io.PrintStream)7 StringWriter (java.io.StringWriter)6 List (java.util.List)5 FileOutputStream (java.io.FileOutputStream)4 Path (java.nio.file.Path)4 CmdLineParser (com.google.gerrit.util.cli.CmdLineParser)3 FeatureExtractors (io.anserini.ltr.feature.FeatureExtractors)3 Qrels (io.anserini.util.Qrels)3 Directory (org.apache.lucene.store.Directory)3 FSDirectory (org.apache.lucene.store.FSDirectory)3 ConsoleReporter (com.codahale.metrics.ConsoleReporter)2 MetricRegistry (com.codahale.metrics.MetricRegistry)2 Project (com.google.gerrit.reviewdb.client.Project)2 OrmException (com.google.gwtorm.server.OrmException)2 Hudson (hudson.model.Hudson)2