use of org.apache.samza.util.CommandLine in project samza by apache.
the class ConfigManager method main.
/**
* Main function for using the Config Manager. The main function starts a Config Manager, and reacts to all messages thereafter
* In order for this module to run, you have to add the following configurations to the config file:
* yarn.rm.address=localhost //the ip of the resource manager in yarn
* yarn.rm.port=8088 //the port of the resource manager http server
* Additionally, the config manger will periodically poll the coordinator stream to see if there are any new messages.
* This period is set to 100 ms by default. However, it can be configured by adding the following property to the input config file.
* configManager.polling.interval= < polling interval >
* To run the code use the following command:
* {path to samza deployment}/samza/bin/run-config-manager.sh --config-factory={config-factory} --config-path={path to config file of a job}
*
* @param args input arguments for running ConfigManager.
*/
public static void main(String[] args) {
CommandLine cmdline = new CommandLine();
OptionSet options = cmdline.parser().parse(args);
Config config = cmdline.loadConfig(options);
ConfigManager configManager = new ConfigManager(config);
configManager.run();
}
use of org.apache.samza.util.CommandLine in project samza by apache.
the class YarnJobValidationTool method main.
public static void main(String[] args) throws Exception {
CommandLine cmdline = new CommandLine();
OptionParser parser = cmdline.parser();
OptionSpec<String> validatorOpt = parser.accepts("metrics-validator", "The metrics validator class.").withOptionalArg().ofType(String.class).describedAs("com.foo.bar.ClassName");
OptionSet options = cmdline.parser().parse(args);
Config config = cmdline.loadConfig(options);
MetricsValidator validator = null;
if (options.has(validatorOpt)) {
String validatorClass = options.valueOf(validatorOpt);
validator = ReflectionUtil.getObj(validatorClass, MetricsValidator.class);
}
YarnConfiguration hadoopConfig = new YarnConfiguration();
hadoopConfig.set("fs.http.impl", HttpFileSystem.class.getName());
hadoopConfig.set("fs.https.impl", HttpFileSystem.class.getName());
ClientHelper clientHelper = new ClientHelper(hadoopConfig);
new YarnJobValidationTool(new JobConfig(config), clientHelper.yarnClient(), validator).run();
}
use of org.apache.samza.util.CommandLine in project samza by apache.
the class SamzaRestService method parseConfig.
/**
* Reads a {@link org.apache.samza.config.Config} from command line parameters.
* @param args the command line parameters supported by {@link org.apache.samza.util.CommandLine}.
* @return the parsed {@link org.apache.samza.config.Config}.
*/
private static SamzaRestConfig parseConfig(String[] args) {
CommandLine cmd = new CommandLine();
OptionSet options = cmd.parser().parse(args);
Config cfg = cmd.loadConfig(options);
return new SamzaRestConfig(new MapConfig(cfg));
}
use of org.apache.samza.util.CommandLine in project samza by apache.
the class OrderShipmentJoinExample method main.
// local execution mode
public static void main(String[] args) throws Exception {
CommandLine cmdLine = new CommandLine();
Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
ApplicationRunner runner = ApplicationRunners.getApplicationRunner(new OrderShipmentJoinExample(), config);
runner.run();
runner.waitForFinish();
}
use of org.apache.samza.util.CommandLine in project samza by apache.
the class RepartitionExample method main.
// local execution mode
public static void main(String[] args) {
CommandLine cmdLine = new CommandLine();
Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
ApplicationRunner runner = ApplicationRunners.getApplicationRunner(new RepartitionExample(), config);
runner.run();
runner.waitForFinish();
}
Aggregations