Class TaskStatsRequestCoordinator.PendingStatsRequest<T,​V>

  • Type Parameters:
    T - Type of the result collected from tasks.
    V - Type of the result assembled and returned when all tasks where sampled.
    Enclosing class:
    TaskStatsRequestCoordinator<T,​V>

    @NotThreadSafe
    protected abstract static class TaskStatsRequestCoordinator.PendingStatsRequest<T,​V>
    extends Object
    A pending task stats request, which collects samples from individual tasks and completes the response future upon gathering all of of them.

    Has to be accessed in lock scope.

    • Field Detail

      • requestId

        protected final int requestId
        ID of the sampling request to this coordinator.
      • startTime

        protected final long startTime
        The time when the request is created.
      • statsResultByTaskGroup

        protected final Map<org.apache.flink.shaded.guava33.com.google.common.collect.ImmutableSet<ExecutionAttemptID>,​T> statsResultByTaskGroup
        Results returned by individual tasks and stored by the tasks' ExecutionAttemptID.
      • resultFuture

        protected final CompletableFuture<V> resultFuture
        The future with the final result.
      • isDiscarded

        protected boolean isDiscarded
    • Method Detail

      • isComplete

        protected boolean isComplete()
      • discard

        protected void discard​(Throwable cause)
      • collectTaskStats

        protected void collectTaskStats​(org.apache.flink.shaded.guava33.com.google.common.collect.ImmutableSet<ExecutionAttemptID> executionId,
                                        T taskStatsResult)
        Collects result from one of the tasks.
        Parameters:
        executionId - ID of the Task.
        taskStatsResult - Result of the stats sample from the Task.
      • checkDiscarded

        protected void checkDiscarded()
      • completePromiseAndDiscard

        protected void completePromiseAndDiscard()
      • getStatsFuture

        public CompletableFuture<V> getStatsFuture()
        A Future, which will either complete successfully if all of the samples from individual tasks are collected or exceptionally, if at least one of the task responses fails.
        Returns:
        A future with the result of collecting tasks statistics.
      • assembleCompleteStats

        protected abstract V assembleCompleteStats​(long endTime)
        A method that is called when responses from all tasks were collected successfully. It is responsible for assembling the final result from the individual tasks' samples. Those samples can be accessed via the Map<ExecutionAttemptID, T> statsResultByTask variable.
        Parameters:
        endTime - The time when the final sample was collected.
        Returns:
        The final combined result, which will be returned as a future by the CompletableFuture<V> getStatsFuture method