Class RuntimeEnvironment
- java.lang.Object
-
- org.apache.flink.runtime.taskmanager.RuntimeEnvironment
-
- All Implemented Interfaces:
Environment
public class RuntimeEnvironment extends Object implements Environment
In implementation of theEnvironment.
-
-
Constructor Summary
Constructors Constructor Description RuntimeEnvironment(org.apache.flink.api.common.JobID jobId, JobType jobType, JobVertexID jobVertexId, ExecutionAttemptID executionId, org.apache.flink.api.common.ExecutionConfig executionConfig, org.apache.flink.api.common.JobInfo jobInfo, org.apache.flink.api.common.TaskInfo taskInfo, org.apache.flink.configuration.Configuration jobConfiguration, org.apache.flink.configuration.Configuration taskConfiguration, org.apache.flink.util.UserCodeClassLoader userCodeClassLoader, MemoryManager memManager, SharedResources sharedResources, IOManager ioManager, BroadcastVariableManager bcVarManager, TaskStateManager taskStateManager, GlobalAggregateManager aggregateManager, AccumulatorRegistry accumulatorRegistry, TaskKvStateRegistry kvStateRegistry, InputSplitProvider splitProvider, Map<String,Future<org.apache.flink.core.fs.Path>> distCacheEntries, ResultPartitionWriter[] writers, IndexedInputGate[] inputGates, TaskEventDispatcher taskEventDispatcher, CheckpointResponder checkpointResponder, TaskOperatorEventGateway operatorEventGateway, TaskManagerRuntimeInfo taskManagerInfo, TaskMetricGroup metrics, Task containingTask, ExternalResourceInfoProvider externalResourceInfoProvider, ChannelStateWriteRequestExecutorFactory channelStateExecutorFactory, TaskManagerActions taskManagerActions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledgeCheckpoint(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 checkpointStateHandles)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).AccumulatorRegistrygetAccumulatorRegistry()Return the registry for accumulators which are periodically sent to the job manager.IndexedInputGate[]getAllInputGates()ResultPartitionWriter[]getAllWriters()ExecutorServicegetAsyncOperationsThreadPool()BroadcastVariableManagergetBroadcastVariableManager()ChannelStateWriteRequestExecutorFactorygetChannelStateExecutorFactory()CheckpointStorageAccessgetCheckpointStorageAccess()Map<String,Future<org.apache.flink.core.fs.Path>>getDistributedCacheEntries()org.apache.flink.api.common.ExecutionConfiggetExecutionConfig()Returns the job specificExecutionConfig.ExecutionAttemptIDgetExecutionId()Gets the ID of the task execution attempt.ExternalResourceInfoProvidergetExternalResourceInfoProvider()Get theExternalResourceInfoProviderwhich contains infos of available external resources.GlobalAggregateManagergetGlobalAggregateManager()IndexedInputGategetInputGate(int index)InputSplitProvidergetInputSplitProvider()Returns the input split provider assigned to this environment.IOManagergetIOManager()Returns the currentIOManager.org.apache.flink.configuration.ConfigurationgetJobConfiguration()Returns 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.JobInfogetJobInfo()Returns theJobInfoobject associated with current job.JobTypegetJobType()JobVertexIDgetJobVertexId()Gets the ID of the JobVertex for which this task executes a parallel subtask.org.apache.flink.api.common.operators.MailboxExecutorgetMainMailboxExecutor()MemoryManagergetMemoryManager()Returns the currentMemoryManager.TaskMetricGroupgetMetricGroup()Returns the task specific metric group.TaskOperatorEventGatewaygetOperatorCoordinatorEventGateway()Gets the gateway through which operators can send events to the operator coordinators.SharedResourcesgetSharedResources()org.apache.flink.configuration.ConfigurationgetTaskConfiguration()Returns the task-wide configuration object, originally attached to the job vertex.TaskEventDispatchergetTaskEventDispatcher()org.apache.flink.api.common.TaskInfogetTaskInfo()Returns theTaskInfoobject associated with this subtask.TaskKvStateRegistrygetTaskKvStateRegistry()Returns the registry forInternalKvStateinstances.TaskManagerActionsgetTaskManagerActions()TaskManagerRuntimeInfogetTaskManagerInfo()Gets the task manager info, with configuration and hostname.TaskStateManagergetTaskStateManager()org.apache.flink.util.UserCodeClassLoadergetUserCodeClassLoader()Returns the user code class loader.ResultPartitionWritergetWriter(int index)voidsetAsyncOperationsThreadPool(ExecutorService executorService)voidsetCheckpointStorageAccess(CheckpointStorageAccess checkpointStorageAccess)voidsetMainMailboxExecutor(org.apache.flink.api.common.operators.MailboxExecutor mainMailboxExecutor)
-
-
-
Constructor Detail
-
RuntimeEnvironment
public RuntimeEnvironment(org.apache.flink.api.common.JobID jobId, JobType jobType, JobVertexID jobVertexId, ExecutionAttemptID executionId, org.apache.flink.api.common.ExecutionConfig executionConfig, org.apache.flink.api.common.JobInfo jobInfo, org.apache.flink.api.common.TaskInfo taskInfo, org.apache.flink.configuration.Configuration jobConfiguration, org.apache.flink.configuration.Configuration taskConfiguration, org.apache.flink.util.UserCodeClassLoader userCodeClassLoader, MemoryManager memManager, SharedResources sharedResources, IOManager ioManager, BroadcastVariableManager bcVarManager, TaskStateManager taskStateManager, GlobalAggregateManager aggregateManager, AccumulatorRegistry accumulatorRegistry, TaskKvStateRegistry kvStateRegistry, InputSplitProvider splitProvider, Map<String,Future<org.apache.flink.core.fs.Path>> distCacheEntries, ResultPartitionWriter[] writers, IndexedInputGate[] inputGates, TaskEventDispatcher taskEventDispatcher, CheckpointResponder checkpointResponder, TaskOperatorEventGateway operatorEventGateway, TaskManagerRuntimeInfo taskManagerInfo, TaskMetricGroup metrics, Task containingTask, ExternalResourceInfoProvider externalResourceInfoProvider, ChannelStateWriteRequestExecutorFactory channelStateExecutorFactory, TaskManagerActions taskManagerActions)
-
-
Method Detail
-
getExecutionConfig
public org.apache.flink.api.common.ExecutionConfig getExecutionConfig()
Description copied from interface:EnvironmentReturns the job specificExecutionConfig.- Specified by:
getExecutionConfigin interfaceEnvironment- Returns:
- The execution configuration associated with the current job.
-
getJobID
public org.apache.flink.api.common.JobID getJobID()
Description copied from interface:EnvironmentReturns the ID of the job that the task belongs to.- Specified by:
getJobIDin interfaceEnvironment- Returns:
- the ID of the job from the original job graph
-
getJobType
public JobType getJobType()
- Specified by:
getJobTypein interfaceEnvironment
-
getJobVertexId
public JobVertexID getJobVertexId()
Description copied from interface:EnvironmentGets the ID of the JobVertex for which this task executes a parallel subtask.- Specified by:
getJobVertexIdin interfaceEnvironment- Returns:
- The JobVertexID of this task.
-
getExecutionId
public ExecutionAttemptID getExecutionId()
Description copied from interface:EnvironmentGets the ID of the task execution attempt.- Specified by:
getExecutionIdin interfaceEnvironment- Returns:
- The ID of the task execution attempt.
-
getJobInfo
public org.apache.flink.api.common.JobInfo getJobInfo()
Description copied from interface:EnvironmentReturns theJobInfoobject associated with current job.- Specified by:
getJobInfoin interfaceEnvironment- Returns:
- JobInfo for current job
-
getTaskInfo
public org.apache.flink.api.common.TaskInfo getTaskInfo()
Description copied from interface:EnvironmentReturns theTaskInfoobject associated with this subtask.- Specified by:
getTaskInfoin interfaceEnvironment- Returns:
- TaskInfo for this subtask
-
getJobConfiguration
public org.apache.flink.configuration.Configuration getJobConfiguration()
Description copied from interface:EnvironmentReturns the job-wide configuration object that was attached to the JobGraph.- Specified by:
getJobConfigurationin interfaceEnvironment- Returns:
- The job-wide configuration
-
getTaskConfiguration
public org.apache.flink.configuration.Configuration getTaskConfiguration()
Description copied from interface:EnvironmentReturns the task-wide configuration object, originally attached to the job vertex.- Specified by:
getTaskConfigurationin interfaceEnvironment- Returns:
- The task-wide configuration
-
getTaskManagerInfo
public TaskManagerRuntimeInfo getTaskManagerInfo()
Description copied from interface:EnvironmentGets the task manager info, with configuration and hostname.- Specified by:
getTaskManagerInfoin interfaceEnvironment- Returns:
- The task manager info, with configuration and hostname.
-
getMetricGroup
public TaskMetricGroup getMetricGroup()
Description copied from interface:EnvironmentReturns the task specific metric group.- Specified by:
getMetricGroupin interfaceEnvironment- Returns:
- The MetricGroup of this task.
-
getUserCodeClassLoader
public org.apache.flink.util.UserCodeClassLoader getUserCodeClassLoader()
Description copied from interface:EnvironmentReturns the user code class loader.- Specified by:
getUserCodeClassLoaderin interfaceEnvironment
-
getMemoryManager
public MemoryManager getMemoryManager()
Description copied from interface:EnvironmentReturns the currentMemoryManager.- Specified by:
getMemoryManagerin interfaceEnvironment- Returns:
- the current
MemoryManager.
-
getSharedResources
public SharedResources getSharedResources()
- Specified by:
getSharedResourcesin interfaceEnvironment- Returns:
- the resources shared among all tasks of this task manager.
-
getIOManager
public IOManager getIOManager()
Description copied from interface:EnvironmentReturns the currentIOManager.- Specified by:
getIOManagerin interfaceEnvironment- Returns:
- the current
IOManager.
-
getBroadcastVariableManager
public BroadcastVariableManager getBroadcastVariableManager()
- Specified by:
getBroadcastVariableManagerin interfaceEnvironment
-
getTaskStateManager
public TaskStateManager getTaskStateManager()
- Specified by:
getTaskStateManagerin interfaceEnvironment
-
getGlobalAggregateManager
public GlobalAggregateManager getGlobalAggregateManager()
- Specified by:
getGlobalAggregateManagerin interfaceEnvironment
-
getAccumulatorRegistry
public AccumulatorRegistry getAccumulatorRegistry()
Description copied from interface:EnvironmentReturn the registry for accumulators which are periodically sent to the job manager.- Specified by:
getAccumulatorRegistryin interfaceEnvironment- Returns:
- the registry
-
getTaskKvStateRegistry
public TaskKvStateRegistry getTaskKvStateRegistry()
Description copied from interface:EnvironmentReturns the registry forInternalKvStateinstances.- Specified by:
getTaskKvStateRegistryin interfaceEnvironment- Returns:
- KvState registry
-
getInputSplitProvider
public InputSplitProvider getInputSplitProvider()
Description copied from interface:EnvironmentReturns the input split provider assigned to this environment.- Specified by:
getInputSplitProviderin interfaceEnvironment- Returns:
- The input split provider or
nullif no such provider has been assigned to this environment.
-
getDistributedCacheEntries
public Map<String,Future<org.apache.flink.core.fs.Path>> getDistributedCacheEntries()
- Specified by:
getDistributedCacheEntriesin interfaceEnvironment
-
getWriter
public ResultPartitionWriter getWriter(int index)
- Specified by:
getWriterin interfaceEnvironment
-
getAllWriters
public ResultPartitionWriter[] getAllWriters()
- Specified by:
getAllWritersin interfaceEnvironment
-
getInputGate
public IndexedInputGate getInputGate(int index)
- Specified by:
getInputGatein interfaceEnvironment
-
getAllInputGates
public IndexedInputGate[] getAllInputGates()
- Specified by:
getAllInputGatesin interfaceEnvironment
-
getTaskEventDispatcher
public TaskEventDispatcher getTaskEventDispatcher()
- Specified by:
getTaskEventDispatcherin interfaceEnvironment
-
getExternalResourceInfoProvider
public ExternalResourceInfoProvider getExternalResourceInfoProvider()
Description copied from interface:EnvironmentGet theExternalResourceInfoProviderwhich contains infos of available external resources.- Specified by:
getExternalResourceInfoProviderin interfaceEnvironment- Returns:
ExternalResourceInfoProviderwhich contains infos of available external resources
-
getTaskManagerActions
public TaskManagerActions getTaskManagerActions()
- Specified by:
getTaskManagerActionsin interfaceEnvironment
-
acknowledgeCheckpoint
public void acknowledgeCheckpoint(long checkpointId, CheckpointMetrics checkpointMetrics)Description copied from interface:EnvironmentConfirms 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.- Specified by:
acknowledgeCheckpointin interfaceEnvironment- Parameters:
checkpointId- ID of this checkpointcheckpointMetrics- metrics for this checkpoint
-
acknowledgeCheckpoint
public void acknowledgeCheckpoint(long checkpointId, CheckpointMetrics checkpointMetrics, TaskStateSnapshot checkpointStateHandles)Description copied from interface:EnvironmentConfirms 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.- Specified by:
acknowledgeCheckpointin interfaceEnvironment- Parameters:
checkpointId- ID of this checkpointcheckpointMetrics- metrics for this checkpointcheckpointStateHandles- All state handles for the checkpointed state
-
declineCheckpoint
public void declineCheckpoint(long checkpointId, CheckpointException checkpointException)Description copied from interface:EnvironmentDeclines a checkpoint. This tells the checkpoint coordinator that this task will not be able to successfully complete a certain checkpoint.- Specified by:
declineCheckpointin interfaceEnvironment- Parameters:
checkpointId- The ID of the declined checkpoint.checkpointException- The exception why the checkpoint was declined.
-
getOperatorCoordinatorEventGateway
public TaskOperatorEventGateway getOperatorCoordinatorEventGateway()
Description copied from interface:EnvironmentGets the gateway through which operators can send events to the operator coordinators.- Specified by:
getOperatorCoordinatorEventGatewayin interfaceEnvironment
-
failExternally
public void failExternally(Throwable cause)
Description copied from interface:EnvironmentMarks 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.
- Specified by:
failExternallyin interfaceEnvironment
-
setMainMailboxExecutor
public void setMainMailboxExecutor(org.apache.flink.api.common.operators.MailboxExecutor mainMailboxExecutor)
- Specified by:
setMainMailboxExecutorin interfaceEnvironment
-
getMainMailboxExecutor
public org.apache.flink.api.common.operators.MailboxExecutor getMainMailboxExecutor()
- Specified by:
getMainMailboxExecutorin interfaceEnvironment
-
setAsyncOperationsThreadPool
public void setAsyncOperationsThreadPool(ExecutorService executorService)
- Specified by:
setAsyncOperationsThreadPoolin interfaceEnvironment
-
getAsyncOperationsThreadPool
public ExecutorService getAsyncOperationsThreadPool()
- Specified by:
getAsyncOperationsThreadPoolin interfaceEnvironment
-
setCheckpointStorageAccess
public void setCheckpointStorageAccess(CheckpointStorageAccess checkpointStorageAccess)
- Specified by:
setCheckpointStorageAccessin interfaceEnvironment
-
getCheckpointStorageAccess
public CheckpointStorageAccess getCheckpointStorageAccess()
- Specified by:
getCheckpointStorageAccessin interfaceEnvironment
-
getChannelStateExecutorFactory
public ChannelStateWriteRequestExecutorFactory getChannelStateExecutorFactory()
- Specified by:
getChannelStateExecutorFactoryin interfaceEnvironment
-
-