当前位置: 首页>>代码示例>>Java>>正文


Java CommandLine类代码示例

本文整理汇总了Java中org.apache.samza.util.CommandLine的典型用法代码示例。如果您正苦于以下问题:Java CommandLine类的具体用法?Java CommandLine怎么用?Java CommandLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CommandLine类属于org.apache.samza.util包,在下文中一共展示了CommandLine类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
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 = ClassLoaderHelper.<MetricsValidator>fromClassName(validatorClass);
  }

  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();
}
 
开发者ID:apache,项目名称:samza,代码行数:22,代码来源:YarnJobValidationTool.java

示例2: parseConfig

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
/**
 * 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);
  MapConfig cfg = cmd.loadConfig(options);
  return new SamzaRestConfig(new MapConfig(cfg));
}
 
开发者ID:apache,项目名称:samza,代码行数:12,代码来源:SamzaRestService.java

示例3: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
/**
 * Executes the application using the local application runner.
 * It takes two required command line arguments
 *  config-factory: a fully {@link org.apache.samza.config.factories.PropertiesConfigFactory} class name
 *  config-path: path to application properties
 *
 * @param args command line arguments
 */
public static void main(String[] args) {
  CommandLine cmdLine = new CommandLine();
  OptionSet options = cmdLine.parser().parse(args);
  Config config = cmdLine.loadConfig(options);

  LocalApplicationRunner runner = new LocalApplicationRunner(config);
  WikipediaApplication app = new WikipediaApplication();

  runner.run(app);
  runner.waitForFinish();
}
 
开发者ID:apache,项目名称:samza-hello-samza,代码行数:20,代码来源:WikipediaZkLocalApplication.java

示例4: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) {
  CommandLine cmdLine = new CommandLine();
  OptionSet options = cmdLine.parser().parse(args);
  Config config = cmdLine.loadConfig(options);

  LocalApplicationRunner runner = new LocalApplicationRunner(config);
  AzureApplication app = new AzureApplication();

  runner.run(app);
  runner.waitForFinish();
}
 
开发者ID:apache,项目名称:samza-hello-samza,代码行数:12,代码来源:AzureZKLocalApplication.java

示例5: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
  LocalApplicationRunner localRunner = new LocalApplicationRunner(config);
  localRunner.run(new OrderShipmentJoinExample());
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:OrderShipmentJoinExample.java

示例6: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
  LocalApplicationRunner localRunner = new LocalApplicationRunner(config);
  localRunner.run(new RepartitionExample());
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:RepartitionExample.java

示例7: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
  LocalApplicationRunner localRunner = new LocalApplicationRunner(config);
  localRunner.run(new KeyValueStoreExample());
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:KeyValueStoreExample.java

示例8: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) {
  CommandLine cmdLine = new CommandLine();
  Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
  LocalApplicationRunner localRunner = new LocalApplicationRunner(config);
  localRunner.run(new PageViewCounterExample());
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:PageViewCounterExample.java

示例9: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
  LocalApplicationRunner localRunner = new LocalApplicationRunner(config);
  localRunner.run(new MergeExample());
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:MergeExample.java

示例10: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
  LocalApplicationRunner localRunner = new LocalApplicationRunner(config);
  localRunner.run(new WindowExample());
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:WindowExample.java

示例11: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  Config config = cmdLine.loadConfig(cmdLine.parser().parse(args));
  LocalApplicationRunner localRunner = new LocalApplicationRunner(config);
  localRunner.run(new BroadcastExample());
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:BroadcastExample.java

示例12: main

import org.apache.samza.util.CommandLine; //导入依赖的package包/类
/**
 * 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= &lt; polling interval &gt;
 * 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();
}
 
开发者ID:apache,项目名称:samza,代码行数:21,代码来源:ConfigManager.java


注:本文中的org.apache.samza.util.CommandLine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。