Package org.apache.flink.python
Interface PythonFunctionRunner
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
BeamDataStreamPythonFunctionRunner,BeamPythonFunctionRunner,BeamTablePythonFunctionRunner
@Internal public interface PythonFunctionRunner extends AutoCloseable
The base interface of runner which is responsible for the execution of Python functions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Tear-down the Python function runner.voiddrainUnregisteredTimers()voidflush()Forces to finish the processing of the current bundle of elements.voidopen(org.apache.flink.configuration.ReadableConfig config)Prepares the Python function runner, such as preparing the Python execution environment, etc.org.apache.flink.api.java.tuple.Tuple3<String,byte[],Integer>pollResult()Retrieves the Python function result.voidprocess(byte[] data)Executes the Python function with the input byte array.voidprocessTimer(byte[] timerData)Send the triggered timer to the Python function.org.apache.flink.api.java.tuple.Tuple3<String,byte[],Integer>takeResult()Retrieves the Python function result, waiting if necessary until an element becomes available.
-
-
-
Method Detail
-
open
void open(org.apache.flink.configuration.ReadableConfig config) throws Exception
Prepares the Python function runner, such as preparing the Python execution environment, etc.- Throws:
Exception
-
close
void close() throws ExceptionTear-down the Python function runner.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
process
void process(byte[] data) throws ExceptionExecutes the Python function with the input byte array.- Parameters:
data- the byte array data.- Throws:
Exception
-
processTimer
void processTimer(byte[] timerData) throws ExceptionSend the triggered timer to the Python function.- Throws:
Exception
-
drainUnregisteredTimers
void drainUnregisteredTimers()
-
pollResult
org.apache.flink.api.java.tuple.Tuple3<String,byte[],Integer> pollResult() throws Exception
Retrieves the Python function result.- Returns:
- the head of he Python function result buffer, or
nullif the result buffer is empty. f0 means the byte array buffer which stores the Python function result. f1 means the length of the Python function result byte array. - Throws:
Exception
-
takeResult
org.apache.flink.api.java.tuple.Tuple3<String,byte[],Integer> takeResult() throws Exception
Retrieves the Python function result, waiting if necessary until an element becomes available.- Returns:
- the head of he Python function result buffer. f0 means the byte array buffer which stores the Python function result. f1 means the length of the Python function result byte array.
- Throws:
Exception
-
flush
void flush() throws ExceptionForces to finish the processing of the current bundle of elements. It will flush the data cached in the data buffer for processing and retrieves the state mutations (if exists) made by the Python function. The call blocks until all of the outputs produced by this bundle have been received.- Throws:
Exception
-
-