falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject [1/2] FALCON-240 Instance status from CLI on a feed doesn't give the retention details. Contributed by pavan kumar kolamuri
Date Wed, 21 May 2014 09:31:38 GMT
Repository: incubator-falcon
Updated Branches:
  refs/heads/master 5afbf3585 -> 089ecf419


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/089ecf41/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java b/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
index fd3cd51..bdf5e1b 100644
--- a/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
+++ b/webapp/src/main/java/org/apache/falcon/resource/InstanceManager.java
@@ -18,6 +18,7 @@
 
 package org.apache.falcon.resource;
 
+import org.apache.falcon.LifeCycle;
 import org.apache.falcon.monitors.Dimension;
 import org.apache.falcon.monitors.Monitored;
 
@@ -25,6 +26,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
+import java.util.List;
 
 /**
  * This class provides RESTful API for the lifecycle management of the entity instances.
@@ -37,10 +39,12 @@ public class InstanceManager extends AbstractInstanceManager {
     @Produces(MediaType.APPLICATION_JSON)
     @Monitored(event = "running")
     @Override
-    public InstancesResult getRunningInstances(@PathParam("type") String type,
-                                               @PathParam("entity") String entity,
-                                               @QueryParam("colo") String colo) {
-        return super.getRunningInstances(type, entity, colo);
+    public InstancesResult getRunningInstances(
+            @Dimension("type") @PathParam("type") String type,
+            @Dimension("entity") @PathParam("entity") String entity,
+            @Dimension("colo") @QueryParam("colo") String colo,
+            @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles)
{
+        return super.getRunningInstances(type, entity, colo, lifeCycles);
     }
 
     @GET
@@ -52,8 +56,9 @@ public class InstanceManager extends AbstractInstanceManager {
                                      @Dimension("entity") @PathParam("entity") String entity,
                                      @Dimension("start-time") @QueryParam("start") String
startStr,
                                      @Dimension("end-time") @QueryParam("end") String endStr,
-                                     @Dimension("colo") @QueryParam("colo") String colo)
{
-        return super.getStatus(type, entity, startStr, endStr, colo);
+                                     @Dimension("colo") @QueryParam("colo") String colo,
+                                     @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle>
lifeCycles) {
+        return super.getStatus(type, entity, startStr, endStr, colo, lifeCycles);
     }
 
     @GET
@@ -64,8 +69,9 @@ public class InstanceManager extends AbstractInstanceManager {
                                      @Dimension("entity") @PathParam("entity") String entity,
                                      @Dimension("start-time") @QueryParam("start") String
startStr,
                                      @Dimension("end-time") @QueryParam("end") String endStr,
-                                     @Dimension("colo") @QueryParam("colo") String colo)
{
-        return super.getSummary(type, entity, startStr, endStr, colo);
+                                     @Dimension("colo") @QueryParam("colo") String colo,
+                                     @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle>
lifeCycles) {
+        return super.getSummary(type, entity, startStr, endStr, colo, lifeCycles);
     }
 
     @GET
@@ -79,8 +85,9 @@ public class InstanceManager extends AbstractInstanceManager {
             @Dimension("start-time") @QueryParam("start") String startStr,
             @Dimension("end-time") @QueryParam("end") String endStr,
             @Dimension("colo") @QueryParam("colo") String colo,
-            @Dimension("run-id") @QueryParam("runid") String runId) {
-        return super.getLogs(type, entity, startStr, endStr, colo, runId);
+            @Dimension("run-id") @QueryParam("runid") String runId,
+            @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles)
{
+        return super.getLogs(type, entity, startStr, endStr, colo, runId, lifeCycles);
     }
 
 
@@ -94,8 +101,9 @@ public class InstanceManager extends AbstractInstanceManager {
                                         @Dimension("entity") @PathParam("entity") String
entity,
                                         @Dimension("start-time") @QueryParam("start") String
startStr,
                                         @Dimension("end-time") @QueryParam("end") String
endStr,
-                                        @Dimension("colo") @QueryParam("colo") String colo)
{
-        return super.killInstance(request, type, entity, startStr, endStr, colo);
+                                        @Dimension("colo") @QueryParam("colo") String colo,
+                                        @Dimension("lifecycle") @QueryParam("lifecycle")
List<LifeCycle> lifeCycles) {
+        return super.killInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
     }
 
     @POST
@@ -103,13 +111,15 @@ public class InstanceManager extends AbstractInstanceManager {
     @Produces(MediaType.APPLICATION_JSON)
     @Monitored(event = "suspend-instance")
     @Override
-    public InstancesResult suspendInstance(@Context HttpServletRequest request,
-                                           @Dimension("type") @PathParam("type") String type,
-                                           @Dimension("entity") @PathParam("entity") String
entity,
-                                           @Dimension("start-time") @QueryParam("start")
String startStr,
-                                           @Dimension("end-time") @QueryParam("end") String
endStr,
-                                           @Dimension("colo") @QueryParam("colo") String
colo) {
-        return super.suspendInstance(request, type, entity, startStr, endStr, colo);
+    public InstancesResult suspendInstance(
+            @Context HttpServletRequest request,
+            @Dimension("type") @PathParam("type") String type,
+            @Dimension("entity") @PathParam("entity") String entity,
+            @Dimension("start-time") @QueryParam("start") String startStr,
+            @Dimension("end-time") @QueryParam("end") String endStr,
+            @Dimension("colo") @QueryParam("colo") String colo,
+            @Dimension("lifecycle") @QueryParam("lifecycle") List<LifeCycle> lifeCycles)
{
+        return super.suspendInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
     }
 
     @POST
@@ -122,8 +132,9 @@ public class InstanceManager extends AbstractInstanceManager {
                                           @Dimension("entity") @PathParam("entity") String
entity,
                                           @Dimension("start-time") @QueryParam("start") String
startStr,
                                           @Dimension("end-time") @QueryParam("end") String
endStr,
-                                          @Dimension("colo") @QueryParam("colo") String colo)
{
-        return super.resumeInstance(request, type, entity, startStr, endStr, colo);
+                                          @Dimension("colo") @QueryParam("colo") String colo,
+                                          @Dimension("lifecycle") @QueryParam("lifecycle")
List<LifeCycle> lifeCycles) {
+        return super.resumeInstance(request, type, entity, startStr, endStr, colo, lifeCycles);
     }
 
     @POST
@@ -136,7 +147,8 @@ public class InstanceManager extends AbstractInstanceManager {
                                          @Dimension("start-time") @QueryParam("start") String
startStr,
                                          @Dimension("end-time") @QueryParam("end") String
endStr,
                                          @Context HttpServletRequest request,
-                                         @Dimension("colo") @QueryParam("colo") String colo)
{
-        return super.reRunInstance(type, entity, startStr, endStr, request, colo);
+                                         @Dimension("colo") @QueryParam("colo") String colo,
+                                         @Dimension("lifecycle") @QueryParam("lifecycle")
List<LifeCycle> lifeCycles) {
+        return super.reRunInstance(type, entity, startStr, endStr, request, colo, lifeCycles);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/089ecf41/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java b/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
index b6c5054..9471e27 100644
--- a/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
+++ b/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
@@ -18,6 +18,7 @@
 
 package org.apache.falcon.cli;
 
+import org.apache.falcon.entity.v0.SchemaHelper;
 import org.apache.falcon.resource.TestContext;
 import org.apache.falcon.util.OozieTestUtils;
 import org.testng.Assert;
@@ -29,6 +30,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.util.Date;
 import java.util.Map;
 
 /**
@@ -363,9 +365,24 @@ public class FalconCLIIT {
                         + overlay.get("processName")));
 
         Assert.assertEquals(0,
+                executeWithURL("instance -running -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start " + SchemaHelper.getDateFormat().format(new Date())));
+
+        Assert.assertEquals(0,
                 executeWithURL("instance -status -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE));
+        Assert.assertEquals(0,
+                executeWithURL("instance -status -type feed -lifecycle eviction,replication
-name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
+
+        Assert.assertEquals(0,
+                executeWithURL("instance -status -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
+
     }
 
     public void testInstanceRunningAndSummaryCommands() throws Exception {
@@ -380,6 +397,7 @@ public class FalconCLIIT {
         Assert.assertEquals(0,
                 executeWithURL("entity -schedule -type feed -name "
                         + overlay.get("outputFeedName")));
+
         OozieTestUtils.waitForProcessWFtoStart(context);
 
         Assert.assertEquals(0,
@@ -395,6 +413,11 @@ public class FalconCLIIT {
                 executeWithURL("instance -summary -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE));
+
+        Assert.assertEquals(0,
+                executeWithURL("instance -summary -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
     }
 
 
@@ -407,6 +430,9 @@ public class FalconCLIIT {
                 executeWithURL("entity -schedule -type process -name "
                         + overlay.get("processName")));
 
+        Assert.assertEquals(0,
+                executeWithURL("entity -schedule -type feed -name "
+                        + overlay.get("outputFeedName")));
 
         Assert.assertEquals(0,
                 executeWithURL("instance -suspend -type process -name "
@@ -414,9 +440,19 @@ public class FalconCLIIT {
                         + " -start " + START_INSTANCE + " -end " + START_INSTANCE));
 
         Assert.assertEquals(0,
+                executeWithURL("instance -suspend -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
+
+        Assert.assertEquals(0,
                 executeWithURL("instance -resume -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE + " -end " + START_INSTANCE));
+
+        Assert.assertEquals(0,
+                executeWithURL("instance -resume -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
     }
 
     private static final String START_INSTANCE = "2012-04-20T00:00Z";
@@ -430,6 +466,10 @@ public class FalconCLIIT {
                 executeWithURL("entity -schedule -type process -name "
                         + overlay.get("processName")));
 
+        Assert.assertEquals(0,
+                executeWithURL("entity -schedule -type feed -name "
+                        + overlay.get("outputFeedName")));
+
         OozieTestUtils.waitForProcessWFtoStart(context);
         Assert.assertEquals(
                 0,
@@ -437,12 +477,23 @@ public class FalconCLIIT {
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE + " -end " + START_INSTANCE));
 
+        Assert.assertEquals(0,
+                executeWithURL("instance -kill -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
+
         Assert.assertEquals(
                 0,
                 executeWithURL("instance -rerun -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE + " -file "
                         + createTempJobPropertiesFile()));
+
+        Assert.assertEquals(0,
+                executeWithURL("instance -rerun -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())
+                        + " -file "+ createTempJobPropertiesFile()));
     }
 
     public void testContinue() throws Exception {
@@ -454,18 +505,33 @@ public class FalconCLIIT {
                 executeWithURL("entity -schedule -type process -name "
                         + overlay.get("processName")));
 
+        Assert.assertEquals(0,
+                executeWithURL("entity -schedule -type feed -name "
+                        + overlay.get("outputFeedName")));
+
         OozieTestUtils.waitForProcessWFtoStart(context);
+
         Assert.assertEquals(
                 0,
                 executeWithURL("instance -kill -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE + " -end " + START_INSTANCE));
 
+        Assert.assertEquals(0,
+                executeWithURL("instance -kill -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
+
         Assert.assertEquals(
                 0,
                 executeWithURL("instance -continue -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE));
+
+        Assert.assertEquals(0,
+                executeWithURL("instance -continue -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
     }
 
     public void testInvalidCLIInstanceCommands() throws Exception {
@@ -539,9 +605,19 @@ public class FalconCLIIT {
                         + overlay.get("processName")));
 
         Assert.assertEquals(0,
+                executeWithURL("entity -schedule -type feed -name "
+                        + overlay.get("outputFeedName")));
+
+        Assert.assertEquals(0,
                 executeWithURL("instance -logs -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE + " -end " + START_INSTANCE));
+
+        Assert.assertEquals(0,
+                executeWithURL("instance -logs -type feed -lifecycle eviction -name "
+                        + overlay.get("outputFeedName")
+                        + " -start "+ SchemaHelper.getDateFormat().format(new Date())));
+
     }
 
     private int executeWithURL(String command) throws Exception {


Mime
View raw message