zhijiangW commented on a change in pull request #10083:
[FLINK-14472][runtime]Implement back-pressure monitor with non-blocking outputs.
URL: https://github.com/apache/flink/pull/10083#discussion_r343613553
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
##########
@@ -461,16 +461,15 @@ AbstractInvokable getInvokable() {
return invokable;
}
- public StackTraceElement[] getStackTraceOfExecutingThread() {
- final AbstractInvokable invokable = this.invokable;
-
- if (invokable == null) {
- return new StackTraceElement[0];
+ public boolean isAvailableForOutput() {
+ if (invokable == null ||
consumableNotifyingPartitionWriters.length == 0) {
+ return true;
}
-
- return invokable.getExecutingThread()
- .orElse(executingThread)
- .getStackTrace();
+ final CompletableFuture<?>[] outputFutures = new
CompletableFuture[consumableNotifyingPartitionWriters.length];
+ for(int i = 0; i < outputFutures.length; ++i) {
Review comment:
No need type cast.
If `AbstractInvokable` implements the interface of
`BackPressureSampleableTask`, while calling `Task#isBackPressured` ->
`invokable#isBackPressured`. And in the `StreamTask#isBackPressured`
implementation it would reuse the codes in my PR, for the
`BatchTask#isBackPressured` it can always return false as now.
The only concern is for `BatchTask#isBackPressured`, we make a consumption
that batch job is always using blocking partition which would never be
backpressured by downstream.
The current implementation would create the arrays every time, if the
trigger is not very frequent, the overhead can also be accepted I guess.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services