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 Detail

      • getExecutionConfig

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

        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.
      • getSharedResources

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

        UserCodeClassLoader getUserCodeClassLoader()
        Returns the user code class loader.
      • getAccumulatorRegistry

        AccumulatorRegistry getAccumulatorRegistry()
        Return the registry for accumulators which are periodically sent to the job manager.
        Returns:
        the 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.

      • 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)