private Argument addArgument(final String... nameOrFlags) { final FeatureControl defaultControl = topLevel ? null : SUPPRESS; return globalArgs.addArgument(nameOrFlags).setDefault(defaultControl); } }
private void addHelp(ArgumentParser p) { p.addArgument("-h", "--help") .action(new SafeHelpAction(stdOut)) .help("show this help message and exit") .setDefault(Arguments.SUPPRESS); }
public static void main(String[] args) throws Exception { ArgumentParser parser = ArgumentParsers.newArgumentParser("ImpressionsToInfluxDb") .defaultHelp(true) .description("Read Seldon impressions and send stats to influx db"); parser.addArgument("-t", "--topic").setDefault("impressions").help("Kafka topic to read from"); parser.addArgument("-k", "--kafka").setDefault("localhost:9092").help("Kafka server and port"); parser.addArgument("-z", "--zookeeper").setDefault("localhost:2181").help("Zookeeper server and port"); parser.addArgument("-i", "--influxdb").setDefault("localhost:8086").help("Influxdb server and port"); parser.addArgument("-u", "--influx-user").setDefault("root").help("Influxdb user"); parser.addArgument("-p", "--influx-password").setDefault("root").help("Influxdb password"); parser.addArgument("-d", "--influx-database").setDefault("seldon").help("Influxdb database"); parser.addArgument("--influx-measurement-impressions").setDefault("impressions").help("Influxdb impressions measurement"); parser.addArgument("--influx-measurement-requests").setDefault("requests").help("Influxdb requests measurement"); Namespace ns = null; try { ns = parser.parseArgs(args); ImpressionsToInfluxDb.process(ns); } catch (ArgumentParserException e) { parser.handleError(e); System.exit(1); } }
public static void main(String[] args) throws Exception { ArgumentParser parser = ArgumentParsers.newArgumentParser("PredictionsToInfluxDb") .defaultHelp(true) .description("Read Seldon predictions and send stats to influx db"); parser.addArgument("-t", "--topic").setDefault("Predictions").help("Kafka topic to read from"); parser.addArgument("-k", "--kafka").setDefault("localhost:9092").help("Kafka server and port"); parser.addArgument("-z", "--zookeeper").setDefault("localhost:2181").help("Zookeeper server and port"); parser.addArgument("-i", "--influxdb").setDefault("localhost:8086").help("Influxdb server and port"); parser.addArgument("-u", "--influx-user").setDefault("root").help("Influxdb user"); parser.addArgument("-p", "--influx-password").setDefault("root").help("Influxdb password"); parser.addArgument("-d", "--influx-database").setDefault("seldon").help("Influxdb database"); parser.addArgument("--influx-measurement").setDefault("predictions").help("Influxdb Predictions measurement"); Namespace ns = null; try { ns = parser.parseArgs(args); PredictionsToInfluxDb.process(ns); } catch (ArgumentParserException e) { parser.handleError(e); System.exit(1); } } }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-l", "--list") .dest("list") .action(Arguments.storeTrue()) .setDefault(Boolean.FALSE) .help("list all open locks"); subparser.addArgument("-r", "--force-release") .dest("release") .action(Arguments.storeTrue()) .setDefault(Boolean.FALSE) .help("forcibly release all open locks"); }
public static void main(String[] args) throws Exception { ArgumentParser parser = ArgumentParsers.newArgumentParser("ImpressionsToInfluxDb") .defaultHelp(true) .description("Read Seldon impressions and send stats to influx db"); parser.addArgument("-t", "--topic").setDefault("actions").help("Kafka topic to read from"); parser.addArgument("-c", "--client").required(true).help("Client to run item similarity"); parser.addArgument("-o", "--output-topic").required(true).help("Output topic"); parser.addArgument("-k", "--kafka").setDefault("localhost:9092").help("Kafka server and port"); parser.addArgument("-z", "--zookeeper").setDefault("localhost:2181").help("Zookeeper server and port"); parser.addArgument("-w", "--window-secs").type(Integer.class).setDefault(3600*5).help("streaming window size in secs, -1 means ignore"); parser.addArgument("-u", "--window-processed").type(Integer.class).setDefault(-1).help("streaming window size in processed count, -1 means ignore"); parser.addArgument("--output-poll-secs").type(Integer.class).setDefault(60).help("output timer polling period in secs"); parser.addArgument("--hashes").type(Integer.class).setDefault(100).help("number of hashes"); parser.addArgument("-m", "--min-activity").type(Integer.class).setDefault(200).help("min activity"); parser.addArgument("-p", "--parse-date-method").choices("json-time","json-utc","system").setDefault("json-time").help("min activity"); Namespace ns = null; try { ns = parser.parseArgs(args); ItemSimilarityProcessor processor = new ItemSimilarityProcessor(ns); processor.process(ns); } catch (ArgumentParserException e) { parser.handleError(e); System.exit(1); } }
public JobStartCommand(Subparser parser) { super(parser); parser.help("start a stopped job"); hostsArg = parser.addArgument("hosts") .nargs("+") .help("The hosts to start the job on."); tokenArg = parser.addArgument("--token") .nargs("?") .setDefault("") .help("Insecure access token"); }
public JobStopCommand(Subparser parser) { super(parser); parser.help("stop a running job without undeploying it"); hostsArg = parser.addArgument("hosts") .nargs("+") .help("The hosts to stop the job on."); tokenArg = parser.addArgument("--token") .nargs("?") .setDefault("") .help("Insecure access token"); }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-n", "--dry-run") .action(Arguments.storeTrue()) .dest("dry-run") .setDefault(Boolean.FALSE) .help("output the DDL to stdout, don't run it"); subparser.addArgument("-a", "--all") .action(Arguments.storeTrue()) .dest("all") .setDefault(Boolean.FALSE) .help("mark all pending change sets as applied"); subparser.addArgument("-i", "--include") .action(Arguments.append()) .dest("contexts") .help("include change sets from the given context"); }
public JobRemoveCommand(Subparser parser) { super(parser); parser.help("remove a job"); tokenArg = parser.addArgument("--token") .nargs("?") .setDefault("") .help("Insecure access token"); yesArg = parser.addArgument("--yes") .action(Arguments.storeTrue()) .help("Automatically answer 'yes' to the interactive prompt."); }
public JobStatusCommand(final Subparser parser) { super(parser); parser.help("show job or host status"); jobArg = parser.addArgument("-j", "--job") .help("Job filter"); hostArg = parser.addArgument("--host") .setDefault("") .help("Host pattern"); fullArg = parser.addArgument("-f") .action(storeTrue()) .help("Print full hostnames, job and container id's."); }
public DeploymentGroupWatchCommand(Subparser parser) { super(parser); parser.help("watch deployment groups"); nameArg = parser.addArgument("name") .help("Deployment group name"); fullArg = parser.addArgument("-f") .action(storeTrue()) .help("Print full hostnames and job ids."); intervalArg = parser.addArgument("--interval") .type(Integer.class) .setDefault(1) .help("polling interval, default 1 second"); }
public JobDeployCommand(final Subparser parser) { super(parser); parser.help("deploy a job to hosts"); hostsArg = parser.addArgument("hosts") .nargs("+") .help("The hosts to deploy the job on."); tokenArg = parser.addArgument("--token") .nargs("?") .setDefault("") .help("Insecure access token"); noStartArg = parser.addArgument("--no-start") .action(storeTrue()) .help("Deploy job without starting it."); watchArg = parser.addArgument("--watch") .action(storeTrue()) .help("Watch the newly deployed job (like running job watch right after)"); intervalArg = parser.addArgument("--interval") .setDefault(1) .help("if --watch is specified, the polling interval, default 1 second"); }
public DeploymentGroupCreateCommand(final Subparser parser) { super(parser); parser.help("create a deployment group"); nameArg = parser.addArgument("name") .required(true) .help("Deployment group name"); hostSelectorsArg = parser.addArgument("host_selectors") .action(append()) .setDefault(Lists.newArrayList()) .nargs("+") .help("Host selector expression. Hosts matching this expression will be part of the " + "deployment-group. Multiple conditions can be specified, separated by spaces (as " + "separate arguments). If multiple conditions are given, all must be fulfilled. " + "Operators supported are =, !=, in and notin. Example: foo=bar baz!=qux"); quietArg = parser.addArgument("-q") .action(storeTrue()) .help("only print job id"); }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-n", "--dry-run") .action(Arguments.storeTrue()) .dest("dry-run") .setDefault(Boolean.FALSE) .help("output the DDL to stdout, don't run it"); subparser.addArgument("-c", "--count") .type(Integer.class) .dest("count") .help("only apply the next N change sets"); subparser.addArgument("-i", "--include") .action(Arguments.append()) .dest("contexts") .help("include change sets from the given context"); }
public JobWatchCommand(Subparser parser) { super(parser); parser.help("watch jobs"); jobsArg = parser.addArgument("job") .help("Job reference"); intervalArg = parser.addArgument("--interval") .type(Integer.class) .setDefault(1) .help("polling interval, default 1 second"); prefixesArg = parser.addArgument("hosts") .nargs("*") .help("The hostname prefixes to watch the job on."); exactArg = parser.addArgument("--exact") .action(storeTrue()) .help("Show status of job for every host in hosts"); }
@Override public void configure(Subparser subparser) { subparser.addArgument("-ca", "--ca") .dest("ca") .action(Arguments.storeTrue()) .setDefault(Boolean.FALSE) .help("Generate CA parameters"); subparser.addArgument("-k", "--key") .dest("key") .type(String.class) .help("The CA private signing key"); subparser.addArgument("-i", "--id") .dest("keyId") .type(Integer.class) .help("The key ID to create"); }
public JobUndeployCommand(final Subparser parser) { super(parser); parser.help("undeploy a job from hosts"); hostsArg = parser.addArgument("hosts") .nargs("*") .help("The hosts to undeploy the job from."); tokenArg = parser.addArgument("--token") .nargs("?") .setDefault("") .help("Insecure access token"); allArg = parser.addArgument("-a", "--all") .action(storeTrue()) .help("Undeploy from all currently deployed hosts."); yesArg = parser.addArgument("--yes") .action(storeTrue()) .help("Automatically answer 'yes' to the interactive prompt."); }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-n", "--dry-run") .action(Arguments.storeTrue()) .dest("dry-run") .setDefault(Boolean.FALSE) .help("output the DDL to stdout, don't run it"); subparser.addArgument("-c", "--count") .type(Integer.class) .dest("count") .help("only apply the next N change sets"); subparser.addArgument("-i", "--include") .action(Arguments.append()) .dest("contexts") .help("include change sets from the given context"); }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-n", "--dry-run") .action(Arguments.storeTrue()) .dest("dry-run") .setDefault(Boolean.FALSE) .help("Output the DDL to stdout, don't run it"); subparser.addArgument("-t", "--tag").dest("tag").help("Rollback to the given tag"); subparser.addArgument("-d", "--date") .dest("date") .type(Date.class) .help("Rollback to the given date"); subparser.addArgument("-c", "--count") .dest("count") .type(Integer.class) .help("Rollback the specified number of change sets"); subparser.addArgument("-i", "--include") .action(Arguments.append()) .dest("contexts") .help("include change sets from the given context"); }