| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.oozie.action.ActionExecutor
public abstract class ActionExecutor
Base action executor class.
All the action executors should extend this class.
| Nested Class Summary | |
|---|---|
static interface | 
ActionExecutor.Context
Context information passed to the ActionExecutor methods.  | 
| Field Summary | |
|---|---|
static String | 
CONF_PREFIX
Configuration prefix for action executor (sub-classes) properties.  | 
static String | 
ERROR_OTHER
Error code used by convertException(java.lang.Exception) when there is not register error information for an exception. | 
static int | 
MAX_RETRIES
Define the default maximum number of retry attempts for transient errors (total attempts = 1 + MAX_RETRIES).  | 
static long | 
RETRY_INTERVAL
Define the default inteval in seconds between retries.  | 
| Constructor Summary | |
|---|---|
protected  | 
ActionExecutor(String type)
Create an action executor with default retry parameters.  | 
protected  | 
ActionExecutor(String type,
                             int retryAttempts,
                             long retryInterval)
Create an action executor.  | 
| Method Summary | |
|---|---|
abstract  void | 
check(ActionExecutor.Context context,
           org.apache.oozie.client.WorkflowAction action)
Check if an action has completed.  | 
protected  ActionExecutorException | 
convertException(Exception ex)
Utility method to handle exceptions in the start(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction), end(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction), kill(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction) and check(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction) methods
  It uses the error registry to convert exceptions to ActionExecutorExceptions. | 
static void | 
disableInit()
Disable action type initialization.  | 
static void | 
enableInit()
Enable action type initialization.  | 
abstract  void | 
end(ActionExecutor.Context context,
       org.apache.oozie.client.WorkflowAction action)
End an action after it has executed.  | 
 org.apache.hadoop.fs.Path | 
getActionDir(String jobId,
                         org.apache.oozie.client.WorkflowAction action,
                         String key,
                         boolean temp)
Return the path that will be used to store action specific data.  | 
protected  String | 
getActionDirPath(String jobId,
                                 org.apache.oozie.client.WorkflowAction action,
                                 String key,
                                 boolean temp)
Return the path that will be used to store action specific data  | 
protected  String | 
getActionSignal(org.apache.oozie.client.WorkflowAction.Status status)
Convenience method that return the signal for an Action based on the action status.  | 
 int | 
getMaxRetries()
Return the maximum number of retries for the action executor.  | 
 org.apache.hadoop.conf.Configuration | 
getOozieConf()
Return Oozie configuration.  | 
 String | 
getOozieRuntimeDir()
Return the runtime directory of the Oozie instance.  | 
 String | 
getOozieSystemId()
Return the system ID, this ID is defined in Oozie configuration.  | 
 long | 
getRetryInterval()
Return the retry interval for the action executor in seconds.  | 
 String | 
getType()
Return the action executor type.  | 
 void | 
initActionType()
Invoked once at system initialization time.  | 
abstract  boolean | 
isCompleted(String externalStatus)
Return if the external status indicates that the action has completed.  | 
abstract  void | 
kill(ActionExecutor.Context context,
         org.apache.oozie.client.WorkflowAction action)
Kill an action.  | 
protected  void | 
registerError(String exClass,
                           ActionExecutorException.ErrorType errorType,
                           String errorCode)
Register error handling information for an exception.  | 
static void | 
resetInitInfo()
Clear all init settings for all action types.  | 
 void | 
setMaxRetries(int maxRetries)
Set the maximum number of retries for the action executor.  | 
 void | 
setRetryInterval(long retryInterval)
Sets the retry interval for the action executor.  | 
abstract  void | 
start(ActionExecutor.Context context,
           org.apache.oozie.client.WorkflowAction action)
Start an action.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String CONF_PREFIX
public static final String ERROR_OTHER
convertException(java.lang.Exception) when there is not register error information for an exception.
public static final int MAX_RETRIES
public static final long RETRY_INTERVAL
| Constructor Detail | 
|---|
protected ActionExecutor(String type)
type - action executor type.
protected ActionExecutor(String type,
                         int retryAttempts,
                         long retryInterval)
type - action executor type.retryAttempts - retry attempts.retryInterval - retry interval, in seconds.| Method Detail | 
|---|
public static void resetInitInfo()
public static void enableInit()
public static void disableInit()
public void initActionType()
registerError(java.lang.String, org.apache.oozie.action.ActionExecutorException.ErrorType, java.lang.String) method to register
 all its possible errors.  Subclasses overriding must invoke super.
public String getOozieSystemId()
public String getOozieRuntimeDir()
public org.apache.hadoop.conf.Configuration getOozieConf()
protected void registerError(String exClass,
                             ActionExecutorException.ErrorType errorType,
                             String errorCode)
exClass - excpetion class name (to work in case of a particular exception not being in the classpath, needed
 to be able to handle multiple version of Hadoop  or other JARs used by executors with the same codebase).errorType - error type for the exception.errorCode - error code for the exception.public String getType()
public int getMaxRetries()
public void setMaxRetries(int maxRetries)
maxRetries - the maximum number of retries.public long getRetryInterval()
public void setRetryInterval(long retryInterval)
retryInterval - retry interval in seconds.protected ActionExecutorException convertException(Exception ex)
start(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction), end(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction), kill(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction) and check(org.apache.oozie.action.ActionExecutor.Context, org.apache.oozie.client.WorkflowAction) methods
  It uses the error registry to convert exceptions to ActionExecutorExceptions.
ex - exception to convert.
protected String getActionSignal(org.apache.oozie.client.WorkflowAction.Status status)
status - action status.
protected String getActionDirPath(String jobId,
                                  org.apache.oozie.client.WorkflowAction action,
                                  String key,
                                  boolean temp)
jobId - Worfklow IDaction - Actionkey - An Identifiertemp - temp directory flag
public org.apache.hadoop.fs.Path getActionDir(String jobId,
                                              org.apache.oozie.client.WorkflowAction action,
                                              String key,
                                              boolean temp)
jobId - Workflow IDaction - Actionkey - An identifiertemp - Temp directory flag
public abstract void start(ActionExecutor.Context context,
                           org.apache.oozie.client.WorkflowAction action)
                    throws ActionExecutorException
ActionExecutor.Context.setStartData(java.lang.String, java.lang.String, java.lang.String) method must be called within this method.  If the
 action has completed, the ActionExecutor.Context.setExecutionData(java.lang.String, java.util.Properties) method must be called within this method.
context - executor context.action - the action to start.
ActionExecutorException - thrown if the action could not start.
public abstract void end(ActionExecutor.Context context,
                         org.apache.oozie.client.WorkflowAction action)
                  throws ActionExecutorException
ActionExecutor.Context.setEndData(org.apache.oozie.client.WorkflowAction.Status, java.lang.String) method must be called within this
 method.
context - executor context.action - the action to end.
ActionExecutorException - thrown if the action could not end.
public abstract void check(ActionExecutor.Context context,
                           org.apache.oozie.client.WorkflowAction action)
                    throws ActionExecutorException
ActionExecutor.Context.setExecutionData(java.lang.String, java.util.Properties) method must be called within this method.  If the action
 has not completed, the ActionExecutor.Context.setExternalStatus(java.lang.String) method must be called within this method.
context - executor context.action - the action to end.
ActionExecutorException - thrown if the action could not be checked.
public abstract void kill(ActionExecutor.Context context,
                          org.apache.oozie.client.WorkflowAction action)
                   throws ActionExecutorException
ActionExecutor.Context.setEndData(org.apache.oozie.client.WorkflowAction.Status, java.lang.String) method must be called within this method.
context - executor context.action - the action to kill.
ActionExecutorException - thrown if the action could not be killed.public abstract boolean isCompleted(String externalStatus)
externalStatus - external status to check.
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||