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 Details

    • getExecutionConfig

      org.apache.flink.api.common.ExecutionConfig getExecutionConfig()
      Returns the job specific ExecutionConfig.
      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 the JobInfo object associated with current job.
      Returns:
      JobInfo for current job
    • getTaskInfo

      org.apache.flink.api.common.TaskInfo getTaskInfo()
      Returns the TaskInfo 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 current IOManager.
      Returns:
      the current IOManager.
    • getMemoryManager

      MemoryManager getMemoryManager()
      Returns the current MemoryManager.
      Returns:
      the current MemoryManager.
    • getSharedResources

      SharedResources getSharedResources()
      Returns:
      the resources shared among all tasks of this task manager.
    • getUserCodeClassLoader

      org.apache.flink.util.UserCodeClassLoader getUserCodeClassLoader()
      Returns the user code class loader.
    • getDistributedCacheEntries

      Map<String,Future<org.apache.flink.core.fs.Path>> getDistributedCacheEntries()
    • getBroadcastVariableManager

      BroadcastVariableManager getBroadcastVariableManager()
    • getTaskStateManager

      TaskStateManager getTaskStateManager()
    • getGlobalAggregateManager

      GlobalAggregateManager getGlobalAggregateManager()
    • getExternalResourceInfoProvider

      ExternalResourceInfoProvider getExternalResourceInfoProvider()
      Get the ExternalResourceInfoProvider 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 for InternalKvState 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 checkpoint
      checkpointMetrics - 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 checkpoint
      checkpointMetrics - metrics for this checkpoint
      subtaskState - 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(org.apache.flink.api.common.operators.MailboxExecutor mainMailboxExecutor)
    • getMainMailboxExecutor

      default org.apache.flink.api.common.operators.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()