You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by pa...@apache.org on 2016/01/04 10:45:59 UTC

falcon git commit: FALCON-1709 FIFO order is not followed when scheduled using native scheduler (by Pallavi Rao)

Repository: falcon
Updated Branches:
  refs/heads/0.9 8237d1cf7 -> a7840466b


FALCON-1709 FIFO order is not followed when scheduled using native scheduler (by Pallavi Rao)


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/a7840466
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/a7840466
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/a7840466

Branch: refs/heads/0.9
Commit: a7840466b3167958e528b091a532710d32f8c307
Parents: 8237d1c
Author: Pallavi Rao <pa...@inmobi.com>
Authored: Mon Jan 4 15:15:49 2016 +0530
Committer: Pallavi Rao <pa...@inmobi.com>
Committed: Mon Jan 4 15:15:49 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt                                               |  2 ++
 .../notification/service/impl/SchedulerService.java       | 10 ++++++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/a7840466/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ba21787..9c59ed6 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -90,6 +90,8 @@ Proposed Release Version: 0.9
   OPTIMIZATIONS
 
   BUG FIXES
+    FALCON-1709 FIFO order is not followed when scheduled using native scheduler (Pallavi Rao)
+
     FALCON-1711 DependencyInstance twiki does not contain correct documentation	(Praveen Adlakha via Pallavi Rao)
 
     FALCON-1702 Exception thrown by workflow status listeners on success notification(Pallavi Rao via Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/a7840466/scheduler/src/main/java/org/apache/falcon/notification/service/impl/SchedulerService.java
----------------------------------------------------------------------
diff --git a/scheduler/src/main/java/org/apache/falcon/notification/service/impl/SchedulerService.java b/scheduler/src/main/java/org/apache/falcon/notification/service/impl/SchedulerService.java
index 57a41c8..f5a7c86 100644
--- a/scheduler/src/main/java/org/apache/falcon/notification/service/impl/SchedulerService.java
+++ b/scheduler/src/main/java/org/apache/falcon/notification/service/impl/SchedulerService.java
@@ -101,6 +101,8 @@ public class SchedulerService implements FalconNotificationService, Notification
         if (obj != null) {
             instancesToIgnore.invalidate(request.getInstance().getId());
         }
+        LOG.debug("Received request to schedule instance {} with sequence {}.", request.getInstance().getId(),
+                request.getInstance().getInstanceSequence());
         runQueue.execute(new InstanceRunner(request));
     }
 
@@ -281,6 +283,10 @@ public class SchedulerService implements FalconNotificationService, Notification
             }
         }
 
+        public ExecutionInstance getInstance() {
+            return instance;
+        }
+
         @Override
         public void run() {
             try {
@@ -387,6 +393,10 @@ public class SchedulerService implements FalconNotificationService, Notification
     private static class PriorityComparator<T extends InstanceRunner> implements Comparator<T>, Serializable {
         @Override
         public int compare(T o1, T o2) {
+            // If both instances have same priority, go by instance sequence.
+            if (o1.getPriority() == o2.getPriority()) {
+                return o1.getInstance().getInstanceSequence() - o2.getInstance().getInstanceSequence();
+            }
             return o1.getPriority() - o2.getPriority();
         }
     }