tillrohrmann commented on a change in pull request #13592:
URL: https://github.com/apache/flink/pull/13592#discussion_r505258077



##########
File path: 
flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManagerDriver.java
##########
@@ -260,36 +259,44 @@ public void releaseResource(YarnWorkerNode workerNode) {
        //  Internal
        // 
------------------------------------------------------------------------
 
-       private void onContainersOfResourceAllocated(Resource resource, 
List<Container> containers) {
-               final List<TaskExecutorProcessSpec> 
pendingTaskExecutorProcessSpecs =
-                       
taskExecutorProcessSpecContainerResourceAdapter.getTaskExecutorProcessSpec(resource,
 matchingStrategy).stream()
-                               .flatMap(spec -> 
Collections.nCopies(getNumRequestedNotAllocatedWorkersFor(spec), spec).stream())
-                               .collect(Collectors.toList());
+       private void onContainersOfPriorityAllocated(Priority priority, 
List<Container> containers) {
+               final 
Optional<TaskExecutorProcessSpecContainerResourcePriorityAdapter.TaskExecutorProcessSpecAndResource>
 taskExecutorProcessSpecAndResourceOpt =
+                       
taskExecutorProcessSpecContainerResourcePriorityAdapter.getTaskExecutorProcessSpecAndResource(priority);
+
+               if (!taskExecutorProcessSpecAndResourceOpt.isPresent()) {
+                       log.warn("Receive {} containers with unrecognized 
priority {}. This should not happen.",
+                               containers.size(), priority.getPriority());
+                       for (Container container : containers) {
+                               returnExcessContainer(container);
+                       }
+                       return;
+               }

Review comment:
       Then I would vote for `checkState` to impose stricter conditions and to 
fail fast in case our assumptions are broken.




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


Reply via email to