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


Java CommandLine类代码示例

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


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

示例1: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Pair<Configuration, Configuration> parseCommandLine(final String[] args)
    throws ParseException, InjectionException, IOException, ClassNotFoundException {

  final List<Class<? extends Name<?>>> clientParamList = Arrays.asList(
      OnLocal.class, LocalRuntimeMaxNumEvaluators.class, JVMHeapSlack.class, Timeout.class);

  // parameters for driver (job server)
  final List<Class<? extends Name<?>>> driverParamList = Arrays.asList(DriverMemory.class,
      Parameters.NumTotalResources.class, Parameters.SchedulerClass.class);

  final CommandLine cl = new CommandLine();
  clientParamList.forEach(cl::registerShortNameOfClass);
  driverParamList.forEach(cl::registerShortNameOfClass);

  final Configuration commandLineConf = cl.processCommandLine(args).getBuilder().build();
  final Configuration clientConf = ConfigurationUtils.extractParameterConf(clientParamList, commandLineConf);
  final Configuration driverConf = ConfigurationUtils.extractParameterConf(driverParamList, commandLineConf);
  return Pair.of(clientConf, driverConf);
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:21,代码来源:JobServerClient.java

示例2: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static List<Configuration> parseCommandLine(final String[] args,
                                                    final List<Class<? extends Name<?>>> userParamList)
    throws IOException {

  final List<Class<? extends Name<?>>> clientParamList = Arrays.asList(
      OnLocal.class, LocalRuntimeMaxNumEvaluators.class, JVMHeapSlack.class, DriverMemory.class, Timeout.class,
      ChkpCommitPath.class, ChkpTempPath.class);

  final List<Class<? extends Name<?>>> driverParamList = Arrays.asList(
      InputDir.class, NumWorkers.class, WorkerMemSize.class, WorkerNumCores.class);

  final CommandLine cl = new CommandLine();
  clientParamList.forEach(cl::registerShortNameOfClass);
  driverParamList.forEach(cl::registerShortNameOfClass);
  userParamList.forEach(cl::registerShortNameOfClass);

  final Configuration commandLineConf = cl.processCommandLine(args).getBuilder().build();
  final Configuration clientConf = ConfigurationUtils.extractParameterConf(clientParamList, commandLineConf);
  final Configuration driverConf = ConfigurationUtils.extractParameterConf(driverParamList, commandLineConf);
  final Configuration userConf = ConfigurationUtils.extractParameterConf(userParamList, commandLineConf);

  return Arrays.asList(clientConf, driverConf, userConf);
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:24,代码来源:PregelLauncher.java

示例3: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] args) throws IOException, InjectionException {
  final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
  new CommandLine(cb)
      .registerShortNameOfClass(Parameters.Timeout.class)
      .registerShortNameOfClass(NumUpdates.class)
      .registerShortNameOfClass(NumKeys.class)
      .registerShortNameOfClass(StartKey.class)
      .registerShortNameOfClass(DeltaValue.class)
      .registerShortNameOfClass(UpdateCoefficient.class)
      .registerShortNameOfClass(NumWorkers.class)
      .registerShortNameOfClass(NumServers.class)
      .registerShortNameOfClass(MetricFlushPeriodMs.class)
      .processCommandLine(args);

  final Configuration clConf = cb.build();
  validateArgs(clConf);

  return clConf;
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:20,代码来源:AddIntegerET.java

示例4: main

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
public static void main(final String[] args)
    throws InjectionException, BindException, IOException {

  final Tang tang = Tang.Factory.getTang();
  final JavaConfigurationBuilder cb = tang.newConfigurationBuilder();
  new CommandLine(cb)
      .registerShortNameOfClass(Local.class)
      .registerShortNameOfClass(TimeOut.class)
      .registerShortNameOfClass(OutputDir.class)
      .processCommandLine(args);

  final Injector injector = tang.newInjector(cb.build());
  final boolean isLocal = injector.getNamedInstance(Local.class);
  final String outputDir = injector.getNamedInstance(OutputDir.class);
  final int jobTimeout = injector.getNamedInstance(TimeOut.class) * 60 * 1000;

  final Configuration driverConf = getDriverConf();
  final Configuration outputServiceConf = getOutputServiceConf(isLocal, outputDir);
  final Configuration submittedConfiguration = Tang.Factory.getTang()
      .newConfigurationBuilder(driverConf, outputServiceConf)
      .build();
  final LauncherStatus state = DriverLauncher.getLauncher(getRuntimeConf(isLocal))
      .run(submittedConfiguration, jobTimeout);

  LOG.log(Level.INFO, "REEF job completed: {0}", state);
}
 
开发者ID:apache,项目名称:reef,代码行数:27,代码来源:OutputServiceREEF.java

示例5: main

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
public static void main(final String[] args) throws Exception {
  final Tang tang = Tang.Factory.getTang();
  final JavaConfigurationBuilder cb = tang.newConfigurationBuilder();
  final CommandLine cl = new CommandLine(cb);
  cl.registerShortNameOfClass(Timer.Seconds.class);
  cl.processCommandLine(args);
  final Configuration conf = cb.build();
  System.out.println("start conf");
  final AvroConfigurationSerializer avroSerializer = new AvroConfigurationSerializer();
  System.out.println(avroSerializer.toString(conf));
  System.out.println("end conf");
  final InjectorImpl injector = (InjectorImpl) tang.newInjector(conf);
  final InjectionPlan<Timer> ip = injector.getInjectionPlan(Timer.class);
  System.out.println(ip.toPrettyString());
  System.out.println("Number of plans:" + ip.getNumAlternatives());
  final Timer timer = injector.getInstance(Timer.class);
  System.out.println("Tick...");
  timer.sleep();
  System.out.println("Tock.");
}
 
开发者ID:apache,项目名称:reef,代码行数:21,代码来源:Timer.java

示例6: registerShortNames

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
/**
 * Register all short names to the command line parser, for use at the client.
 * @param commandLine The CommandLine instantiated at the client.
 * @return The CommandLine after short names are registered.
 */
public static CommandLine registerShortNames(final CommandLine commandLine) {
  return commandLine
      .registerShortNameOfClass(ReceiverType.class)
      .registerShortNameOfClass(ReceiverHost.class)
      .registerShortNameOfClass(ReceiverPort.class);
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:12,代码来源:HTraceParameters.java

示例7: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] args) throws IOException {
  final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
  final CommandLine cl = new CommandLine(cb);
  // add all basic parameters
  cl.registerShortNameOfClass(Parameters.OnLocal.class);

  cl.processCommandLine(args);
  return cb.build();
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:10,代码来源:CheckpointET.java

示例8: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] args) {
  try {
    final ConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
    final CommandLine cl = new CommandLine(cb);
    cl.registerShortNameOfClass(MetricAutomaticFlushPeriodMs.class)
        .registerShortNameOfClass(MetricManualFlushPeriodMs.class)
        .registerShortNameOfClass(CustomMetricRecordPeriodMs.class)
        .registerShortNameOfClass(TaskDurationMs.class);
    cl.processCommandLine(args);

    return cb.build();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:16,代码来源:MetricET.java

示例9: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] args) throws IOException {
  final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
  final CommandLine cl = new CommandLine(cb);
  cl.registerShortNameOfClass(KeyValueDataPath.class);
  cl.registerShortNameOfClass(NoneKeyDataPath.class);
  cl.processCommandLine(args);
  return cb.build();
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:9,代码来源:LoadET.java

示例10: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] args) throws IOException {
  final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
  final CommandLine cl = new CommandLine(cb);
  // add all basic parameters
  cl.registerShortNameOfClass(Parameters.OnLocal.class);
  cl.registerShortNameOfClass(Parameters.Splits.class);
  cl.registerShortNameOfClass(Parameters.Timeout.class);

  cl.processCommandLine(args);
  return cb.build();
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:12,代码来源:ETCentCommExample.java

示例11: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] args) throws IOException {
  final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
  final CommandLine cl = new CommandLine(cb);
  // add all basic parameters
  cl.registerShortNameOfClass(Parameters.OnLocal.class);
  cl.registerShortNameOfClass(LineCountingDriver.Inputs.class);
  cl.registerShortNameOfClass(Parameters.Splits.class);
  cl.registerShortNameOfClass(Parameters.Timeout.class);

  cl.processCommandLine(args);
  return cb.build();
}
 
开发者ID:snuspl,项目名称:cruise,代码行数:13,代码来源:LineCountingClient.java

示例12: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] aArgs) {
  final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
  try {
    new CommandLine(cb)
        .registerShortNameOfClass(Local.class)
        .registerShortNameOfClass(TimeOut.class)
        .processCommandLine(aArgs);
    return cb.build();
  } catch (final BindException | IOException ex) {
    final String msg = "Unable to parse command line";
    LOG.log(Level.SEVERE, msg, ex);
    throw new RuntimeException(msg, ex);
  }
}
 
开发者ID:apache,项目名称:reef,代码行数:15,代码来源:FailureREEF.java

示例13: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
/**
 * Parse the command line arguments.
 *
 * @param args command line arguments, as passed to main()
 * @return Configuration object.
 * @throws BindException configuration error.
 * @throws IOException   error reading the configuration.
 */
private static Configuration parseCommandLine(final String[] args)
    throws BindException, IOException {
  final JavaConfigurationBuilder confBuilder = Tang.Factory.getTang().newConfigurationBuilder();
  final CommandLine cl = new CommandLine(confBuilder);
  cl.registerShortNameOfClass(Local.class);
  cl.registerShortNameOfClass(Piggyback.class);
  cl.registerShortNameOfClass(NumEvaluators.class);
  cl.registerShortNameOfClass(NumTasks.class);
  cl.registerShortNameOfClass(Delay.class);
  cl.registerShortNameOfClass(JobId.class);
  cl.processCommandLine(args);
  return confBuilder.build();
}
 
开发者ID:apache,项目名称:reef,代码行数:22,代码来源:Launch.java

示例14: parseCommandLine

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
private static Configuration parseCommandLine(final String[] aArgs) {
  final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
  try {
    final CommandLine cl = new CommandLine(cb);
    cl.registerShortNameOfClass(Local.class);
    cl.registerShortNameOfClass(ModelDimensions.class);
    cl.registerShortNameOfClass(NumberOfReceivers.class);
    cl.processCommandLine(aArgs);
  } catch (final IOException ex) {
    final String msg = "Unable to parse command line";
    LOG.log(Level.SEVERE, msg, ex);
    throw new RuntimeException(msg, ex);
  }
  return cb.build();
}
 
开发者ID:apache,项目名称:reef,代码行数:16,代码来源:BroadcastREEF.java

示例15: registerShortNames

import org.apache.reef.tang.formats.CommandLine; //导入依赖的package包/类
public static CommandLine registerShortNames(final CommandLine commandLine) {
  return commandLine
      .registerShortNameOfClass(ModelDimensions.class)
      .registerShortNameOfClass(Lambda.class)
      .registerShortNameOfClass(Eps.class)
      .registerShortNameOfClass(Eta.class)
      .registerShortNameOfClass(ProbabilityOfSuccessfulIteration.class)
      .registerShortNameOfClass(Iterations.class)
      .registerShortNameOfClass(EnableRampup.class)
      .registerShortNameOfClass(MinParts.class)
      .registerShortNameOfClass(LossFunctionType.class);
}
 
开发者ID:apache,项目名称:reef,代码行数:13,代码来源:BGDControlParameters.java


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