Java Code Examples for org.apache.flink.configuration.ConfigurationUtils#parseTmResourceDynamicConfigs()

The following examples show how to use org.apache.flink.configuration.ConfigurationUtils#parseTmResourceDynamicConfigs() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BashJavaUtilsITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetTmResourceParamsConfigs() throws Exception {
	int expectedResultLines = 2;
	String[] commands = {RUN_BASH_JAVA_UTILS_CMD_SCRIPT, BashJavaUtils.Command.GET_TM_RESOURCE_PARAMS.toString(), String.valueOf(expectedResultLines)};
	List<String> lines = Arrays.asList(executeScript(commands).split(System.lineSeparator()));

	assertThat(lines.size(), is(expectedResultLines));
	ConfigurationUtils.parseJvmArgString(lines.get(0));
	ConfigurationUtils.parseTmResourceDynamicConfigs(lines.get(1));
}
 
Example 2
Source File: BashJavaUtilsITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetTmResourceParamsConfigsWithDynamicProperties() throws Exception {
	int expectedResultLines = 2;
	double cpuCores = 39.0;
	String[] commands = {
		RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
		BashJavaUtils.Command.GET_TM_RESOURCE_PARAMS.toString(),
		String.valueOf(expectedResultLines),
		"-D" + TaskManagerOptions.CPU_CORES.key() + "=" + cpuCores};
	List<String> lines = Arrays.asList(executeScript(commands).split(System.lineSeparator()));

	assertThat(lines.size(), is(expectedResultLines));
	Map<String, String> configs = ConfigurationUtils.parseTmResourceDynamicConfigs(lines.get(1));
	assertThat(Double.valueOf(configs.get(TaskManagerOptions.CPU_CORES.key())), is(cpuCores));
}
 
Example 3
Source File: TaskExecutorProcessUtilsTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenerateDynamicConfigurations() {
	String dynamicConfigsStr = TaskExecutorProcessUtils.generateDynamicConfigsStr(TM_RESOURCE_SPEC);
	Map<String, String> configs = ConfigurationUtils.parseTmResourceDynamicConfigs(dynamicConfigsStr);

	assertThat(new CPUResource(Double.valueOf(configs.get(TaskManagerOptions.CPU_CORES.key()))), is(TM_RESOURCE_SPEC.getCpuCores()));
	assertThat(MemorySize.parse(configs.get(TaskManagerOptions.FRAMEWORK_HEAP_MEMORY.key())), is(TM_RESOURCE_SPEC.getFrameworkHeapSize()));
	assertThat(MemorySize.parse(configs.get(TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY.key())), is(TM_RESOURCE_SPEC.getFrameworkOffHeapMemorySize()));
	assertThat(MemorySize.parse(configs.get(TaskManagerOptions.TASK_HEAP_MEMORY.key())), is(TM_RESOURCE_SPEC.getTaskHeapSize()));
	assertThat(MemorySize.parse(configs.get(TaskManagerOptions.TASK_OFF_HEAP_MEMORY.key())), is(TM_RESOURCE_SPEC.getTaskOffHeapSize()));
	assertThat(MemorySize.parse(configs.get(TaskManagerOptions.NETWORK_MEMORY_MAX.key())), is(TM_RESOURCE_SPEC.getNetworkMemSize()));
	assertThat(MemorySize.parse(configs.get(TaskManagerOptions.NETWORK_MEMORY_MIN.key())), is(TM_RESOURCE_SPEC.getNetworkMemSize()));
	assertThat(MemorySize.parse(configs.get(TaskManagerOptions.MANAGED_MEMORY_SIZE.key())), is(TM_RESOURCE_SPEC.getManagedMemorySize()));
}