本文整理了Java中org.apache.flink.configuration.Configuration.getString()
方法的一些代码示例,展示了Configuration.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getString()
方法的具体详情如下:
包路径:org.apache.flink.configuration.Configuration
类名称:Configuration
方法名:getString
[英]Returns the value associated with the given key as a string.
[中]以字符串形式返回与给定键关联的值。
代码示例来源:origin: apache/flink
@Override
public String getString(String key, String defaultValue) {
return this.backingConfig.getString(this.prefix + key, defaultValue);
}
代码示例来源:origin: apache/flink
public String getAllowOrigin() {
return config.getString(WebOptions.ACCESS_CONTROL_ALLOW_ORIGIN);
}
}
代码示例来源:origin: apache/flink
public String getIterationId() {
return config.getString(ITERATION_ID, "");
}
代码示例来源:origin: apache/flink
PythonStreamBinder(Configuration globalConfig) {
String configuredLocalTmpPath = globalConfig.getString(PythonOptions.PLAN_TMP_DIR);
this.localTmpPath = configuredLocalTmpPath != null
? configuredLocalTmpPath
: System.getProperty("java.io.tmpdir") + File.separator + "flink_streaming_plan_" + UUID.randomUUID();
this.tmpDistributedDir = new Path(globalConfig.getString(PythonOptions.DC_TMP_DIR));
}
代码示例来源:origin: apache/flink
/**
* Extracts the local state directories as defined by
* {@link CheckpointingOptions#LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS}.
*
* @param configuration configuration object
* @return array of configured directories (in order)
*/
@Nonnull
public static String[] parseLocalStateDirectories(Configuration configuration) {
String configValue = configuration.getString(CheckpointingOptions.LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS, "");
return splitPaths(configValue);
}
代码示例来源:origin: apache/flink
@Override
public String getClusterDescription() {
String host = config.getString(JobManagerOptions.ADDRESS, "");
int port = config.getInteger(JobManagerOptions.PORT, -1);
return "Standalone cluster at " + host + ":" + port;
}
代码示例来源:origin: apache/flink
/**
* Extracts the task manager directories for temporary files as defined by
* {@link org.apache.flink.configuration.CoreOptions#TMP_DIRS}.
*
* @param configuration configuration object
* @return array of configured directories (in order)
*/
@Nonnull
public static String[] parseTempDirectories(Configuration configuration) {
return splitPaths(configuration.getString(CoreOptions.TMP_DIRS));
}
代码示例来源:origin: apache/flink
@Override
public String getString(ConfigOption<String> configOption) {
return this.backingConfig.getString(prefixOption(configOption, prefix));
}
代码示例来源:origin: apache/flink
@Override
public String getString(ConfigOption<String> configOption, String overrideDefault) {
return this.backingConfig.getString(prefixOption(configOption, prefix), overrideDefault);
}
代码示例来源:origin: apache/flink
private org.apache.hadoop.conf.Configuration loadHadoopConfigFromFlink() {
org.apache.hadoop.conf.Configuration hadoopConfig = new org.apache.hadoop.conf.Configuration();
for (String key : flinkConfig.keySet()) {
for (String prefix : flinkConfigPrefixes) {
if (key.startsWith(prefix)) {
String newKey = hadoopConfigPrefix + key.substring(prefix.length());
String newValue = fixHadoopConfig(key, flinkConfig.getString(key, null));
hadoopConfig.set(newKey, newValue);
LOG.debug("Adding Flink config entry for {} as {} to Hadoop config", key, newKey);
}
}
}
return hadoopConfig;
}
代码示例来源:origin: apache/flink
private File getUploadDir(Configuration configuration) {
File baseDir = new File(configuration.getString(WebOptions.UPLOAD_DIR,
getBaseDirStr(configuration)));
boolean uploadDirSpecified = configuration.contains(WebOptions.UPLOAD_DIR);
return uploadDirSpecified ? baseDir : new File(baseDir, "flink-web-" + UUID.randomUUID());
}
代码示例来源:origin: apache/flink
public PythonPlanBinder(Configuration globalConfig) {
String configuredPlanTmpPath = globalConfig.getString(PythonOptions.PLAN_TMP_DIR);
tmpPlanFilesDir = configuredPlanTmpPath != null
? configuredPlanTmpPath
: System.getProperty("java.io.tmpdir") + File.separator + "flink_plan_" + UUID.randomUUID();
operatorConfig = new Configuration();
operatorConfig.setString(PythonOptions.PYTHON_BINARY_PATH, globalConfig.getString(PythonOptions.PYTHON_BINARY_PATH));
String configuredTmpDataDir = globalConfig.getString(PythonOptions.DATA_TMP_DIR);
if (configuredTmpDataDir != null) {
operatorConfig.setString(PythonOptions.DATA_TMP_DIR, configuredTmpDataDir);
}
operatorConfig.setLong(PythonOptions.MMAP_FILE_SIZE, globalConfig.getLong(PythonOptions.MMAP_FILE_SIZE));
}
代码示例来源:origin: apache/flink
private static YarnConfigOptions.UserJarInclusion getUserJarInclusionMode(org.apache.flink.configuration.Configuration config) {
String configuredUserJarInclusion = config.getString(YarnConfigOptions.CLASSPATH_INCLUDE_USER_JAR);
try {
return YarnConfigOptions.UserJarInclusion.valueOf(configuredUserJarInclusion.toUpperCase());
} catch (IllegalArgumentException e) {
LOG.warn("Configuration parameter {} was configured with an invalid value {}. Falling back to default ({}).",
YarnConfigOptions.CLASSPATH_INCLUDE_USER_JAR.key(),
configuredUserJarInclusion,
YarnConfigOptions.CLASSPATH_INCLUDE_USER_JAR.defaultValue());
return YarnConfigOptions.UserJarInclusion.valueOf(YarnConfigOptions.CLASSPATH_INCLUDE_USER_JAR.defaultValue());
}
}
代码示例来源:origin: apache/flink
@Override
public void configure(Configuration parameters) {
super.configure(parameters);
Assert.assertNotNull(parameters.getString("prepend", null));
Assert.assertEquals("test", parameters.getString("prepend", null));
}
代码示例来源:origin: apache/flink
@Override
protected void initializeServices(Configuration config) throws Exception {
super.initializeServices(config);
final String hostname = config.getString(JobManagerOptions.ADDRESS);
// Mesos configuration
mesosConfig = MesosEntrypointUtils.createMesosSchedulerConfiguration(config, hostname);
// services
mesosServices = MesosServicesUtils.createMesosServices(config, hostname);
// TM configuration
taskManagerParameters = MesosEntrypointUtils.createTmParameters(config, LOG);
taskManagerContainerSpec = MesosEntrypointUtils.createContainerSpec(config, dynamicProperties);
}
代码示例来源:origin: apache/flink
@Override
protected void initializeServices(Configuration config) throws Exception {
super.initializeServices(config);
final String hostname = config.getString(JobManagerOptions.ADDRESS);
// Mesos configuration
schedulerConfiguration = MesosEntrypointUtils.createMesosSchedulerConfiguration(config, hostname);
// services
mesosServices = MesosServicesUtils.createMesosServices(config, hostname);
// TM configuration
taskManagerParameters = MesosEntrypointUtils.createTmParameters(config, LOG);
taskManagerContainerSpec = MesosEntrypointUtils.createContainerSpec(config, dynamicProperties);
}
代码示例来源:origin: apache/flink
@Test
public void testBindAddressFirstDeprecatedKey() {
final Configuration configuration = new Configuration();
final String expectedAddress = "foobar";
configuration.setString("web.address", expectedAddress);
final String actualAddress = configuration.getString(RestOptions.BIND_ADDRESS);
assertThat(actualAddress, is(equalTo(expectedAddress)));
}
代码示例来源:origin: apache/flink
@Test
public void testBindAddressSecondDeprecatedKey() {
final Configuration configuration = new Configuration();
final String expectedAddress = "foobar";
configuration.setString("jobmanager.web.address", expectedAddress);
final String actualAddress = configuration.getString(RestOptions.BIND_ADDRESS);
assertThat(actualAddress, is(equalTo(expectedAddress)));
}
}
代码示例来源:origin: apache/flink
public static void checkJobManagerAddress(Configuration config, String expectedAddress, int expectedPort) {
String jobManagerAddress = config.getString(JobManagerOptions.ADDRESS);
int jobManagerPort = config.getInteger(JobManagerOptions.PORT, -1);
assertEquals(expectedAddress, jobManagerAddress);
assertEquals(expectedPort, jobManagerPort);
}
代码示例来源:origin: apache/flink
@Test
public void getConfiguration() {
try {
String config = TestBaseUtils.getFromHTTP("http://localhost:" + getRestPort() + "/jobmanager/config");
Map<String, String> conf = WebMonitorUtils.fromKeyValueJsonArray(config);
assertEquals(
CLUSTER_CONFIGURATION.getString(ConfigConstants.LOCAL_START_WEBSERVER, null),
conf.get(ConfigConstants.LOCAL_START_WEBSERVER));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!