org.apache.oozie.command.coord
Class CoordRerunXCommand

java.lang.Object
  extended by org.apache.oozie.command.XCommand<T>
      extended by org.apache.oozie.command.TransitionXCommand<T>
          extended by org.apache.oozie.command.RerunTransitionXCommand<CoordinatorActionInfo>
              extended by org.apache.oozie.command.coord.CoordRerunXCommand
All Implemented Interfaces:
Callable<CoordinatorActionInfo>, XCallable<CoordinatorActionInfo>

public class CoordRerunXCommand
extends RerunTransitionXCommand<CoordinatorActionInfo>

Rerun coordinator actions by a list of dates or ids. User can specify if refresh or noCleanup.

The "rerunType" can be set as RestConstants.JOB_COORD_RERUN_DATE or RestConstants.JOB_COORD_RERUN_ACTION.

The "refresh" is used to indicate if user wants to refresh an action's input and output events.

The "noCleanup" is used to indicate if user wants to cleanup output events for given rerun actions


Field Summary
protected  boolean prevPending
           
 
Fields inherited from class org.apache.oozie.command.RerunTransitionXCommand
jobId, prevStatus, ret
 
Fields inherited from class org.apache.oozie.command.TransitionXCommand
insertList, job, updateList
 
Fields inherited from class org.apache.oozie.command.XCommand
DEFAULT_LOCK_TIMEOUT, DEFAULT_REQUEUE_DELAY, dryrun, instrumentation, INSTRUMENTATION_GROUP, LOG, logInfo
 
Constructor Summary
CoordRerunXCommand(String jobId, String rerunType, String scope, boolean refresh, boolean noCleanup)
          The constructor for class CoordRerunXCommand
 
Method Summary
protected  void eagerVerifyPrecondition()
          Verify the precondition for the command before obtaining a lock.
static List<CoordinatorActionBean> getCoordActions(String rerunType, String jobId, String scope)
          Get the list of actions for a given coordinator job
 String getEntityKey()
          Return the entity key for the command.
 org.apache.oozie.client.Job getJob()
          Get the Job for the command.
 XLog getLog()
          Get XLog log
protected  boolean isLockRequired()
          Indicate if the the command requires locking.
protected  void loadState()
          Load the necessary state to perform the precondition check and to execute the command.
 void notifyParent()
          This will be used to notify the parent about the status of that perticular job.
 void performWrites()
          This will be used to perform atomically all the writes within this command.
 void rerunChildren()
          Rerun actions associated with the job
 void transitToNext()
          Transit to the next status based on the result of the Job.
 void updateJob()
          Update the parent job.
protected  void verifyPrecondition()
          Verify the precondition for the command after a lock has been obtain, just before executing the command.
 
Methods inherited from class org.apache.oozie.command.RerunTransitionXCommand
eagerLoadState, execute, getPrevStatus
 
Methods inherited from class org.apache.oozie.command.TransitionXCommand
setJob
 
Methods inherited from class org.apache.oozie.command.XCommand
call, executeInterrupts, getCreatedTime, getInstrumentation, getKey, getLockTimeOut, getName, getPriority, getRequeueDelay, getType, inInterruptMode, isReQueueRequired, queue, queue, resetUsed, setInterruptMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prevPending

protected boolean prevPending
Constructor Detail

CoordRerunXCommand

public CoordRerunXCommand(String jobId,
                          String rerunType,
                          String scope,
                          boolean refresh,
                          boolean noCleanup)
The constructor for class CoordRerunXCommand

Parameters:
jobId - the job id
rerunType - rerun type RestConstants.JOB_COORD_RERUN_DATE or RestConstants.JOB_COORD_RERUN_ACTION
scope - the rerun scope for given rerunType separated by ","
refresh - true if user wants to refresh input/output dataset urls
noCleanup - false if user wants to cleanup output events for given rerun actions
Method Detail

getCoordActions

public static List<CoordinatorActionBean> getCoordActions(String rerunType,
                                                          String jobId,
                                                          String scope)
                                                   throws CommandException
Get the list of actions for a given coordinator job

Parameters:
rerunType - the rerun type (date, action)
jobId - the coordinator job id
scope - the date scope or action id scope
Returns:
the list of Coordinator actions
Throws:
CommandException

getEntityKey

public String getEntityKey()
Description copied from class: XCommand
Return the entity key for the command.

Specified by:
getEntityKey in interface XCallable<CoordinatorActionInfo>
Specified by:
getEntityKey in class XCommand<CoordinatorActionInfo>
Returns:
the entity key for the command.

isLockRequired

protected boolean isLockRequired()
Description copied from class: XCommand
Indicate if the the command requires locking.

Subclasses should override this method if they require locking.

Specified by:
isLockRequired in class XCommand<CoordinatorActionInfo>
Returns:
true/false

loadState

protected void loadState()
                  throws CommandException
Description copied from class: XCommand
Load the necessary state to perform the precondition check and to execute the command.

Subclasses must implement this method and load the state needed to do the precondition check and execute the command.

Specified by:
loadState in class XCommand<CoordinatorActionInfo>
Throws:
CommandException

verifyPrecondition

protected void verifyPrecondition()
                           throws CommandException,
                                  PreconditionException
Description copied from class: XCommand
Verify the precondition for the command after a lock has been obtain, just before executing the command.

Overrides:
verifyPrecondition in class RerunTransitionXCommand<CoordinatorActionInfo>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException

eagerVerifyPrecondition

protected void eagerVerifyPrecondition()
                                throws CommandException,
                                       PreconditionException
Description copied from class: XCommand
Verify the precondition for the command before obtaining a lock.

This implementation does a NOP.

A trivial implementation is calling {link #verifyPrecondition}.

Overrides:
eagerVerifyPrecondition in class RerunTransitionXCommand<CoordinatorActionInfo>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException

rerunChildren

public void rerunChildren()
                   throws CommandException
Description copied from class: RerunTransitionXCommand
Rerun actions associated with the job

Specified by:
rerunChildren in class RerunTransitionXCommand<CoordinatorActionInfo>
Throws:
CommandException - thrown if failed to rerun actions

getJob

public org.apache.oozie.client.Job getJob()
Description copied from class: TransitionXCommand
Get the Job for the command.

Overrides:
getJob in class TransitionXCommand<CoordinatorActionInfo>
Returns:
the job

notifyParent

public void notifyParent()
                  throws CommandException
Description copied from class: TransitionXCommand
This will be used to notify the parent about the status of that perticular job.

Specified by:
notifyParent in class TransitionXCommand<CoordinatorActionInfo>
Throws:
CommandException

updateJob

public void updateJob()
Description copied from class: TransitionXCommand
Update the parent job.

Specified by:
updateJob in class TransitionXCommand<CoordinatorActionInfo>

performWrites

public void performWrites()
                   throws CommandException
Description copied from class: TransitionXCommand
This will be used to perform atomically all the writes within this command.

Specified by:
performWrites in class TransitionXCommand<CoordinatorActionInfo>
Throws:
CommandException

getLog

public XLog getLog()
Description copied from class: XCommand
Get XLog log

Overrides:
getLog in class XCommand<CoordinatorActionInfo>
Returns:
XLog

transitToNext

public final void transitToNext()
Description copied from class: TransitionXCommand
Transit to the next status based on the result of the Job.

Overrides:
transitToNext in class RerunTransitionXCommand<CoordinatorActionInfo>


Copyright © 2013 Apache Software Foundation. All Rights Reserved.