本文整理汇总了Java中org.apache.reef.tang.formats.ConfigurationModule.set方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationModule.set方法的具体用法?Java ConfigurationModule.set怎么用?Java ConfigurationModule.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.reef.tang.formats.ConfigurationModule
的用法示例。
在下文中一共展示了ConfigurationModule.set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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());
}
示例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();
}
示例4: 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();
}
示例5: 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;
}
示例6: 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;
}
示例7: 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();
}
示例8: 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;
}
示例9: 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);
}
}
示例10: 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();
}