Search in sources :

Example 66 with Option

use of org.apache.commons.cli.Option 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)

Example 67 with Option

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

the class SubmitterMain 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 heronHome = Option.builder("d").desc("Directory where heron is installed").longOpt("heron_home").hasArgs().argName("heron home dir").required().build();
    Option configFile = Option.builder("p").desc("Path of the config files").longOpt("config_path").hasArgs().argName("config path").required().build();
    Option configOverrides = Option.builder("o").desc("Command line override config path").longOpt("override_config_file").hasArgs().argName("override config file").build();
    Option releaseFile = Option.builder("b").desc("Release file name").longOpt("release_file").hasArgs().argName("release information").build();
    Option topologyPackage = Option.builder("y").desc("tar ball containing user submitted jar/tar, defn and config").longOpt("topology_package").hasArgs().argName("topology package").required().build();
    Option topologyDefn = Option.builder("f").desc("serialized file containing Topology protobuf").longOpt("topology_defn").hasArgs().argName("topology definition").required().build();
    Option topologyJar = Option.builder("j").desc("user heron topology jar/pex file path").longOpt("topology_bin").hasArgs().argName("topology binary file").required().build();
    Option dryRun = Option.builder("u").desc("run in dry-run mode").longOpt("dry_run").required(false).build();
    Option dryRunFormat = Option.builder("t").desc("dry-run format").longOpt("dry_run_format").hasArg().required(false).build();
    Option verbose = Option.builder("v").desc("Enable debug logs").longOpt("verbose").build();
    options.addOption(cluster);
    options.addOption(role);
    options.addOption(environment);
    options.addOption(heronHome);
    options.addOption(configFile);
    options.addOption(configOverrides);
    options.addOption(releaseFile);
    options.addOption(topologyPackage);
    options.addOption(topologyDefn);
    options.addOption(topologyJar);
    options.addOption(dryRun);
    options.addOption(dryRunFormat);
    options.addOption(verbose);
    return options;
}
Also used : Options(org.apache.commons.cli.Options) Option(org.apache.commons.cli.Option)

Example 68 with Option

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

the class RuntimeManagerMain 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 heronHome = Option.builder("d").desc("Directory where heron is installed").longOpt("heron_home").hasArgs().argName("heron home dir").required().build();
    Option componentParallelism = Option.builder("a").desc("Component parallelism to update: <name>:<value>,<name>:<value>,...").longOpt("component_parallelism").hasArgs().argName("component parallelism").build();
    Option configFile = Option.builder("p").desc("Path of the config files").longOpt("config_path").hasArgs().argName("config path").required().build();
    Option configOverrides = Option.builder("o").desc("Command line override config path").longOpt("override_config_file").hasArgs().argName("override config file").build();
    Option releaseFile = Option.builder("b").desc("Release file name").longOpt("release_file").hasArgs().argName("release information").build();
    Option command = Option.builder("m").desc("Command to run").longOpt("command").hasArgs().required().argName("command to run").build();
    Option containerId = Option.builder("i").desc("Container Id for restart command").longOpt("container_id").hasArgs().argName("container id").build();
    Option dryRun = Option.builder("u").desc("run in dry-run mode").longOpt("dry_run").required(false).build();
    Option dryRunFormat = Option.builder("t").desc("dry-run format").longOpt("dry_run_format").hasArg().required(false).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(configFile);
    options.addOption(configOverrides);
    options.addOption(releaseFile);
    options.addOption(command);
    options.addOption(heronHome);
    options.addOption(containerId);
    options.addOption(componentParallelism);
    options.addOption(dryRun);
    options.addOption(dryRunFormat);
    options.addOption(verbose);
    return options;
}
Also used : Options(org.apache.commons.cli.Options) Option(org.apache.commons.cli.Option)

Example 69 with Option

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

the class RuntimeManagerMain method constructHelpOptions.

// construct command line help options
private static Options constructHelpOptions() {
    Options options = new Options();
    Option help = Option.builder("h").desc("List all options and their description").longOpt("help").build();
    options.addOption(help);
    return options;
}
Also used : Options(org.apache.commons.cli.Options) Option(org.apache.commons.cli.Option)

Example 70 with Option

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

the class MetricsCacheManager method constructHelpOptions.

// construct command line help options
private static Options constructHelpOptions() {
    Options options = new Options();
    Option help = Option.builder("h").desc("List all options and their description").longOpt("help").build();
    options.addOption(help);
    return options;
}
Also used : Options(org.apache.commons.cli.Options) HeronSocketOptions(com.twitter.heron.common.network.HeronSocketOptions) Option(org.apache.commons.cli.Option)

Aggregations

Option (org.apache.commons.cli.Option)152 Options (org.apache.commons.cli.Options)105 CommandLine (org.apache.commons.cli.CommandLine)53 CommandLineParser (org.apache.commons.cli.CommandLineParser)52 ParseException (org.apache.commons.cli.ParseException)41 GnuParser (org.apache.commons.cli.GnuParser)39 HelpFormatter (org.apache.commons.cli.HelpFormatter)30 File (java.io.File)13 OptionGroup (org.apache.commons.cli.OptionGroup)13 FileInputStream (java.io.FileInputStream)10 IOException (java.io.IOException)10 HashMap (java.util.HashMap)9 DefaultParser (org.apache.commons.cli.DefaultParser)9 Properties (java.util.Properties)8 BasicParser (org.apache.commons.cli.BasicParser)6 ConsoleAppender (org.apache.log4j.ConsoleAppender)6 PatternLayout (org.apache.log4j.PatternLayout)6 ArrayList (java.util.ArrayList)5 PosixParser (org.apache.commons.cli.PosixParser)5 List (java.util.List)3