Class TaskStatsRequestCoordinator.PendingStatsRequest<T,V>
java.lang.Object
org.apache.flink.runtime.webmonitor.stats.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 Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final Set<Set<ExecutionAttemptID>>All tasks what did not yet return a result.protected final intID of the sampling request to this coordinator.protected final CompletableFuture<V>The future with the final result.protected final longThe time when the request is created.protected final Map<org.apache.flink.shaded.guava32.com.google.common.collect.ImmutableSet<ExecutionAttemptID>,T> Results returned by individual tasks and stored by the tasks'ExecutionAttemptID. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPendingStatsRequest(int requestId, Collection<? extends Set<ExecutionAttemptID>> tasksToCollect) Creates newTaskStatsRequestCoordinator.PendingStatsRequest. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract VassembleCompleteStats(long endTime) A method that is called when responses from all tasks were collected successfully.protected voidprotected voidcollectTaskStats(org.apache.flink.shaded.guava32.com.google.common.collect.ImmutableSet<ExecutionAttemptID> executionId, T taskStatsResult) Collects result from one of the tasks.protected voidprotected voidA 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.protected boolean
-
Field Details
-
requestId
protected final int requestIdID of the sampling request to this coordinator. -
startTime
protected final long startTimeThe time when the request is created. -
pendingTasks
All tasks what did not yet return a result. -
statsResultByTaskGroup
protected final Map<org.apache.flink.shaded.guava32.com.google.common.collect.ImmutableSet<ExecutionAttemptID>,T> statsResultByTaskGroupResults returned by individual tasks and stored by the tasks'ExecutionAttemptID. -
resultFuture
The future with the final result. -
isDiscarded
protected boolean isDiscarded
-
-
Constructor Details
-
PendingStatsRequest
protected PendingStatsRequest(int requestId, Collection<? extends Set<ExecutionAttemptID>> tasksToCollect) Creates newTaskStatsRequestCoordinator.PendingStatsRequest.- Parameters:
requestId- ID of the request.tasksToCollect- tasks from which the stats responses are expected.
-
-
Method Details
-
isComplete
protected boolean isComplete() -
discard
-
collectTaskStats
protected void collectTaskStats(org.apache.flink.shaded.guava32.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
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
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 theMap<ExecutionAttemptID, T> statsResultByTaskvariable.- 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> getStatsFuturemethod
-