use of org.kohsuke.args4j.CmdLineParser in project asterixdb by apache.
the class Join method main.
public static void main(String[] args) throws Exception {
Options options = new Options();
CmdLineParser parser = new CmdLineParser(options);
if (args.length == 0) {
parser.printUsage(System.err);
return;
}
parser.parseArgument(args);
IHyracksClientConnection hcc = new HyracksConnection(options.host, options.port);
JobSpecification job = createJob(parseFileSplits(options.inFileCustomerSplits), parseFileSplits(options.inFileOrderSplits), parseFileSplits(options.outFileSplits), options.numJoinPartitions, options.algo, options.graceInputSize, options.graceRecordsPerFrame, options.graceFactor, options.memSize, options.tableSize, options.hasGroupBy, options.frameSize);
if (job == null) {
return;
}
long start = System.currentTimeMillis();
JobId jobId = hcc.startJob(job, options.profile ? EnumSet.of(JobFlag.PROFILE_RUNTIME) : EnumSet.noneOf(JobFlag.class));
hcc.waitForCompletion(jobId);
long end = System.currentTimeMillis();
System.err.println(start + " " + end + " " + (end - start));
}
use of org.kohsuke.args4j.CmdLineParser in project asterixdb by apache.
the class WordCountMain method main.
public static void main(String[] args) throws Exception {
Options options = new Options();
CmdLineParser parser = new CmdLineParser(options);
parser.parseArgument(args);
IHyracksClientConnection hcc = new HyracksConnection(options.host, options.port);
JobSpecification job = createJob(parseFileSplits(options.inFileSplits), parseFileSplits(options.outFileSplits), options.algo, options.htSize, options.memFrameLimit, options.format, options.frameSize);
long start = System.currentTimeMillis();
JobId jobId = hcc.startJob(job, options.runtimeProfiling ? EnumSet.of(JobFlag.PROFILE_RUNTIME) : EnumSet.noneOf(JobFlag.class));
hcc.waitForCompletion(jobId);
long end = System.currentTimeMillis();
System.err.println(start + " " + end + " " + (end - start));
}
use of org.kohsuke.args4j.CmdLineParser in project asterixdb by apache.
the class NCService method main.
public static void main(String[] args) throws Exception {
// Register a shutdown hook which will kill the NC if the NC Service is killed.
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
if (proc != null) {
proc.destroy();
}
}
});
config = new NCServiceConfig();
CmdLineParser cp = new CmdLineParser(config);
try {
cp.parseArgument(args);
} catch (Exception e) {
e.printStackTrace();
cp.printUsage(System.err);
System.exit(1);
}
config.loadConfigAndApplyDefaults();
// Initializes the oxMXBean.
osMXBean = ManagementFactory.getOperatingSystemMXBean();
// For now we implement a trivial listener which just
// accepts an IP/port combination from the CC. This could
// be made more advanced in several ways depending on whether
// we want to expand the functionality of this service.
// For now this gets the job done, without radically changing
// the NC itself so that Managix can continue to function.
InetAddress addr = config.address == null ? null : InetAddress.getByName(config.address);
int port = config.port;
// when the child NC terminates for any reason.
while (true) {
try (ServerSocket listener = new ServerSocket(port, 5, addr)) {
boolean launched = false;
while (!launched) {
LOGGER.info("Waiting for connection from CC on " + (addr == null ? "*" : addr) + ":" + port);
try (Socket socket = listener.accept()) {
// QQQ Because acceptConnection() doesn't return if the
// service is started appropriately, the socket remains
// open but non-responsive.
launched = acceptConnection(socket.getInputStream());
}
}
}
}
}
use of org.kohsuke.args4j.CmdLineParser in project asterixdb by apache.
the class EventDriver method main.
public static void main(String[] args) throws Exception {
String eventsHome = System.getenv("EVENT_HOME");
if (eventsHome == null) {
throw new IllegalStateException("EVENT_HOME is not set");
}
eventsDir = eventsHome + File.separator + EventUtil.EVENTS_DIR;
EventConfig eventConfig = new EventConfig();
CmdLineParser parser = new CmdLineParser(eventConfig);
try {
parser.parseArgument(args);
if (eventConfig.help) {
parser.printUsage(System.out);
}
if (eventConfig.seed > 0) {
Randomizer.getInstance(eventConfig.seed);
}
Cluster cluster = initializeCluster(eventConfig.clusterPath);
if (!eventConfig.dryRun) {
prepare(cluster);
}
if (!eventConfig.dryRun) {
cleanup(cluster);
}
} catch (Exception e) {
e.printStackTrace();
parser.printUsage(System.err);
}
}
use of org.kohsuke.args4j.CmdLineParser in project asterixdb by apache.
the class AbstractCommand method execute.
public void execute(String[] args) throws Exception {
String[] cmdArgs = new String[args.length - 1];
System.arraycopy(args, 1, cmdArgs, 0, cmdArgs.length);
config = getCommandConfig();
CmdLineParser parser = new CmdLineParser(config);
parser.parseArgument(cmdArgs);
execCommand();
}
Aggregations