Author: kamrul
Date: Tue Apr  3 08:36:24 2012
New Revision: 1308748

URL: http://svn.apache.org/viewvc?rev=1308748&view=rev
Log:
OOZIE-796 Making the maximum number of job retrials configurable (Mohamed via 
Mohammad)

Modified:
    
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java
    incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
    
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/TestActionExecutor.java
    incubator/oozie/trunk/release-log.txt

Modified: 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java?rev=1308748&r1=1308747&r2=1308748&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java
 (original)
+++ 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java
 Tue Apr  3 08:36:24 2012
@@ -27,6 +27,7 @@ import org.apache.oozie.util.ParamChecke
 import org.apache.oozie.util.XLog;
 import org.apache.oozie.service.HadoopAccessorException;
 import org.apache.oozie.service.Services;
+import org.apache.oozie.servlet.CallbackServlet;
 
 import java.io.IOException;
 import java.net.URISyntaxException;
@@ -43,7 +44,9 @@ public abstract class ActionExecutor {
     /**
      * Configuration prefix for action executor (sub-classes) properties.
      */
-    public static final String CONF_PREFIX = "oozie.action.";
+       public static final String CONF_PREFIX = "oozie.action.";
+
+       public static final String MAX_RETRIES = CONF_PREFIX + "retries.max";
 
     /**
      * Error code used by {@link #convertException} when there is not register 
error information for an exception.
@@ -196,10 +199,6 @@ public abstract class ActionExecutor {
         public void setErrorInfo(String str, String exMsg);
     }
 
-    /**
-     * Define the default maximum number of retry attempts for transient 
errors (total attempts = 1 + MAX_RETRIES).
-     */
-    public static final int MAX_RETRIES = 3;
 
     /**
      * Define the default inteval in seconds between retries.
@@ -216,7 +215,7 @@ public abstract class ActionExecutor {
      * @param type action executor type.
      */
     protected ActionExecutor(String type) {
-        this(type, MAX_RETRIES, RETRY_INTERVAL);
+        this(type, RETRY_INTERVAL);
     }
 
     /**
@@ -226,9 +225,9 @@ public abstract class ActionExecutor {
      * @param retryAttempts retry attempts.
      * @param retryInterval retry interval, in seconds.
      */
-    protected ActionExecutor(String type, int retryAttempts, long 
retryInterval) {
+    protected ActionExecutor(String type, long retryInterval) {
         this.type = ParamChecker.notEmpty(type, "type");
-        this.maxRetries = retryAttempts;
+        this.maxRetries = getOozieConf().getInt(MAX_RETRIES, 3);
         this.retryInterval = retryInterval;
     }
 

Modified: incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/resources/oozie-default.xml?rev=1308748&r1=1308747&r2=1308748&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/resources/oozie-default.xml (original)
+++ incubator/oozie/trunk/core/src/main/resources/oozie-default.xml Tue Apr  3 
08:36:24 2012
@@ -1268,6 +1268,14 @@
     <!-- This is common to the subclasses action executors for map-reduce and 
pig -->
 
     <property>
+        <name>oozie.action.retries.max</name>
+        <value>3</value>
+        <description>
+           The number of retries for executing an action in case of failure
+        </description>
+    </property>
+
+    <property>
         <name>oozie.action.hadoop.delete.hdfs.tmp.dir</name>
         <value>false</value>
         <description>

Modified: 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/TestActionExecutor.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/TestActionExecutor.java?rev=1308748&r1=1308747&r2=1308748&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/TestActionExecutor.java
 (original)
+++ 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/TestActionExecutor.java
 Tue Apr  3 08:36:24 2012
@@ -17,6 +17,7 @@
  */
 package org.apache.oozie.action;
 
+import org.apache.oozie.service.Services;
 import org.apache.oozie.test.XTestCase;
 import org.apache.oozie.client.WorkflowAction;
 
@@ -27,8 +28,11 @@ public class TestActionExecutor extends 
 
     private static class MyActionExecutor extends ActionExecutor {
 
+               private int maxRetries;
+
         protected MyActionExecutor() {
             super("type");
+            this.maxRetries = getMaxRetries();
         }
 
         public void initActionType() {
@@ -39,12 +43,14 @@ public class TestActionExecutor extends 
         }
 
         protected MyActionExecutor(int maxRetries, int retryInterval) {
-            super("type", maxRetries, retryInterval);
+            super("type", retryInterval);
+            super.setMaxRetries(maxRetries);
+            this.maxRetries = maxRetries;
         }
 
         public void start(Context context, WorkflowAction action) throws 
ActionExecutorException {
             assertEquals("type", getType());
-            assertEquals(ActionExecutor.MAX_RETRIES, getMaxRetries());
+            assertEquals(this.maxRetries, getMaxRetries());
             assertEquals(ActionExecutor.RETRY_INTERVAL, getRetryInterval());
         }
 
@@ -65,6 +71,18 @@ public class TestActionExecutor extends 
         }
     }
 
+       @Override
+       protected void setUp() throws Exception {
+               super.setUp();
+               new Services().init();
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               Services.get().destroy();
+               super.tearDown();
+       }
+
     public void testActionExecutor() throws Exception {
         ActionExecutor.enableInit();
         ActionExecutor.resetInitInfo();

Modified: incubator/oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1308748&r1=1308747&r2=1308748&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Tue Apr  3 08:36:24 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.2.0 release
 
+OOZIE-796 Making the maximum number of job retrials configurable (Mohamed via 
Mohammad)
 OOZIE-741: the size of the workflow definition file (Mohamed via Mohammad)
 OOZIE-797 Action retry not reading default error code.(Mona via Mohammad)
 OOZIE-780: XConfiguration parser can't parse XML file with <include> element 
(Virag via Mohammad)


Reply via email to