use of org.apache.commons.cli.Options in project pinot by linkedin.
the class FileBasedServer method processCommandLineArgs.
private static void processCommandLineArgs(String[] cliArgs) throws ParseException {
CommandLineParser cliParser = new GnuParser();
Options cliOptions = buildCommandLineOptions();
CommandLine cmd = cliParser.parse(cliOptions, cliArgs, true);
if (!cmd.hasOption(SERVER_CONFIG_OPT_NAME) || !cmd.hasOption(SERVER_PORT_OPT_NAME)) {
System.err.println("Missing required arguments !!");
System.err.println(cliOptions);
throw new RuntimeException("Missing required arguments !!");
}
_serverConfigPath = cmd.getOptionValue(SERVER_CONFIG_OPT_NAME);
_serverPort = Integer.parseInt(cmd.getOptionValue(SERVER_PORT_OPT_NAME));
}
use of org.apache.commons.cli.Options in project pinot by linkedin.
the class ScatterGatherPerfServer method main.
/**
* @param args
*/
public static void main(String[] args) throws Exception {
CommandLineParser cliParser = new GnuParser();
Options cliOptions = buildCommandLineOptions();
CommandLine cmd = cliParser.parse(cliOptions, args, true);
if (!cmd.hasOption(RESPONSE_SIZE_OPT_NAME) || !cmd.hasOption(SERVER_PORT_OPT_NAME)) {
System.err.println("Missing required arguments !!");
System.err.println(cliOptions);
throw new RuntimeException("Missing required arguments !!");
}
int responseSize = Integer.parseInt(cmd.getOptionValue(RESPONSE_SIZE_OPT_NAME));
int serverPort = Integer.parseInt(cmd.getOptionValue(SERVER_PORT_OPT_NAME));
// 2ms latency
ScatterGatherPerfServer server = new ScatterGatherPerfServer(serverPort, responseSize, 2);
server.run();
}
use of org.apache.commons.cli.Options in project pinot by linkedin.
the class ScatterGatherPerfTester method buildCommandLineOptions.
private static Options buildCommandLineOptions() {
Options options = new Options();
options.addOption(EXECUTION_MODE, true, "Execution Mode. One of " + EnumSet.allOf(ExecutionMode.class));
options.addOption(NUM_CLIENTS, true, "Number of Client instances. (Clients will not share connection-pool). Used only when execution mode is RUN_CLIENT or RUN_BOTH");
options.addOption(NUM_SERVERS, true, "Number of server instances. Used only when execution mode is RUN_SERVER or RUN_BOTH");
options.addOption(REQUEST_SIZE, true, "Request Size. Used only when execution mode is RUN_SERVER or RUN_BOTH");
options.addOption(RESPONSE_SIZE, true, "Response Size. Used only when execution mode is RUN_SERVER or RUN_BOTH");
options.addOption(NUM_REQUESTS, true, "Number of requests to be sent per Client instances. Used only when execution mode is RUN_CLIENT or RUN_BOTH");
options.addOption(SERVER_START_PORT, true, "Start port for server. If execution_mode == RUN_SERVER or RUN_BOTH, then, N (controlled by num_servers) servers will be started with port numbers monotonically incremented from this value. If execution_mode == RUN_CLIENT, then N servers are assumed to be running remotely and this client connects to them");
options.addOption(SYNC_REQUEST_DISPATCH, false, "Do we want to send requests synchronously (one by one requests and response per client). Set it to false to mimic production workflows");
options.addOption(SERVER_HOSTS, true, "Comma seperated list of remote hosts where the servers are assumed to be running with same ports (assigned from start_port_num)");
options.addOption(CONN_POOL_SIZE_PER_PEER, true, "Number of max active connections to be allowed");
options.addOption(NUM_RESPONSE_READERS, true, "Number of reponse reader threads per Client instances. Used only when execution mode is RUN_CLIENT or RUN_BOTH");
options.addOption(RESPONSE_LATENCY, true, "Induced Latency in server per request. Used only when execution mode is RUN_SERVER or RUN_BOTH");
return options;
}
use of org.apache.commons.cli.Options in project pinot by linkedin.
the class ScatterGatherPerfClient method main.
public static void main(String[] args) throws Exception {
//Process Command Line to get config and port
CommandLineParser cliParser = new GnuParser();
Options cliOptions = buildCommandLineOptions();
CommandLine cmd = cliParser.parse(cliOptions, args, true);
if ((!cmd.hasOption(BROKER_CONFIG_OPT_NAME)) || (!cmd.hasOption(REQUEST_SIZE_OPT_NAME)) || (!cmd.hasOption(TABLE_NAME_OPT_NAME)) || (!cmd.hasOption(TABLE_NAME_OPT_NAME))) {
System.err.println("Missing required arguments !!");
System.err.println(cliOptions);
throw new RuntimeException("Missing required arguments !!");
}
String brokerConfigPath = cmd.getOptionValue(BROKER_CONFIG_OPT_NAME);
int requestSize = Integer.parseInt(cmd.getOptionValue(REQUEST_SIZE_OPT_NAME));
int numRequests = Integer.parseInt(cmd.getOptionValue(NUM_REQUESTS_OPT_NAME));
String resourceName = cmd.getOptionValue(TABLE_NAME_OPT_NAME);
// build brokerConf
PropertiesConfiguration brokerConf = new PropertiesConfiguration();
brokerConf.setDelimiterParsingDisabled(false);
brokerConf.load(brokerConfigPath);
RoutingTableConfig config = new RoutingTableConfig();
config.init(brokerConf.subset(ROUTING_CFG_PREFIX));
ScatterGatherPerfClient client = new ScatterGatherPerfClient(config, requestSize, resourceName, false, numRequests, 1, 1);
client.run();
System.out.println("Shutting down !!");
client.shutdown();
System.out.println("Shut down complete !!");
}
use of org.apache.commons.cli.Options in project hadoop by apache.
the class ClusterCLI method run.
@Override
public int run(String[] args) throws Exception {
Options opts = new Options();
opts.addOption("lnl", LIST_LABELS_CMD, false, "List cluster node-label collection");
opts.addOption("h", HELP_CMD, false, "Displays help for all commands.");
opts.addOption("dnl", DIRECTLY_ACCESS_NODE_LABEL_STORE, false, "This is DEPRECATED, will be removed in future releases. Directly access node label store, " + "with this option, all node label related operations" + " will NOT connect RM. Instead, they will" + " access/modify stored node labels directly." + " By default, it is false (access via RM)." + " AND PLEASE NOTE: if you configured " + YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR + " to a local directory" + " (instead of NFS or HDFS), this option will only work" + " when the command run on the machine where RM is running." + " Also, this option is UNSTABLE, could be removed in future" + " releases.");
int exitCode = -1;
CommandLine parsedCli = null;
try {
parsedCli = new GnuParser().parse(opts, args);
} catch (MissingArgumentException ex) {
sysout.println("Missing argument for options");
printUsage(opts);
return exitCode;
}
if (parsedCli.hasOption(DIRECTLY_ACCESS_NODE_LABEL_STORE)) {
accessLocal = true;
}
if (parsedCli.hasOption(LIST_LABELS_CMD)) {
printClusterNodeLabels();
} else if (parsedCli.hasOption(HELP_CMD)) {
printUsage(opts);
return 0;
} else {
syserr.println("Invalid Command Usage : ");
printUsage(opts);
}
return 0;
}
Aggregations