sanha commented on a change in pull request #15: [NEMO-52] Make 
SchedulingPolicy Stackable
URL: https://github.com/apache/incubator-nemo/pull/15#discussion_r187832127
 
 

 ##########
 File path: 
runtime/master/src/main/java/edu/snu/nemo/runtime/master/scheduler/SchedulerRunner.java
 ##########
 @@ -122,10 +132,23 @@ public void run() {
         for (final ScheduledTaskGroup schedulableTaskGroup : 
schedulableTaskGroups) {
           final JobStateManager jobStateManager = 
jobStateManagers.get(schedulableTaskGroup.getJobId());
           LOG.debug("Trying to schedule {}...", 
schedulableTaskGroup.getTaskGroupId());
-          final boolean isScheduled =
-              schedulingPolicy.scheduleTaskGroup(schedulableTaskGroup, 
jobStateManager);
-          if (isScheduled) {
+
+          final Set<ExecutorRepresenter> runningExecutorRepresenter =
+              executorRegistry.getRunningExecutorIds().stream()
+              .map(executorId -> 
executorRegistry.getExecutorRepresenter(executorId))
+              .collect(Collectors.toSet());
+
+          final Set<ExecutorRepresenter> candidateExecutors =
+              
schedulingPolicy.filterExecutorRepresenters(runningExecutorRepresenter, 
schedulableTaskGroup);
+
+          if (candidateExecutors.size() != 0) {
             LOG.debug("Successfully scheduled {}", 
schedulableTaskGroup.getTaskGroupId());
+
+            
jobStateManager.onTaskGroupStateChanged(schedulableTaskGroup.getTaskGroupId(),
+                TaskGroupState.State.EXECUTING);
 
 Review comment:
   Please move the logging message and state change below the actual scheduling.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to