本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
示例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.");
}
示例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);
}
示例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();
}
示例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);
}
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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();
}
示例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);
}