This project has retired. For details please refer to its Attic page.
ActionCommand (Oozie Core 3.1.3-incubating API)

org.apache.oozie.command.wf
Class ActionCommand<T>

java.lang.Object
  extended by org.apache.oozie.command.Command<T,WorkflowStore>
      extended by org.apache.oozie.command.wf.WorkflowCommand<Void>
          extended by org.apache.oozie.command.wf.ActionCommand<T>
All Implemented Interfaces:
Callable<Void>, XCallable<Void>
Direct Known Subclasses:
ActionCheckCommand, ActionEndCommand, ActionKillCommand, ActionStartCommand

public abstract class ActionCommand<T>
extends WorkflowCommand<Void>

Base class for Action execution commands. Provides common functionality to handle different types of errors while attempting to start or end an action.


Nested Class Summary
static class ActionCommand.ActionExecutorContext
           
 
Field Summary
protected static String INSTR_FAILED_JOBS_COUNTER
           
protected static String RECOVERY_ID_SEPARATOR
           
 
Fields inherited from class org.apache.oozie.command.Command
dryrun, instrumentation, LOCK_FAILURE_REQUEUE_INTERVAL
 
Constructor Summary
ActionCommand(String name, String type, int priority)
           
 
Method Summary
protected  void addActionCron(String type, Instrumentation.Cron cron)
           
 void failJob(ActionExecutor.Context context)
           
protected  void handleError(ActionExecutor.Context context, ActionExecutor executor, String message, boolean isStart, org.apache.oozie.client.WorkflowAction.Status status)
          Takes care of errors.
protected  void handleNonTransient(WorkflowStore store, ActionExecutor.Context context, ActionExecutor executor, org.apache.oozie.client.WorkflowAction.Status status)
          Takes care of non transient failures.
protected  boolean handleTransient(ActionExecutor.Context context, ActionExecutor executor, org.apache.oozie.client.WorkflowAction.Status status)
          Takes care of Transient failures.
protected  void incrActionCounter(String type, int count)
           
 
Methods inherited from class org.apache.oozie.command.wf.WorkflowCommand
getStoreClass
 
Methods inherited from class org.apache.oozie.command.Command
call, call, execute, getCreatedTime, getInstrumentation, getKey, getName, getPriority, getType, incrCommandCounter, incrJobCounter, incrJobCounter, lock, logQueueCallableFalse, queueCallable, queueCallable, queueCallable, queueCallableForException, resetLogInfoAction, resetLogInfoWorkflow, setLogInfo, setLogInfo, setLogInfo, setLogInfo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTR_FAILED_JOBS_COUNTER

protected static final String INSTR_FAILED_JOBS_COUNTER
See Also:
Constant Field Values

RECOVERY_ID_SEPARATOR

protected static final String RECOVERY_ID_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

ActionCommand

public ActionCommand(String name,
                     String type,
                     int priority)
Method Detail

handleTransient

protected boolean handleTransient(ActionExecutor.Context context,
                                  ActionExecutor executor,
                                  org.apache.oozie.client.WorkflowAction.Status status)
                           throws StoreException,
                                  CommandException
Takes care of Transient failures. Sets the action status to retry and increments the retry count if not enough attempts have been made. Otherwise returns false.

Parameters:
context - the execution context.
executor - the executor instance being used.
status - the status to be set for the action.
Returns:
true if the action is scheduled for another retry. false if the number of retries has exceeded the maximum number of configured retries.
Throws:
StoreException
CommandException

handleNonTransient

protected void handleNonTransient(WorkflowStore store,
                                  ActionExecutor.Context context,
                                  ActionExecutor executor,
                                  org.apache.oozie.client.WorkflowAction.Status status)
                           throws StoreException,
                                  CommandException
Takes care of non transient failures. The job is suspended, and the state of the action is changed to *MANUAL and set pending flag of action to false

Parameters:
store - WorkflowStore
context - the execution context.
executor - the executor instance being used.
status - the status to be set for the action.
Throws:
StoreException
CommandException

handleError

protected void handleError(ActionExecutor.Context context,
                           ActionExecutor executor,
                           String message,
                           boolean isStart,
                           org.apache.oozie.client.WorkflowAction.Status status)
                    throws CommandException
Takes care of errors.

For errors while attempting to start the action, the job state is updated and an ActionEndCommand is queued.

For errors while attempting to end the action, the job state is updated.

Parameters:
context - the execution context.
executor - the executor instance being used.
message -
isStart - whether the error was generated while starting or ending an action.
status - the status to be set for the action.
Throws:
CommandException

failJob

public void failJob(ActionExecutor.Context context)
             throws CommandException
Throws:
CommandException

incrActionCounter

protected void incrActionCounter(String type,
                                 int count)

addActionCron

protected void addActionCron(String type,
                             Instrumentation.Cron cron)


Copyright © 2012 Apache Software Foundation. All Rights Reserved.