org.apache.oozie.command.wf
Class ActionXCommand<T>
java.lang.Object
org.apache.oozie.command.XCommand<T>
org.apache.oozie.command.wf.WorkflowXCommand<Void>
org.apache.oozie.command.wf.ActionXCommand<T>
- All Implemented Interfaces:
- Callable<Void>, XCallable<Void>
- Direct Known Subclasses:
- ActionCheckXCommand, ActionEndXCommand, ActionKillXCommand, ActionStartXCommand
public abstract class ActionXCommand<T>
- extends WorkflowXCommand<Void>
Base class for Action execution commands. Provides common functionality to handle different types of errors while
attempting to start or end an action.
Method Summary |
protected void |
addActionCron(String type,
Instrumentation.Cron cron)
|
void |
failJob(ActionExecutor.Context context)
Fail the job due to failed action |
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(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.XCommand |
call, eagerLoadState, eagerVerifyPrecondition, execute, getCreatedTime, getEntityKey, getInstrumentation, getKey, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, isLockRequired, isReQueueRequired, loadState, queue, queue, resetUsed, verifyPrecondition |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
ActionXCommand
public ActionXCommand(String name,
String type,
int priority)
handleTransient
protected boolean handleTransient(ActionExecutor.Context context,
ActionExecutor executor,
org.apache.oozie.client.WorkflowAction.Status status)
throws 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:
CommandException
- thrown if unable to handle transient
handleNonTransient
protected void handleNonTransient(ActionExecutor.Context context,
ActionExecutor executor,
org.apache.oozie.client.WorkflowAction.Status status)
throws 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:
context
- the execution context.executor
- the executor instance being used.status
- the status to be set for the action.
- Throws:
CommandException
- thrown if unable to suspend job
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
- thrown if unable to handle action error
failJob
public void failJob(ActionExecutor.Context context)
throws CommandException
- Fail the job due to failed action
- Parameters:
context
- the execution context.
- Throws:
CommandException
- thrown if unable to fail job
incrActionCounter
protected void incrActionCounter(String type,
int count)
addActionCron
protected void addActionCron(String type,
Instrumentation.Cron cron)
Copyright © 2011 Yahoo. All Rights Reserved.