eaglewatcherwb commented on a change in pull request #8603: 
[FLINK-12608][runtime] Add getVertexOrThrow and
URL: https://github.com/apache/flink/pull/8603#discussion_r293263618
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/strategy/SchedulingTopology.java
 ##########
 @@ -43,11 +43,33 @@
         */
        Optional<SchedulingExecutionVertex> getVertex(ExecutionVertexID 
executionVertexId);
 
+       /**
+        * Looks up the {@link SchedulingExecutionVertex} for the given {@link 
ExecutionVertexID}.
+        *
+        * @param executionVertexId identifying the respective scheduling vertex
+        * @return The respective scheduling vertex or throw {@link Exception} 
if the vertex does not exist
+        */
+       default SchedulingExecutionVertex getVertexOrThrow(ExecutionVertexID 
executionVertexId) {
+               return getVertex(executionVertexId).orElseThrow(
+                               () -> new IllegalArgumentException("can not 
find vertex: " + executionVertexId));
+       }
+
        /**
         * Looks up the {@link SchedulingResultPartition} for the given {@link 
IntermediateResultPartitionID}.
         *
         * @param intermediateResultPartitionId identifying the respective 
scheduling result partition
         * @return Optional containing the respective scheduling result 
partition or none if the partition does not exist
         */
        Optional<SchedulingResultPartition> 
getResultPartition(IntermediateResultPartitionID intermediateResultPartitionId);
+
+       /**
+        * Looks up the {@link SchedulingResultPartition} for the given {@link 
IntermediateResultPartitionID}.
+        *
+        * @param intermediateResultPartitionId identifying the respective 
scheduling result partition
+        * @return The respective scheduling result partition or throw {@link 
Exception} if the partition does not exist
 
 Review comment:
   OK

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

Reply via email to