Package org.apache.flink.python.util
Class PythonEnvironmentManagerUtils
- java.lang.Object
-
- org.apache.flink.python.util.PythonEnvironmentManagerUtils
-
@Internal public class PythonEnvironmentManagerUtils extends Object
Utils used to prepare the python environment.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PYFLINK_UDF_RUNNER_DIR
-
Constructor Summary
Constructors Constructor Description PythonEnvironmentManagerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getPythonUdfRunnerScript(String pythonExecutable, Map<String,String> environmentVariables)
static String
getPythonVersion(String pythonExecutable)
static void
pipInstallRequirements(String requirementsFilePath, String requirementsCacheDir, String requirementsInstallDir, String pythonExecutable, Map<String,String> environmentVariables)
Installs the 3rd party libraries listed in the user-provided requirements file.
-
-
-
Field Detail
-
PYFLINK_UDF_RUNNER_DIR
@VisibleForTesting public static final String PYFLINK_UDF_RUNNER_DIR
- See Also:
- Constant Field Values
-
-
Method Detail
-
pipInstallRequirements
public static void pipInstallRequirements(String requirementsFilePath, @Nullable String requirementsCacheDir, String requirementsInstallDir, String pythonExecutable, Map<String,String> environmentVariables) throws IOException
Installs the 3rd party libraries listed in the user-provided requirements file. An optional requirements cached directory can be provided to support offline installation. In order not to populate the public environment, the libraries will be installed to the specified directory, and added to the PYTHONPATH of the UDF workers.- Parameters:
requirementsFilePath
- The path of the requirements file.requirementsCacheDir
- The path of the requirements cached directory.requirementsInstallDir
- The target directory of the installation.pythonExecutable
- The python interpreter used to launch the pip program.environmentVariables
- The environment variables used to launch the pip program.- Throws:
IOException
-
getPythonUdfRunnerScript
public static String getPythonUdfRunnerScript(String pythonExecutable, Map<String,String> environmentVariables) throws IOException
- Throws:
IOException
-
getPythonVersion
public static String getPythonVersion(String pythonExecutable) throws IOException
- Throws:
IOException
-
-