Search in sources :

Example 1 with ProcessPythonEnvironmentManager

use of org.apache.flink.python.env.process.ProcessPythonEnvironmentManager in project flink by apache.

the class PythonTestUtils method createTestProcessEnvironmentManager.

public static ProcessPythonEnvironmentManager createTestProcessEnvironmentManager() {
    Map<String, String> env = new HashMap<>();
    env.put(PythonEnvironmentManagerUtils.PYFLINK_UDF_RUNNER_DIR, "");
    return new ProcessPythonEnvironmentManager(new PythonDependencyInfo(new HashMap<>(), null, null, new HashMap<>(), "python"), new String[] { System.getProperty("java.io.tmpdir") }, env, new JobID());
}
Also used : ProcessPythonEnvironmentManager(org.apache.flink.python.env.process.ProcessPythonEnvironmentManager) PythonDependencyInfo(org.apache.flink.python.env.PythonDependencyInfo) HashMap(java.util.HashMap) JobID(org.apache.flink.api.common.JobID)

Example 2 with ProcessPythonEnvironmentManager

use of org.apache.flink.python.env.process.ProcessPythonEnvironmentManager in project flink by apache.

the class AbstractExternalPythonFunctionOperator method createPythonEnvironmentManager.

@Override
protected ProcessPythonEnvironmentManager createPythonEnvironmentManager() {
    PythonDependencyInfo dependencyInfo = PythonDependencyInfo.create(pythonConfig, getRuntimeContext().getDistributedCache());
    PythonEnv pythonEnv = getPythonEnv();
    if (pythonEnv.getExecType() == PythonEnv.ExecType.PROCESS) {
        return new ProcessPythonEnvironmentManager(dependencyInfo, getContainingTask().getEnvironment().getTaskManagerInfo().getTmpDirectories(), new HashMap<>(System.getenv()), getRuntimeContext().getJobId());
    } else {
        throw new UnsupportedOperationException(String.format("Execution type '%s' is not supported.", pythonEnv.getExecType()));
    }
}
Also used : PythonDependencyInfo(org.apache.flink.python.env.PythonDependencyInfo) ProcessPythonEnvironmentManager(org.apache.flink.python.env.process.ProcessPythonEnvironmentManager) PythonEnv(org.apache.flink.table.functions.python.PythonEnv)

Aggregations

PythonDependencyInfo (org.apache.flink.python.env.PythonDependencyInfo)2 ProcessPythonEnvironmentManager (org.apache.flink.python.env.process.ProcessPythonEnvironmentManager)2 HashMap (java.util.HashMap)1 JobID (org.apache.flink.api.common.JobID)1 PythonEnv (org.apache.flink.table.functions.python.PythonEnv)1