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/07 08:17:11 UTC
falcon git commit: FALCON-1725 Falcon API shows results in ascending
order in native scheduler (by Pallavi Rao)
Repository: falcon
Updated Branches:
refs/heads/0.9 2cbf5030c -> 935a1731d
FALCON-1725 Falcon API shows results in ascending order in 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/935a1731
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/935a1731
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/935a1731
Branch: refs/heads/0.9
Commit: 935a1731dfb2ae6c5241d655bfd043b2be4d8653
Parents: 2cbf503
Author: Pallavi Rao <pa...@inmobi.com>
Authored: Thu Jan 7 12:46:48 2016 +0530
Committer: Pallavi Rao <pa...@inmobi.com>
Committed: Thu Jan 7 12:46:48 2016 +0530
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../falcon/workflow/engine/FalconWorkflowEngine.java | 14 ++++++++++++++
.../resource/InstanceSchedulerManagerJerseyIT.java | 5 ++++-
3 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/falcon/blob/935a1731/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fbb5dc9..ca67e35 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -92,6 +92,8 @@ Proposed Release Version: 0.9
OPTIMIZATIONS
BUG FIXES
+ FALCON-1725 Falcon API shows results in ascending order in native scheduler (Pallavi Rao)
+
FALCON-1720 Rerun API does not rerun succeeded instances (Pavan Kolamuri via Pallavi Rao)
FALCON-1719 Retry does not update the state of the instance in the database (Pavan Kolamuri via Pallavi Rao)
http://git-wip-us.apache.org/repos/asf/falcon/blob/935a1731/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java
----------------------------------------------------------------------
diff --git a/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java b/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java
index 8306b34..c9e6da4 100644
--- a/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java
+++ b/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java
@@ -217,6 +217,10 @@ public class FalconWorkflowEngine extends AbstractWorkflowEngine {
}
}
+ // To ensure compatibility with OozieWorkflowEngine.
+ // Also because users would like to see the most recent instances first.
+ sortInstancesDescBySequence(instancesToActOn);
+
List<InstancesResult.Instance> instances = new ArrayList<>();
for (ExecutionInstance ins : instancesToActOn) {
instanceCount++;
@@ -243,6 +247,16 @@ public class FalconWorkflowEngine extends AbstractWorkflowEngine {
return instancesResult;
}
+ // Sort the instances in descending order of their sequence, so the latest is on top.
+ private void sortInstancesDescBySequence(List<ExecutionInstance> instancesToActOn) {
+ Collections.sort(instancesToActOn, new Comparator<ExecutionInstance>() {
+ @Override
+ public int compare(ExecutionInstance o1, ExecutionInstance o2) {
+ return o2.getInstanceSequence() - o1.getInstanceSequence();
+ }
+ });
+ }
+
private List<String> getIncludedClusters(Properties props, String clustersType) {
String clusters = props == null ? "" : props.getProperty(clustersType, "");
List<String> clusterList = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/falcon/blob/935a1731/webapp/src/test/java/org/apache/falcon/resource/InstanceSchedulerManagerJerseyIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/resource/InstanceSchedulerManagerJerseyIT.java b/webapp/src/test/java/org/apache/falcon/resource/InstanceSchedulerManagerJerseyIT.java
index 18c36ff..698580b 100644
--- a/webapp/src/test/java/org/apache/falcon/resource/InstanceSchedulerManagerJerseyIT.java
+++ b/webapp/src/test/java/org/apache/falcon/resource/InstanceSchedulerManagerJerseyIT.java
@@ -139,6 +139,9 @@ public class InstanceSchedulerManagerJerseyIT extends AbstractSchedulerManagerJe
InstancesResult result = falconUnitClient.getStatusOfInstances(EntityType.PROCESS.toString(), processName,
START_INSTANCE, "2012-04-23T00:00Z", colo, null, null, null, null, 0, 3, null);
- Assert.assertEquals(3, result.getInstances().length);
+ Assert.assertEquals(result.getInstances().length, 3);
+ // Ensure the latest instance is on top and oldest at the bottom
+ Assert.assertEquals(result.getInstances()[0].getInstance(), "2012-04-22T00:00Z");
+ Assert.assertEquals(result.getInstances()[2].getInstance(), START_INSTANCE);
}
}