Interface Environment
- All Known Implementing Classes:
RuntimeEnvironment
public interface Environment
The Environment gives the code executed in a task access to the task's properties (such as name,
parallelism), the configurations, the data stream readers and writers, as well as the various
components that are provided by the TaskManager, such as memory manager, I/O manager, ...
-
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledgeCheckpoint(long checkpointId, CheckpointMetrics checkpointMetrics) Confirms that the invokable has successfully completed all steps it needed to for the checkpoint with the give checkpoint-ID.voidacknowledgeCheckpoint(long checkpointId, CheckpointMetrics checkpointMetrics, TaskStateSnapshot subtaskState) Confirms that the invokable has successfully completed all required steps for the checkpoint with the give checkpoint-ID.voiddeclineCheckpoint(long checkpointId, CheckpointException checkpointException) Declines a checkpoint.voidfailExternally(Throwable cause) Marks task execution failed for an external reason (a reason other than the task code itself throwing an exception).Return the registry for accumulators which are periodically sent to the job manager.default ExecutorServicedefault CheckpointStorageAccessorg.apache.flink.api.common.ExecutionConfigReturns the job specificExecutionConfig.Gets the ID of the task execution attempt.Get theExternalResourceInfoProviderwhich contains infos of available external resources.getInputGate(int index) Returns the input split provider assigned to this environment.Returns the currentIOManager.org.apache.flink.configuration.ConfigurationReturns the job-wide configuration object that was attached to the JobGraph.org.apache.flink.api.common.JobIDgetJobID()Returns the ID of the job that the task belongs to.org.apache.flink.api.common.JobInfoReturns theJobInfoobject associated with current job.Gets the ID of the JobVertex for which this task executes a parallel subtask.default org.apache.flink.api.common.operators.MailboxExecutorReturns the currentMemoryManager.Returns the task specific metric group.Gets the gateway through which operators can send events to the operator coordinators.org.apache.flink.configuration.ConfigurationReturns the task-wide configuration object, originally attached to the job vertex.org.apache.flink.api.common.TaskInfoReturns theTaskInfoobject associated with this subtask.Returns the registry forInternalKvStateinstances.Gets the task manager info, with configuration and hostname.org.apache.flink.util.UserCodeClassLoaderReturns the user code class loader.getWriter(int index) default voidsetAsyncOperationsThreadPool(ExecutorService executorService) default voidsetCheckpointStorageAccess(CheckpointStorageAccess checkpointStorageAccess) default voidsetMainMailboxExecutor(org.apache.flink.api.common.operators.MailboxExecutor mainMailboxExecutor)
-
Method Details
-
getExecutionConfig
org.apache.flink.api.common.ExecutionConfig getExecutionConfig()Returns the job specificExecutionConfig.- Returns:
- The execution configuration associated with the current job.
-
getJobID
org.apache.flink.api.common.JobID getJobID()Returns the ID of the job that the task belongs to.- Returns:
- the ID of the job from the original job graph
-
getJobType
JobType getJobType() -
getJobVertexId
JobVertexID getJobVertexId()Gets the ID of the JobVertex for which this task executes a parallel subtask.- Returns:
- The JobVertexID of this task.
-
getExecutionId
ExecutionAttemptID getExecutionId()Gets the ID of the task execution attempt.- Returns:
- The ID of the task execution attempt.
-
getTaskConfiguration
org.apache.flink.configuration.Configuration getTaskConfiguration()Returns the task-wide configuration object, originally attached to the job vertex.- Returns:
- The task-wide configuration
-
getTaskManagerInfo
TaskManagerRuntimeInfo getTaskManagerInfo()Gets the task manager info, with configuration and hostname.- Returns:
- The task manager info, with configuration and hostname.
-
getMetricGroup
TaskMetricGroup getMetricGroup()Returns the task specific metric group.- Returns:
- The MetricGroup of this task.
-
getJobConfiguration
org.apache.flink.configuration.Configuration getJobConfiguration()Returns the job-wide configuration object that was attached to the JobGraph.- Returns:
- The job-wide configuration
-
getJobInfo
org.apache.flink.api.common.JobInfo getJobInfo()Returns theJobInfoobject associated with current job.- Returns:
- JobInfo for current job
-
getTaskInfo
org.apache.flink.api.common.TaskInfo getTaskInfo()Returns theTaskInfoobject associated with this subtask.- Returns:
- TaskInfo for this subtask
-
getInputSplitProvider
InputSplitProvider getInputSplitProvider()Returns the input split provider assigned to this environment.- Returns:
- The input split provider or
nullif no such provider has been assigned to this environment.
-
getOperatorCoordinatorEventGateway
TaskOperatorEventGateway getOperatorCoordinatorEventGateway()Gets the gateway through which operators can send events to the operator coordinators. -
getIOManager
IOManager getIOManager()Returns the currentIOManager.- Returns:
- the current
IOManager.
-
getMemoryManager
MemoryManager getMemoryManager()Returns the currentMemoryManager.- Returns:
- the current
MemoryManager.
-
getUserCodeClassLoader
org.apache.flink.util.UserCodeClassLoader getUserCodeClassLoader()Returns the user code class loader. -
getDistributedCacheEntries
-
getBroadcastVariableManager
BroadcastVariableManager getBroadcastVariableManager() -
getTaskStateManager
TaskStateManager getTaskStateManager() -
getGlobalAggregateManager
GlobalAggregateManager getGlobalAggregateManager() -
getExternalResourceInfoProvider
ExternalResourceInfoProvider getExternalResourceInfoProvider()Get theExternalResourceInfoProviderwhich contains infos of available external resources.- Returns:
ExternalResourceInfoProviderwhich contains infos of available external resources
-
getAccumulatorRegistry
AccumulatorRegistry getAccumulatorRegistry()Return the registry for accumulators which are periodically sent to the job manager.- Returns:
- the registry
-
getTaskKvStateRegistry
TaskKvStateRegistry getTaskKvStateRegistry()Returns the registry forInternalKvStateinstances.- Returns:
- KvState registry
-
acknowledgeCheckpoint
Confirms that the invokable has successfully completed all steps it needed to for the checkpoint with the give checkpoint-ID. This method does not include any state in the checkpoint.- Parameters:
checkpointId- ID of this checkpointcheckpointMetrics- metrics for this checkpoint
-
acknowledgeCheckpoint
void acknowledgeCheckpoint(long checkpointId, CheckpointMetrics checkpointMetrics, TaskStateSnapshot subtaskState) Confirms that the invokable has successfully completed all required steps for the checkpoint with the give checkpoint-ID. This method does include the given state in the checkpoint.- Parameters:
checkpointId- ID of this checkpointcheckpointMetrics- metrics for this checkpointsubtaskState- All state handles for the checkpointed state
-
declineCheckpoint
Declines a checkpoint. This tells the checkpoint coordinator that this task will not be able to successfully complete a certain checkpoint.- Parameters:
checkpointId- The ID of the declined checkpoint.checkpointException- The exception why the checkpoint was declined.
-
failExternally
Marks task execution failed for an external reason (a reason other than the task code itself throwing an exception). If the task is already in a terminal state (such as FINISHED, CANCELED, FAILED), or if the task is already canceling this does nothing. Otherwise it sets the state to FAILED, and, if the invokable code is running, starts an asynchronous thread that aborts that code.This method never blocks.
-
getWriter
-
getAllWriters
ResultPartitionWriter[] getAllWriters() -
getInputGate
-
getAllInputGates
IndexedInputGate[] getAllInputGates() -
getTaskEventDispatcher
TaskEventDispatcher getTaskEventDispatcher() -
getTaskManagerActions
TaskManagerActions getTaskManagerActions() -
setMainMailboxExecutor
default void setMainMailboxExecutor(org.apache.flink.api.common.operators.MailboxExecutor mainMailboxExecutor) -
getMainMailboxExecutor
default org.apache.flink.api.common.operators.MailboxExecutor getMainMailboxExecutor() -
setAsyncOperationsThreadPool
-
getAsyncOperationsThreadPool
-
setCheckpointStorageAccess
-
getCheckpointStorageAccess
-
getChannelStateExecutorFactory
ChannelStateWriteRequestExecutorFactory getChannelStateExecutorFactory()
-