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


Java ConfigurationModule类代码示例

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


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

示例1: getDriverConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
private Configuration getDriverConfiguration(final URI jobFolder,
                                             final String clientRemoteId,
                                             final String jobId) {
  ConfigurationModule configModule = StandaloneDriverConfiguration.CONF
      .set(StandaloneDriverConfiguration.ROOT_FOLDER, jobFolder.getPath())
      .set(StandaloneDriverConfiguration.NODE_FOLDER, this.nodeFolder)
      .set(StandaloneDriverConfiguration.NODE_LIST_FILE_PATH, this.nodeListFilePath)
      .set(StandaloneDriverConfiguration.SSH_PORT_NUM, this.sshPortNum)
      .set(StandaloneDriverConfiguration.JVM_HEAP_SLACK, this.jvmHeapSlack)
      .set(StandaloneDriverConfiguration.CLIENT_REMOTE_IDENTIFIER, clientRemoteId)
      .set(StandaloneDriverConfiguration.JOB_IDENTIFIER, jobId);
  for (final String nodeInfo : nodeInfoSet) {
    configModule = configModule.set(StandaloneDriverConfiguration.NODE_INFO_SET, nodeInfo);
  }
  return configModule.build();
}
 
开发者ID:apache,项目名称:reef,代码行数:17,代码来源:StandaloneDriverConfigurationProviderImpl.java

示例2: getDriverConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
/**
 * Assembles the driver configuration.
 *
 * @param jobFolder                The folder in which the local runtime will execute this job.
 * @param clientRemoteId           the remote identifier of the client. It is used by the Driver to establish a
 *                                 connection back to the client.
 * @param jobId                    The identifier of the job.
 * @param applicationConfiguration The configuration of the application, e.g. a filled out DriverConfiguration
 * @return The Driver configuration to be used to instantiate the Driver.
 */
@Override
public Configuration getDriverConfiguration(final URI jobFolder,
                                            final String clientRemoteId,
                                            final String jobId,
                                            final Configuration applicationConfiguration) {
  AvroMultiRuntimeDefinition runtimeDefinitions = this.definitionGenerator.getMultiRuntimeDefinition(
          jobFolder,
          clientRemoteId,
          jobId);
  ConfigurationModule conf = MultiRuntimeDriverConfiguration.CONF;

  for(AvroRuntimeDefinition runtimeDefinition : runtimeDefinitions.getRuntimes()){
    conf = conf.set(MultiRuntimeDriverConfiguration.RUNTIME_NAMES, runtimeDefinition.getRuntimeName().toString());
  }

  final Configuration mainConfiguration = this.mainRuntimeConfigGenerator.getMainConfiguration();

  return Configurations.merge(mainConfiguration, applicationConfiguration,
                  conf
                  .set(MultiRuntimeDriverConfiguration.JOB_IDENTIFIER, jobId)
                  .set(MultiRuntimeDriverConfiguration.CLIENT_REMOTE_IDENTIFIER, clientRemoteId)
                  .set(MultiRuntimeDriverConfiguration.SERIALIZED_RUNTIME_DEFINITION,
                          this.runtimeDefinitionSerializer.toString(runtimeDefinitions))
                  .build());
}
 
开发者ID:apache,项目名称:reef,代码行数:36,代码来源:MultiRuntimeDriverConfigurationProvider.java

示例3: getLocalConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
private Configuration getLocalConfiguration(final URI jobFolder,
                                            final String clientRemoteId,
                                            final String jobId) {

  ConfigurationModule localModule = LocalDriverConfiguration.CONF
          .set(LocalDriverConfiguration.MAX_NUMBER_OF_EVALUATORS, this.maxEvaluators)
          // ROOT FOLDER will point to the current runtime directory
          .set(LocalDriverConfiguration.ROOT_FOLDER, ".")
          .set(LocalDriverConfiguration.JVM_HEAP_SLACK, this.jvmSlack)
          .set(LocalDriverConfiguration.CLIENT_REMOTE_IDENTIFIER, clientRemoteId)
          .set(LocalDriverConfiguration.JOB_IDENTIFIER, jobId)
          .set(LocalDriverConfiguration.RUNTIME_NAMES,
                  org.apache.reef.runtime.local.driver.RuntimeIdentifier.RUNTIME_NAME);
  for (final String rackName : rackNames) {
    localModule = localModule.set(LocalDriverConfiguration.RACK_NAMES, rackName);
  }

  return localModule.build();
}
 
开发者ID:apache,项目名称:reef,代码行数:20,代码来源:MultiRuntimeDefinitionGeneratorImpl.java

示例4: getDriverConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
public static ConfigurationModule getDriverConfiguration() {
  return DriverConfiguration.CONF
      .setMultiple(DriverConfiguration.GLOBAL_LIBRARIES, EnvironmentUtils.getAllClasspathJars())
      .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, JobDriver.AllocatedEvaluatorHandler.class)
      .set(DriverConfiguration.ON_EVALUATOR_FAILED, JobDriver.FailedEvaluatorHandler.class)
      .set(DriverConfiguration.ON_CONTEXT_ACTIVE, JobDriver.ActiveContextHandler.class)
      .set(DriverConfiguration.ON_CONTEXT_CLOSED, JobDriver.ClosedContextHandler.class)
      .set(DriverConfiguration.ON_CONTEXT_FAILED, JobDriver.FailedContextHandler.class)
      .set(DriverConfiguration.ON_CONTEXT_MESSAGE, JobDriver.ContextMessageHandler.class)
      .set(DriverConfiguration.ON_TASK_MESSAGE, JobDriver.TaskMessageHandler.class)
      .set(DriverConfiguration.ON_TASK_FAILED, JobDriver.FailedTaskHandler.class)
      .set(DriverConfiguration.ON_TASK_RUNNING, JobDriver.RunningTaskHandler.class)
      .set(DriverConfiguration.ON_TASK_COMPLETED, JobDriver.CompletedTaskHandler.class)
      .set(DriverConfiguration.ON_DRIVER_STARTED, JobDriver.StartHandler.class)
      .set(DriverConfiguration.ON_TASK_SUSPENDED, JobDriver.SuspendedTaskHandler.class)
      .set(DriverConfiguration.ON_EVALUATOR_COMPLETED, JobDriver.CompletedEvaluatorHandler.class);
}
 
开发者ID:apache,项目名称:reef,代码行数:18,代码来源:JobClient.java

示例5: getDriverConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
/**
 * Assembles the driver configuration using the DriverConfiguration class.
 *
 * @param theFiles
 * @return
 * @throws BindException
 */
private static Configuration getDriverConfiguration(final Set<File> theFiles) throws BindException {
  ConfigurationModule driverConfigurationModule = DriverConfiguration.CONF
      .set(DriverConfiguration.GLOBAL_LIBRARIES, EnvironmentUtils.getClassLocation(FileResourceTestDriver.class))
      .set(DriverConfiguration.DRIVER_IDENTIFIER, "TEST_FileResourceTest")
      .set(DriverConfiguration.ON_DRIVER_STARTED, FileResourceTestDriver.StartHandler.class)
      .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, FileResourceTestDriver.EvaluatorAllocatedHandler.class);

  for (final File f : theFiles) {
    LOG.log(Level.FINEST, "Adding a file to the DriverConfiguration: " + f.getAbsolutePath());
    driverConfigurationModule = driverConfigurationModule.set(DriverConfiguration.LOCAL_FILES, f.getAbsolutePath());
  }
  return driverConfigurationModule.build();
}
 
开发者ID:apache,项目名称:reef,代码行数:21,代码来源:FileResourceTest.java

示例6: getTestDriverConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
/**
 * Assembles the configuration based on TestDriverConfiguration.
 *
 * @param theFiles
 * @return
 * @throws BindException
 * @throws IOException
 */
private static Configuration getTestDriverConfiguration(final Set<File> theFiles) throws BindException, IOException {
  ConfigurationModule testDriverConfigurationModule = FileResourceTestDriverConfiguration.CONF;
  for (final File f : theFiles) {
    LOG.log(Level.FINEST, "Adding a file to the TestDriverConfiguration: " + f.getName());
    testDriverConfigurationModule =
        testDriverConfigurationModule.set(FileResourceTestDriverConfiguration.EXPECTED_FILE_NAME, f.getName());
  }

  final Configuration testDriverConfiguration = testDriverConfigurationModule.build();
  return testDriverConfiguration;
}
 
开发者ID:apache,项目名称:reef,代码行数:20,代码来源:FileResourceTest.java

示例7: addNamesTo

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
/**
 * Adds the file names of this FileSet to the given field of the given ConfigurationModule.
 *
 * @param input the ConfigurationModule to fill out
 * @param field the field to add the files in this set to.
 * @return the filled out ConfigurationModule
 */
ConfigurationModule addNamesTo(final ConfigurationModule input, final OptionalParameter<String> field) {
  ConfigurationModule result = input;
  for (final String fileName : this.fileNames()) {
    result = result.set(field, fileName);
  }
  return result;
}
 
开发者ID:apache,项目名称:reef,代码行数:15,代码来源:FileSet.java

示例8: getDriverConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
private Configuration getDriverConfiguration(final URI jobFolder,
                                             final String clientRemoteId,
                                             final String jobId) {
  ConfigurationModule configModule = LocalDriverConfiguration.CONF
      .set(LocalDriverConfiguration.MAX_NUMBER_OF_EVALUATORS, this.maxEvaluators)
      .set(LocalDriverConfiguration.ROOT_FOLDER, jobFolder.getPath())
      .set(LocalDriverConfiguration.JVM_HEAP_SLACK, this.jvmHeapSlack)
      .set(LocalDriverConfiguration.CLIENT_REMOTE_IDENTIFIER, clientRemoteId)
      .set(LocalDriverConfiguration.JOB_IDENTIFIER, jobId)
      .set(LocalDriverConfiguration.RUNTIME_NAMES, RuntimeIdentifier.RUNTIME_NAME);
  for (final String rackName : rackNames) {
    configModule = configModule.set(LocalDriverConfiguration.RACK_NAMES, rackName);
  }
  return configModule.build();
}
 
开发者ID:apache,项目名称:reef,代码行数:16,代码来源:LocalDriverConfigurationProviderImpl.java

示例9: addNamesTo

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
/**
 * Fills out a ConfigurationModule.
 *
 * @param input           The ConfigurationModule to start with.
 * @param globalFileField the field on which to set() the global files.
 * @param globalLibField  the field on which to set() the global libraries.
 * @param localFileField  the field on which to set() the local files.
 * @param localLibField   the field on which to set() the local libraries.
 * @return a copy of input with files and libraries added to the given fields.
 */
public ConfigurationModule addNamesTo(final ConfigurationModule input,
                                      final OptionalParameter<String> globalFileField,
                                      final OptionalParameter<String> globalLibField,
                                      final OptionalParameter<String> localFileField,
                                      final OptionalParameter<String> localLibField) {
  ConfigurationModule result = input;
  result = this.globalFiles.addNamesTo(result, globalFileField);
  result = this.globalLibs.addNamesTo(result, globalLibField);
  result = this.localFiles.addNamesTo(result, localFileField);
  result = this.localLibs.addNamesTo(result, localLibField);
  return result;
}
 
开发者ID:apache,项目名称:reef,代码行数:23,代码来源:DriverFiles.java

示例10: addAll

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
private static ConfigurationModule addAll(final ConfigurationModule conf,
                                          final OptionalParameter<String> param,
                                          final File folder) {
  ConfigurationModule result = conf;
  final File[] files = folder.listFiles();
  if (files != null) {
    for (final File f : files) {
      if (f.canRead() && f.exists() && f.isFile()) {
        result = result.set(param, f.getAbsolutePath());
      }
    }
  }
  return result;
}
 
开发者ID:apache,项目名称:reef,代码行数:15,代码来源:HelloCLR.java

示例11: runHelloCLR

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
public static LauncherStatus runHelloCLR(final Configuration runtimeConf, final int timeOut, final File clrFolder)
    throws BindException, InjectionException {

  final ConfigurationModule driverConf =
      addAll(DriverConfiguration.CONF, DriverConfiguration.GLOBAL_FILES, clrFolder)
          .set(DriverConfiguration.GLOBAL_LIBRARIES, EnvironmentUtils.getClassLocation(HelloDriver.class))
          .set(DriverConfiguration.DRIVER_IDENTIFIER, "HelloCLR")
          .set(DriverConfiguration.ON_DRIVER_STARTED, HelloDriver.StartHandler.class)
          .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, HelloDriver.EvaluatorAllocatedHandler.class);

  return DriverLauncher.getLauncher(runtimeConf).run(driverConf.build(), timeOut);
}
 
开发者ID:apache,项目名称:reef,代码行数:13,代码来源:HelloCLR.java

示例12: setDriverConfigurationModule

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
public DataLoadingRequestBuilder setDriverConfigurationModule(
    final ConfigurationModule driverConfigurationModule) {
  this.driverConfigurationModule = driverConfigurationModule;
  return this;
}
 
开发者ID:apache,项目名称:reef,代码行数:6,代码来源:DataLoadingRequestBuilder.java

示例13: onNext

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
@Override
public void onNext(final AllocatedEvaluator eval) {

  try {

    taskId = failTaskName + "_" + eval.getId();
    LOG.log(Level.INFO, "Submit task: {0}", taskId);

    final Configuration contextConfig =
        ContextConfiguration.CONF.set(ContextConfiguration.IDENTIFIER, taskId).build();

    ConfigurationModule taskConfig =
        TaskConfiguration.CONF.set(TaskConfiguration.IDENTIFIER, taskId);

    switch (failTaskName) {
    case "FailTask":
      taskConfig = taskConfig.set(TaskConfiguration.TASK, FailTask.class);
      break;
    case "FailTaskCall":
      taskConfig = taskConfig.set(TaskConfiguration.TASK, FailTaskCall.class);
      break;
    case "FailTaskMsg":
      taskConfig = taskConfig
            .set(TaskConfiguration.TASK, FailTaskMsg.class)
            .set(TaskConfiguration.ON_MESSAGE, FailTaskMsg.class);
      break;
    case "FailTaskSuspend":
      taskConfig = taskConfig
            .set(TaskConfiguration.TASK, FailTaskSuspend.class)
            .set(TaskConfiguration.ON_SUSPEND, FailTaskSuspend.class);
      break;
    case "FailTaskStart":
      taskConfig = taskConfig
            .set(TaskConfiguration.TASK, FailTaskStart.class)
            .set(TaskConfiguration.ON_TASK_STARTED, FailTaskStart.class);
      break;
    case "FailTaskStop":
      taskConfig = taskConfig
            .set(TaskConfiguration.TASK, FailTaskStop.class)
            .set(TaskConfiguration.ON_TASK_STOP, FailTaskStop.class)
            .set(TaskConfiguration.ON_CLOSE, FailTaskStop.CloseEventHandler.class);
      break;
    case "FailTaskClose":
      taskConfig = taskConfig
            .set(TaskConfiguration.TASK, FailTaskClose.class)
            .set(TaskConfiguration.ON_CLOSE, FailTaskClose.class);
      break;
    default:
      break;
    }

    eval.submitContextAndTask(contextConfig, taskConfig.build());

  } catch (final BindException ex) {
    LOG.log(Level.WARNING, "Configuration error", ex);
    throw new DriverSideFailure("Configuration error", ex);
  }
}
 
开发者ID:apache,项目名称:reef,代码行数:59,代码来源:Driver.java

示例14: makeEvaluatorConfiguration

import org.apache.reef.tang.formats.ConfigurationModule; //导入依赖的package包/类
/**
 * Make configuration for Evaluator.
 * @param contextConfiguration
 * @param evaluatorConfiguration
 * @param serviceConfiguration
 * @param taskConfiguration
 * @return Configuration
 */
private Configuration makeEvaluatorConfiguration(final String contextConfiguration,
                                                 final Optional<String> evaluatorConfiguration,
                                                 final Optional<String> serviceConfiguration,
                                                 final Optional<String> taskConfiguration) {

  final ConfigurationModule evaluatorConfigModule;
  if (this.evaluatorManager.getEvaluatorDescriptor().getProcess() instanceof CLRProcess) {
    evaluatorConfigModule = EvaluatorConfiguration.CONFCLR;
  } else {
    evaluatorConfigModule = EvaluatorConfiguration.CONF;
  }
  ConfigurationModule evaluatorConfigurationModule = evaluatorConfigModule
      .set(EvaluatorConfiguration.APPLICATION_IDENTIFIER, this.jobIdentifier)
      .set(EvaluatorConfiguration.DRIVER_REMOTE_IDENTIFIER, this.remoteID)
      .set(EvaluatorConfiguration.EVALUATOR_IDENTIFIER, this.getId())
      .set(EvaluatorConfiguration.ROOT_CONTEXT_CONFIGURATION, contextConfiguration);

  // Add the (optional) service configuration
  if (evaluatorConfiguration.isPresent()) {
    evaluatorConfigurationModule = evaluatorConfigurationModule
        .set(EvaluatorConfiguration.EVALUATOR_CONFIGURATION, evaluatorConfiguration.get());
  }

  // Add the (optional) service configuration
  if (serviceConfiguration.isPresent()) {
    evaluatorConfigurationModule = evaluatorConfigurationModule
        .set(EvaluatorConfiguration.ROOT_SERVICE_CONFIGURATION, serviceConfiguration.get());
  } else {
    evaluatorConfigurationModule = evaluatorConfigurationModule
        .set(EvaluatorConfiguration.ROOT_SERVICE_CONFIGURATION,
            this.configurationSerializer.toString(Tang.Factory.getTang().newConfigurationBuilder().build()));
  }

  // Add the (optional) task configuration
  if (taskConfiguration.isPresent()) {
    evaluatorConfigurationModule = evaluatorConfigurationModule
        .set(EvaluatorConfiguration.TASK_CONFIGURATION, taskConfiguration.get());
  }

  // Create the evaluator configuration.
  return evaluatorConfigurationModule.build();
}
 
开发者ID:apache,项目名称:reef,代码行数:51,代码来源:AllocatedEvaluatorImpl.java


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