Class AbstractPythonFunctionOperator<OUT>
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.AbstractStreamOperator<OUT>
-
- org.apache.flink.streaming.api.operators.python.AbstractPythonFunctionOperator<OUT>
-
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.streaming.api.operators.KeyContext,org.apache.flink.streaming.api.operators.KeyContextHandler,org.apache.flink.streaming.api.operators.SetupableStreamOperator<OUT>,org.apache.flink.streaming.api.operators.StreamOperator<OUT>,org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator
- Direct Known Subclasses:
AbstractEmbeddedPythonFunctionOperator,AbstractExternalPythonFunctionOperator,DelegateOperatorTransformation.DelegateOperator
@Internal public abstract class AbstractPythonFunctionOperator<OUT> extends org.apache.flink.streaming.api.operators.AbstractStreamOperator<OUT>Base class for all stream operators to execute Python functions.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected RunnablebundleFinishedCallbackCallback to be executed after the current bundle was finished.protected org.apache.flink.configuration.Configurationconfigprotected intelementCountNumber of processed elements in the current bundle.protected longlastFinishBundleTimeTime that the last bundle was finished.protected intmaxBundleSizeMax number of elements to include in a bundle.protected booleansystemEnvEnabled
-
Constructor Summary
Constructors Constructor Description AbstractPythonFunctionOperator(org.apache.flink.configuration.Configuration config)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckInvokeFinishBundleByCount()Checks whether to invoke finishBundle by elements count.voidclose()protected abstract PythonEnvironmentManagercreatePythonEnvironmentManager()protected voiddrainUnregisteredTimers()voidfinish()org.apache.flink.configuration.ConfigurationgetConfiguration()Returns theConfiguration.protected FlinkMetricContainergetFlinkMetricContainer()protected abstract voidinvokeFinishBundle()booleanisBundleFinished()Returns whether the bundle is finished.voidopen()voidprepareSnapshotPreBarrier(long checkpointId)voidprocessWatermark(org.apache.flink.streaming.api.watermark.Watermark mark)voidsetCurrentKey(Object key)-
Methods inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator
getChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, hasKeyContext1, hasKeyContext2, initializeState, initializeState, isUsingCustomRawKeyedState, notifyCheckpointAborted, notifyCheckpointComplete, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processRecordAttributes, processRecordAttributes1, processRecordAttributes2, processWatermark1, processWatermark2, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setChainingStrategy, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, setup, snapshotState, snapshotState
-
-
-
-
Field Detail
-
config
protected final org.apache.flink.configuration.Configuration config
-
systemEnvEnabled
protected transient boolean systemEnvEnabled
-
maxBundleSize
protected transient int maxBundleSize
Max number of elements to include in a bundle.
-
elementCount
protected transient int elementCount
Number of processed elements in the current bundle.
-
lastFinishBundleTime
protected transient long lastFinishBundleTime
Time that the last bundle was finished.
-
bundleFinishedCallback
protected transient Runnable bundleFinishedCallback
Callback to be executed after the current bundle was finished.
-
-
Method Detail
-
open
public void open() throws Exception
-
finish
public void finish() throws Exception
-
close
public void close() throws Exception
-
prepareSnapshotPreBarrier
public void prepareSnapshotPreBarrier(long checkpointId) throws Exception
-
processWatermark
public void processWatermark(org.apache.flink.streaming.api.watermark.Watermark mark) throws Exception
-
setCurrentKey
public void setCurrentKey(Object key)
- Specified by:
setCurrentKeyin interfaceorg.apache.flink.streaming.api.operators.KeyContext- Overrides:
setCurrentKeyin classorg.apache.flink.streaming.api.operators.AbstractStreamOperator<OUT>
-
isBundleFinished
public boolean isBundleFinished()
Returns whether the bundle is finished.
-
getConfiguration
public org.apache.flink.configuration.Configuration getConfiguration()
Returns theConfiguration.
-
createPythonEnvironmentManager
protected abstract PythonEnvironmentManager createPythonEnvironmentManager()
-
drainUnregisteredTimers
protected void drainUnregisteredTimers()
-
checkInvokeFinishBundleByCount
protected void checkInvokeFinishBundleByCount() throws ExceptionChecks whether to invoke finishBundle by elements count. Called in processElement.- Throws:
Exception
-
getFlinkMetricContainer
protected FlinkMetricContainer getFlinkMetricContainer()
-
-