Package org.apache.flink.python.env
Class AbstractPythonEnvironmentManager
- java.lang.Object
-
- org.apache.flink.python.env.AbstractPythonEnvironmentManager
-
- All Implemented Interfaces:
AutoCloseable,PythonEnvironmentManager
- Direct Known Subclasses:
EmbeddedPythonEnvironmentManager,ProcessPythonEnvironmentManager
@Internal public abstract class AbstractPythonEnvironmentManager extends Object implements PythonEnvironmentManager
The base class of python environment manager which is used to create the PythonEnvironment object used to execute Python functions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractPythonEnvironmentManager.PythonLeasedResourcePython lease resource which includes environment variables and working directory of execution python environment.
-
Field Summary
Fields Modifier and Type Field Description protected PythonDependencyInfodependencyInfostatic StringPYFLINK_GATEWAY_DISABLEDstatic StringPYTHON_ARCHIVES_DIRstatic StringPYTHON_FILES_DIRstatic StringPYTHON_REQUIREMENTS_CACHEstatic StringPYTHON_REQUIREMENTS_DIRstatic StringPYTHON_REQUIREMENTS_FILEstatic StringPYTHON_REQUIREMENTS_INSTALL_DIRstatic StringPYTHON_WORKING_DIRprotected AbstractPythonEnvironmentManager.PythonLeasedResourceresource
-
Constructor Summary
Constructors Constructor Description AbstractPythonEnvironmentManager(PythonDependencyInfo dependencyInfo, String[] tmpDirectories, Map<String,String> systemEnv, org.apache.flink.api.common.JobID jobID)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Map<String,String>constructEnvironmentVariables(String baseDirectory)Constructs the environment variables which is used to launch the python UDF worker.StringgetBaseDirectory()Map<String,String>getPythonEnv()voidopen()Initialize the environment manager.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.python.env.PythonEnvironmentManager
createEnvironment
-
-
-
-
Field Detail
-
resource
protected transient AbstractPythonEnvironmentManager.PythonLeasedResource resource
-
dependencyInfo
protected final PythonDependencyInfo dependencyInfo
-
PYTHON_REQUIREMENTS_DIR
@VisibleForTesting public static final String PYTHON_REQUIREMENTS_DIR
- See Also:
- Constant Field Values
-
PYTHON_REQUIREMENTS_FILE
@VisibleForTesting public static final String PYTHON_REQUIREMENTS_FILE
- See Also:
- Constant Field Values
-
PYTHON_REQUIREMENTS_CACHE
@VisibleForTesting public static final String PYTHON_REQUIREMENTS_CACHE
- See Also:
- Constant Field Values
-
PYTHON_REQUIREMENTS_INSTALL_DIR
@VisibleForTesting public static final String PYTHON_REQUIREMENTS_INSTALL_DIR
- See Also:
- Constant Field Values
-
PYTHON_WORKING_DIR
@VisibleForTesting public static final String PYTHON_WORKING_DIR
- See Also:
- Constant Field Values
-
PYTHON_FILES_DIR
@VisibleForTesting public static final String PYTHON_FILES_DIR
- See Also:
- Constant Field Values
-
PYTHON_ARCHIVES_DIR
@VisibleForTesting public static final String PYTHON_ARCHIVES_DIR
- See Also:
- Constant Field Values
-
PYFLINK_GATEWAY_DISABLED
@VisibleForTesting public static final String PYFLINK_GATEWAY_DISABLED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractPythonEnvironmentManager
public AbstractPythonEnvironmentManager(PythonDependencyInfo dependencyInfo, String[] tmpDirectories, Map<String,String> systemEnv, org.apache.flink.api.common.JobID jobID)
-
-
Method Detail
-
open
public void open() throws ExceptionDescription copied from interface:PythonEnvironmentManagerInitialize the environment manager.- Specified by:
openin interfacePythonEnvironmentManager- Throws:
Exception
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
getBaseDirectory
@VisibleForTesting public String getBaseDirectory()
-
constructEnvironmentVariables
@VisibleForTesting public Map<String,String> constructEnvironmentVariables(String baseDirectory) throws IOException
Constructs the environment variables which is used to launch the python UDF worker.- Returns:
- The environment variables which contain the paths of the python dependencies.
- Throws:
IOException
-
-