Search in sources :

Example 1 with ProcessPythonEnvironment

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.");
}
Also used : ProcessPythonEnvironment(org.apache.flink.python.env.process.ProcessPythonEnvironment) PythonEnvironment(org.apache.flink.python.env.PythonEnvironment) ProcessPythonEnvironment(org.apache.flink.python.env.process.ProcessPythonEnvironment)

Aggregations

PythonEnvironment (org.apache.flink.python.env.PythonEnvironment)1 ProcessPythonEnvironment (org.apache.flink.python.env.process.ProcessPythonEnvironment)1