Java Code Examples for org.apache.flink.runtime.clusterframework.BootstrapTools#writeConfiguration()

The following examples show how to use org.apache.flink.runtime.clusterframework.BootstrapTools#writeConfiguration() . 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: YarnEntrypointUtilsTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static Configuration loadConfiguration(Configuration initialConfiguration) throws IOException {
	final File workingDirectory = TEMPORARY_FOLDER.newFolder();
	final Map<String, String> env = new HashMap<>(4);
	env.put(ApplicationConstants.Environment.NM_HOST.key(), "foobar");

	BootstrapTools.writeConfiguration(initialConfiguration, new File(workingDirectory, "flink-conf.yaml"));
	return YarnEntrypointUtils.loadConfiguration(workingDirectory.getAbsolutePath(), env, LOG);
}
 
Example 2
Source File: YarnEntrypointUtilsTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static Configuration loadConfiguration(Configuration initialConfiguration) throws IOException {
	final File workingDirectory = TEMPORARY_FOLDER.newFolder();
	final Map<String, String> env = new HashMap<>(4);
	env.put(ApplicationConstants.Environment.NM_HOST.key(), "foobar");

	BootstrapTools.writeConfiguration(initialConfiguration, new File(workingDirectory, "flink-conf.yaml"));
	return YarnEntrypointUtils.loadConfiguration(workingDirectory.getAbsolutePath(), env, LOG);
}
 
Example 3
Source File: TaskManagerLoadingDynamicPropertiesITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testLoadingDynamicPropertiesInBash() throws Exception {
	final Configuration clientConfiguration = new Configuration();
	final File root = folder.getRoot();
	final File homeDir = new File(root, "home");
	assertTrue(homeDir.mkdir());
	BootstrapTools.writeConfiguration(clientConfiguration, new File(homeDir, FLINK_CONF_FILENAME));

	final Configuration jmUpdatedConfiguration = getJobManagerUpdatedConfiguration();

	final File shellScriptFile = generateLaunchContainerScript(
		homeDir,
		BootstrapTools.getDynamicPropertiesAsString(clientConfiguration, jmUpdatedConfiguration));

	Process process = new ProcessBuilder(shellScriptFile.getAbsolutePath()).start();
	try {
		final StringWriter processOutput = new StringWriter();
		new CommonTestUtils.PipeForwarder(process.getErrorStream(), processOutput);

		if (!process.waitFor(10, TimeUnit.SECONDS)) {
			throw new Exception("TestingTaskManagerRunner did not shutdown in time.");
		}
		assertEquals(processOutput.toString(), 0, process.exitValue());
	} finally {
		process.destroy();
	}
}
 
Example 4
Source File: YarnResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws IOException {
	testingFatalErrorHandler = new TestingFatalErrorHandler();

	flinkConfig = new Configuration();
	flinkConfig.set(TaskManagerOptions.TOTAL_FLINK_MEMORY, MemorySize.parse("1g"));

	File root = folder.getRoot();
	File home = new File(root, "home");
	boolean created = home.mkdir();
	assertTrue(created);

	env = new HashMap<>();
	env.put(ENV_APP_ID, "foo");
	env.put(ENV_CLIENT_HOME_DIR, home.getAbsolutePath());
	env.put(ENV_CLIENT_SHIP_FILES, "");
	env.put(ENV_FLINK_CLASSPATH, "");
	env.put(ENV_HADOOP_USER_NAME, "foo");
	env.put(FLINK_DIST_JAR, new YarnLocalResourceDescriptor(
		"flink.jar",
		new Path("/tmp/flink.jar"),
		0,
		System.currentTimeMillis(),
		LocalResourceVisibility.APPLICATION).toString());
	env.put(ApplicationConstants.Environment.PWD.key(), home.getAbsolutePath());

	BootstrapTools.writeConfiguration(flinkConfig, new File(home.getAbsolutePath(), FLINK_CONF_FILENAME));
}
 
Example 5
Source File: YarnEntrypointUtilsTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static Configuration loadConfiguration(Configuration initialConfiguration, Map<String, String> env) throws IOException {
	final File workingDirectory = TEMPORARY_FOLDER.newFolder();
	env.put(ApplicationConstants.Environment.NM_HOST.key(), "foobar");
	BootstrapTools.writeConfiguration(initialConfiguration, new File(workingDirectory, "flink-conf.yaml"));
	return YarnEntrypointUtils.loadConfiguration(workingDirectory.getAbsolutePath(), env);
}
 
Example 6
Source File: KubernetesTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
protected void writeFlinkConfiguration() throws IOException {
	BootstrapTools.writeConfiguration(this.flinkConfig, new File(flinkConfDir, "flink-conf.yaml"));
}