wonook commented on a change in pull request #57: [NEMO-73] SchedulingPolicy as 
Vertex-level Execution Property
URL: https://github.com/apache/incubator-nemo/pull/57#discussion_r198735439
 
 

 ##########
 File path: 
runtime/master/src/main/java/edu/snu/nemo/runtime/master/scheduler/MinOccupancyFirstSchedulingPolicy.java
 ##########
 @@ -44,28 +39,20 @@
   public MinOccupancyFirstSchedulingPolicy() {
   }
 
-  /**
-   * @param executorRepresenterSet Set of {@link ExecutorRepresenter} to be 
filtered by the occupancy of the Executors.
-   * @param task {@link Task} to be scheduled.
-   * @return filtered Set of {@link ExecutorRepresenter}.
-   */
   @Override
-  public Set<ExecutorRepresenter> filterExecutorRepresenters(final 
Set<ExecutorRepresenter> executorRepresenterSet,
-                                                             final Task task) {
+  public ExecutorRepresenter selectExecutor(final 
Collection<ExecutorRepresenter> executors, final Task task) {
     final OptionalInt minOccupancy =
-        executorRepresenterSet.stream()
+        executors.stream()
         .map(executor -> executor.getRunningTasks().size())
         .mapToInt(i -> i).min();
 
     if (!minOccupancy.isPresent()) {
-      return Collections.emptySet();
+      throw new RuntimeException("Cannot find min occupancy");
     }
 
-    final Set<ExecutorRepresenter> candidateExecutors =
-        executorRepresenterSet.stream()
+    return executors.stream()
         .filter(executor -> executor.getRunningTasks().size() == 
minOccupancy.getAsInt())
-        .collect(Collectors.toSet());
-
-    return candidateExecutors;
+        .findFirst()
+        .get();
 
 Review comment:
   
http://cmsbuild.snu.ac.kr:9000/project/issues?id=edu.snu.nemo%3Anemo-project&open=AWRFTqlh9Qxzkc5KlYmZ&resolved=false&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&sinceLeakPeriod=true&types=BUG

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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