sanha commented on a change in pull request #11: [NEMO-42] Make SchedulerRunner 
reactive, Ensure reverse-topological ordering in scheduling
URL: https://github.com/apache/incubator-nemo/pull/11#discussion_r176907122
 
 

 ##########
 File path: 
runtime/master/src/main/java/edu/snu/nemo/runtime/master/scheduler/SourceLocationAwareSchedulingPolicy.java
 ##########
 @@ -82,40 +69,21 @@ public long getScheduleTimeoutMs() {
   @Override
   public boolean scheduleTaskGroup(final ScheduledTaskGroup scheduledTaskGroup,
                                    final JobStateManager jobStateManager) {
-    lock.lock();
+    Set<String> sourceLocations = Collections.emptySet();
     try {
-      Set<String> sourceLocations = Collections.emptySet();
-      try {
-        sourceLocations = 
getSourceLocations(scheduledTaskGroup.getLogicalTaskIdToReadable().values());
-      } catch (final UnsupportedOperationException e) {
-        // do nothing
-      } catch (final Exception e) {
-        LOG.warn(String.format("Exception while trying to get source location 
for %s",
-            scheduledTaskGroup.getTaskGroupId()), e);
-      }
-      if (sourceLocations.size() == 0) {
-        // No source location information found, fall back to the 
RoundRobinSchedulingPolicy
-        return 
roundRobinSchedulingPolicy.scheduleTaskGroup(scheduledTaskGroup, 
jobStateManager);
-      }
-
-      long timeoutInNanoseconds = scheduleTimeoutMs * 1000000;
-      while (timeoutInNanoseconds > 0) {
-        if (scheduleToLocalNode(scheduledTaskGroup, jobStateManager, 
sourceLocations)) {
-          return true;
-        }
-        try {
-          timeoutInNanoseconds = 
moreExecutorsAvailableCondition.awaitNanos(timeoutInNanoseconds);
-          // Signals on this condition does not necessarily guarantee that the 
added executor helps scheduling the
-          // TaskGroup we are interested in. We need to await again if the 
consequent scheduling attempt still fails,
-          // until we spend the time budget specified.
-        } catch (final InterruptedException e) {
-          throw new SchedulingException(e);
-        }
-      }
-      return false;
-    } finally {
-      lock.unlock();
+      sourceLocations = 
getSourceLocations(scheduledTaskGroup.getLogicalTaskIdToReadable().values());
+    } catch (final UnsupportedOperationException e) {
+      // do nothing
+    } catch (final Exception e) {
+      LOG.warn(String.format("Exception while trying to get source location 
for %s",
 
 Review comment:
   I'd throw the caught exception rather than ignoring it.

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