use of org.apache.flink.python.env.process.ProcessPythonEnvironment in project flink by apache.
the class BeamPythonFunctionRunner method createPythonExecutionEnvironment.
// ------------------------------------------------------------------------
// Python Execution Environment Management
// ------------------------------------------------------------------------
/**
* Creates a specification which specifies the portability Python execution environment. It's
* used by Beam's portability framework to creates the actual Python execution environment.
*/
private RunnerApi.Environment createPythonExecutionEnvironment(long memoryLimitBytes) throws Exception {
PythonEnvironment environment = environmentManager.createEnvironment();
if (environment instanceof ProcessPythonEnvironment) {
ProcessPythonEnvironment processEnvironment = (ProcessPythonEnvironment) environment;
Map<String, String> env = processEnvironment.getEnv();
env.putAll(jobOptions);
env.put(PYTHON_WORKER_MEMORY_LIMIT, String.valueOf(memoryLimitBytes));
return Environments.createProcessEnvironment("", "", processEnvironment.getCommand(), env);
}
throw new RuntimeException("Currently only ProcessPythonEnvironment is supported.");
}
Aggregations