本文整理了Java中org.apache.flink.configuration.Configuration.setBoolean()
方法的一些代码示例,展示了Configuration.setBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setBoolean()
方法的具体详情如下:
包路径:org.apache.flink.configuration.Configuration
类名称:Configuration
方法名:setBoolean
[英]Adds the given key/value pair to the configuration object.
[中]将给定的键/值对添加到配置对象。
代码示例来源:origin: apache/flink
@Override
public void setBoolean(String key, boolean value) {
this.backingConfig.setBoolean(this.prefix + key, value);
}
代码示例来源:origin: apache/flink
public void setChainEnd() {
config.setBoolean(CHAIN_END, true);
}
代码示例来源:origin: apache/flink
public void setCheckpointingEnabled(boolean enabled) {
config.setBoolean(CHECKPOINTING_ENABLED, enabled);
}
代码示例来源:origin: apache/flink
/**
* Sets a stub parameters in the configuration of this contract. The stub parameters are accessible by the user
* code at runtime. Parameters that the user code needs to access at runtime to configure its behavior are
* typically stored as stub parameters.
*
* @see #getParameters()
* @param key
* The parameter key.
* @param value
* The parameter value.
*/
public void setParameter(String key, boolean value) {
this.parameters.setBoolean(key, value);
}
代码示例来源:origin: apache/flink
public void setChainStart() {
config.setBoolean(IS_CHAINED_VERTEX, true);
}
代码示例来源:origin: apache/flink
@Override
public void setBoolean(ConfigOption<Boolean> key, boolean value) {
this.backingConfig.setBoolean(prefix + key.key(), value);
}
代码示例来源:origin: apache/flink
public static void writeFileInfoToConfig(String name, DistributedCacheEntry e, Configuration conf) {
int num = conf.getInteger(CACHE_FILE_NUM, 0) + 1;
conf.setInteger(CACHE_FILE_NUM, num);
conf.setString(CACHE_FILE_NAME + num, name);
conf.setString(CACHE_FILE_PATH + num, e.filePath);
conf.setBoolean(CACHE_FILE_EXE + num, e.isExecutable || new File(e.filePath).canExecute());
conf.setBoolean(CACHE_FILE_DIR + num, e.isZipped || new File(e.filePath).isDirectory());
if (e.blobKey != null) {
conf.setBytes(CACHE_FILE_BLOB_KEY + num, e.blobKey);
}
}
代码示例来源:origin: apache/flink
@Override
protected Configuration createClusterConfig() throws IOException {
Configuration config = super.createClusterConfig();
config.setBoolean(
CheckpointingOptions.LOCAL_RECOVERY,
localRecoveryEnabled);
return config;
}
};
代码示例来源:origin: apache/flink
private Configuration createConfiguration() {
Configuration newConfiguration = new Configuration();
newConfiguration.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, getTaskManagerNumSlots());
newConfiguration.setBoolean(CoreOptions.FILESYTEM_DEFAULT_OVERRIDE, isDefaultOverwriteFiles());
newConfiguration.addAll(baseConfiguration);
return newConfiguration;
}
代码示例来源:origin: apache/flink
private static Configuration getClusterConfiguration() {
Configuration config = new Configuration();
try {
File logDir = File.createTempFile("TestBaseUtils-logdir", null);
assertTrue("Unable to delete temp file", logDir.delete());
assertTrue("Unable to create temp directory", logDir.mkdir());
File logFile = new File(logDir, "jobmanager.log");
File outFile = new File(logDir, "jobmanager.out");
Files.createFile(logFile.toPath());
Files.createFile(outFile.toPath());
config.setString(WebOptions.LOG_PATH, logFile.getAbsolutePath());
config.setString(ConfigConstants.TASK_MANAGER_LOG_PATH_KEY, logFile.getAbsolutePath());
} catch (Exception e) {
throw new AssertionError("Could not setup test.", e);
}
config.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "12m");
config.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
return config;
}
代码示例来源:origin: apache/flink
private static Configuration getConfiguration() {
Configuration configuration = new Configuration();
configuration.setBoolean(SYSTEM_RESOURCE_METRICS, true);
configuration.setString(REPORTERS_LIST, "test_reporter");
configuration.setString("metrics.reporter.test_reporter.class", TestReporter.class.getName());
return configuration;
}
代码示例来源:origin: apache/flink
/**
* Tests that if local recovery is disabled we won't spread
* out tasks when recovering.
*/
@Test
public void testDisablingLocalRecovery() throws Exception {
final Configuration configuration = new Configuration();
configuration.setBoolean(CheckpointingOptions.LOCAL_RECOVERY, false);
executeSchedulingTest(configuration);
}
代码示例来源:origin: apache/flink
/**
* Creates a {@link LocalStreamEnvironment} for local program execution that also starts the
* web monitoring UI.
*
* <p>The local execution environment will run the program in a multi-threaded fashion in
* the same JVM as the environment was created in. It will use the parallelism specified in the
* parameter.
*
* <p>If the configuration key 'rest.port' was set in the configuration, that particular
* port will be used for the web UI. Otherwise, the default port (8081) will be used.
*/
@PublicEvolving
public static StreamExecutionEnvironment createLocalEnvironmentWithWebUI(Configuration conf) {
checkNotNull(conf, "conf");
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
if (!conf.contains(RestOptions.PORT)) {
// explicitly set this option so that it's not set to 0 later
conf.setInteger(RestOptions.PORT, RestOptions.PORT.defaultValue());
}
return createLocalEnvironment(defaultLocalParallelism, conf);
}
代码示例来源:origin: apache/flink
/**
* Creates a {@link LocalEnvironment} for local program execution that also starts the
* web monitoring UI.
*
* <p>The local execution environment will run the program in a multi-threaded fashion in
* the same JVM as the environment was created in. It will use the parallelism specified in the
* parameter.
*
* <p>If the configuration key 'rest.port' was set in the configuration, that particular
* port will be used for the web UI. Otherwise, the default port (8081) will be used.
*/
@PublicEvolving
public static ExecutionEnvironment createLocalEnvironmentWithWebUI(Configuration conf) {
checkNotNull(conf, "conf");
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
if (!conf.contains(RestOptions.PORT)) {
// explicitly set this option so that it's not set to 0 later
conf.setInteger(RestOptions.PORT, RestOptions.PORT.defaultValue());
}
return createLocalEnvironment(conf, -1);
}
代码示例来源:origin: apache/flink
private void testLocalRecoveryInternal(String failoverStrategyValue) throws Exception {
final Configuration configuration = new Configuration();
configuration.setBoolean(CheckpointingOptions.LOCAL_RECOVERY, true);
configuration.setString(EXECUTION_FAILOVER_STRATEGY.key(), failoverStrategyValue);
executeSchedulingTest(configuration);
}
代码示例来源:origin: apache/flink
/**
* Test with one nested directory and recursive.file.enumeration = true
*/
@Test
public void testOneNestedDirectoryTrue() {
try {
String firstLevelDir = TestFileUtils.randomFileName();
String secondLevelDir = TestFileUtils.randomFileName();
File insideNestedDir = tempFolder.newFolder(firstLevelDir, secondLevelDir);
File nestedDir = insideNestedDir.getParentFile();
// create a file in the first-level and two files in the nested dir
TestFileUtils.createTempFileInDirectory(nestedDir.getAbsolutePath(), "paella");
TestFileUtils.createTempFileInDirectory(insideNestedDir.getAbsolutePath(), "kalamari");
TestFileUtils.createTempFileInDirectory(insideNestedDir.getAbsolutePath(), "fideua");
this.format.setFilePath(new Path(nestedDir.toURI().toString()));
this.config.setBoolean("recursive.file.enumeration", true);
format.configure(this.config);
FileInputSplit[] splits = format.createInputSplits(1);
Assert.assertEquals(3, splits.length);
} catch (Exception ex) {
ex.printStackTrace();
Assert.fail(ex.getMessage());
}
}
代码示例来源:origin: apache/flink
/**
* Test without nested directory and recursive.file.enumeration = true
*/
@Test
public void testNoNestedDirectoryTrue() {
try {
String filePath = TestFileUtils.createTempFile("foo");
this.format.setFilePath(new Path(filePath));
this.config.setBoolean("recursive.file.enumeration", true);
format.configure(this.config);
FileInputSplit[] splits = format.createInputSplits(1);
Assert.assertEquals(1, splits.length);
} catch (Exception ex) {
ex.printStackTrace();
Assert.fail(ex.getMessage());
}
}
代码示例来源:origin: apache/flink
private static Configuration getConfig() {
Configuration config = new Configuration();
config.setBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER, true);
config.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "4m");
config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, NUM_TMS);
config.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, NUM_SLOTS_PER_TM);
config.setInteger(QueryableStateOptions.CLIENT_NETWORK_THREADS, 1);
config.setInteger(QueryableStateOptions.PROXY_NETWORK_THREADS, 1);
config.setInteger(QueryableStateOptions.SERVER_NETWORK_THREADS, 1);
config.setString(
QueryableStateOptions.PROXY_PORT_RANGE,
QS_PROXY_PORT_RANGE_START + "-" + (QS_PROXY_PORT_RANGE_START + NUM_TMS));
config.setString(
QueryableStateOptions.SERVER_PORT_RANGE,
QS_SERVER_PORT_RANGE_START + "-" + (QS_SERVER_PORT_RANGE_START + NUM_TMS));
config.setBoolean(WebOptions.SUBMIT_ENABLE, false);
return config;
}
代码示例来源:origin: apache/flink
private static Configuration getConfiguration() {
verifyJvmOptions();
Configuration config = new Configuration();
config.setBoolean(CoreOptions.FILESYTEM_DEFAULT_OVERRIDE, true);
config.setString(AkkaOptions.ASK_TIMEOUT, TestingUtils.DEFAULT_AKKA_ASK_TIMEOUT());
config.setString(TaskManagerOptions.MEMORY_SEGMENT_SIZE, "4096");
config.setInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS, 2048);
return config;
}
代码示例来源:origin: apache/flink
private static Configuration getConfig() {
Configuration config = new Configuration();
config.setBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER, true);
config.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "4m");
config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, NUM_TMS);
config.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, NUM_SLOTS_PER_TM);
config.setInteger(QueryableStateOptions.CLIENT_NETWORK_THREADS, 1);
config.setInteger(QueryableStateOptions.PROXY_NETWORK_THREADS, 1);
config.setInteger(QueryableStateOptions.SERVER_NETWORK_THREADS, 1);
config.setString(
QueryableStateOptions.PROXY_PORT_RANGE,
QS_PROXY_PORT_RANGE_START + "-" + (QS_PROXY_PORT_RANGE_START + NUM_PORT_COUNT));
config.setString(
QueryableStateOptions.SERVER_PORT_RANGE,
QS_SERVER_PORT_RANGE_START + "-" + (QS_SERVER_PORT_RANGE_START + NUM_PORT_COUNT));
config.setBoolean(WebOptions.SUBMIT_ENABLE, false);
return config;
}
}
内容来源于网络,如有侵权,请联系作者删除!