Interface Environment
-
- All Known Implementing Classes:
RuntimeEnvironment
,SavepointEnvironment
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
acknowledgeCheckpoint(long checkpointId, CheckpointMetrics checkpointMetrics)
Confirms that the invokable has successfully completed all steps it needed to for the checkpoint with the give checkpoint-ID.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.void
declineCheckpoint(long checkpointId, CheckpointException checkpointException)
Declines a checkpoint.void
failExternally(Throwable cause)
Marks task execution failed for an external reason (a reason other than the task code itself throwing an exception).AccumulatorRegistry
getAccumulatorRegistry()
Return the registry for accumulators which are periodically sent to the job manager.IndexedInputGate[]
getAllInputGates()
ResultPartitionWriter[]
getAllWriters()
default ExecutorService
getAsyncOperationsThreadPool()
BroadcastVariableManager
getBroadcastVariableManager()
ChannelStateWriteRequestExecutorFactory
getChannelStateExecutorFactory()
default CheckpointStorageAccess
getCheckpointStorageAccess()
Map<String,Future<Path>>
getDistributedCacheEntries()
ExecutionConfig
getExecutionConfig()
Returns the job specificExecutionConfig
.ExecutionAttemptID
getExecutionId()
Gets the ID of the task execution attempt.ExternalResourceInfoProvider
getExternalResourceInfoProvider()
Get theExternalResourceInfoProvider
which contains infos of available external resources.GlobalAggregateManager
getGlobalAggregateManager()
IndexedInputGate
getInputGate(int index)
InputSplitProvider
getInputSplitProvider()
Returns the input split provider assigned to this environment.IOManager
getIOManager()
Returns the currentIOManager
.Configuration
getJobConfiguration()
Returns the job-wide configuration object that was attached to the JobGraph.JobID
getJobID()
Returns the ID of the job that the task belongs to.JobInfo
getJobInfo()
Returns theJobInfo
object associated with current job.JobType
getJobType()
JobVertexID
getJobVertexId()
Gets the ID of the JobVertex for which this task executes a parallel subtask.default MailboxExecutor
getMainMailboxExecutor()
MemoryManager
getMemoryManager()
Returns the currentMemoryManager
.TaskMetricGroup
getMetricGroup()
Returns the task specific metric group.TaskOperatorEventGateway
getOperatorCoordinatorEventGateway()
Gets the gateway through which operators can send events to the operator coordinators.SharedResources
getSharedResources()
Configuration
getTaskConfiguration()
Returns the task-wide configuration object, originally attached to the job vertex.TaskEventDispatcher
getTaskEventDispatcher()
TaskInfo
getTaskInfo()
Returns theTaskInfo
object associated with this subtask.TaskKvStateRegistry
getTaskKvStateRegistry()
Returns the registry forInternalKvState
instances.TaskManagerActions
getTaskManagerActions()
TaskManagerRuntimeInfo
getTaskManagerInfo()
Gets the task manager info, with configuration and hostname.TaskStateManager
getTaskStateManager()
UserCodeClassLoader
getUserCodeClassLoader()
Returns the user code class loader.ResultPartitionWriter
getWriter(int index)
default void
setAsyncOperationsThreadPool(ExecutorService executorService)
default void
setCheckpointStorageAccess(CheckpointStorageAccess checkpointStorageAccess)
default void
setMainMailboxExecutor(MailboxExecutor mainMailboxExecutor)
-
-
-
Method Detail
-
getExecutionConfig
ExecutionConfig getExecutionConfig()
Returns the job specificExecutionConfig
.- Returns:
- The execution configuration associated with the current job.
-
getJobID
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
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
Configuration getJobConfiguration()
Returns the job-wide configuration object that was attached to the JobGraph.- Returns:
- The job-wide configuration
-
getJobInfo
JobInfo getJobInfo()
Returns theJobInfo
object associated with current job.- Returns:
- JobInfo for current job
-
getTaskInfo
TaskInfo getTaskInfo()
Returns theTaskInfo
object 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
null
if 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
.
-
getSharedResources
SharedResources getSharedResources()
- Returns:
- the resources shared among all tasks of this task manager.
-
getUserCodeClassLoader
UserCodeClassLoader getUserCodeClassLoader()
Returns the user code class loader.
-
getBroadcastVariableManager
BroadcastVariableManager getBroadcastVariableManager()
-
getTaskStateManager
TaskStateManager getTaskStateManager()
-
getGlobalAggregateManager
GlobalAggregateManager getGlobalAggregateManager()
-
getExternalResourceInfoProvider
ExternalResourceInfoProvider getExternalResourceInfoProvider()
Get theExternalResourceInfoProvider
which contains infos of available external resources.- Returns:
ExternalResourceInfoProvider
which 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 forInternalKvState
instances.- Returns:
- KvState registry
-
acknowledgeCheckpoint
void acknowledgeCheckpoint(long checkpointId, CheckpointMetrics checkpointMetrics)
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
void declineCheckpoint(long checkpointId, CheckpointException checkpointException)
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
void failExternally(Throwable cause)
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
ResultPartitionWriter getWriter(int index)
-
getAllWriters
ResultPartitionWriter[] getAllWriters()
-
getInputGate
IndexedInputGate getInputGate(int index)
-
getAllInputGates
IndexedInputGate[] getAllInputGates()
-
getTaskEventDispatcher
TaskEventDispatcher getTaskEventDispatcher()
-
getTaskManagerActions
TaskManagerActions getTaskManagerActions()
-
setMainMailboxExecutor
default void setMainMailboxExecutor(MailboxExecutor mainMailboxExecutor)
-
getMainMailboxExecutor
default MailboxExecutor getMainMailboxExecutor()
-
setAsyncOperationsThreadPool
default void setAsyncOperationsThreadPool(ExecutorService executorService)
-
getAsyncOperationsThreadPool
default ExecutorService getAsyncOperationsThreadPool()
-
setCheckpointStorageAccess
default void setCheckpointStorageAccess(CheckpointStorageAccess checkpointStorageAccess)
-
getCheckpointStorageAccess
default CheckpointStorageAccess getCheckpointStorageAccess()
-
getChannelStateExecutorFactory
ChannelStateWriteRequestExecutorFactory getChannelStateExecutorFactory()
-
-