org.apache.oozie
Class CoordinatorEngine

java.lang.Object
  extended by org.apache.oozie.BaseEngine
      extended by org.apache.oozie.CoordinatorEngine

public class CoordinatorEngine
extends BaseEngine


Nested Class Summary
static class CoordinatorEngine.FILTER_COMPARATORS
           
 
Field Summary
static String COORD_ACTIONS_LOG_MAX_COUNT
           
static String[] VALID_JOB_FILTERS
           
 
Fields inherited from class org.apache.oozie.BaseEngine
USE_XCOMMAND, user
 
Constructor Summary
CoordinatorEngine()
          Create a system Coordinator engine, with no user and no group.
CoordinatorEngine(String user)
          Create a Coordinator engine to perform operations on behave of a user.
 
Method Summary
 void change(String jobId, String changeValue)
          Change a coordinator job.
 String dryRunSubmit(org.apache.hadoop.conf.Configuration conf)
          Dry run a job; like {@link BaseEngine#submitJob(org.apache.hadoop.conf.Configuration, boolean) but doesn't actually execute the job.
 CoordinatorActionBean getCoordAction(String actionId)
           
 CoordinatorJobBean getCoordJob(String jobId)
          Return the info about a coord job.
 CoordinatorJobBean getCoordJob(String jobId, String filter, int offset, int length, boolean desc)
          Return the info about a coord job with actions subset.
 CoordinatorJobInfo getCoordJobs(String filter, int start, int len)
           
 String getDefinition(String jobId)
          Return the a job definition.
 org.apache.oozie.client.WorkflowJob getJob(String jobId)
          Return the info about a wf job.
 org.apache.oozie.client.WorkflowJob getJob(String jobId, int start, int length)
          Return the info about a wf job with actions subset.
 String getJobIdForExternalId(String externalId)
          Return the workflow Job ID for an external ID.
 List<WorkflowJobBean> getReruns(String coordActionId)
           
 CoordinatorActionInfo ignore(String jobId, String type, String scope)
           
 void kill(String jobId)
          Kill a job.
 CoordinatorActionInfo killActions(String jobId, String rangeType, String scope)
           
 Map<Pair<String,CoordinatorEngine.FILTER_COMPARATORS>,List<Object>> parseJobFilter(String filter)
           
 void reRun(String jobId, org.apache.hadoop.conf.Configuration conf)
          Deprecated. 
 CoordinatorActionInfo reRun(String jobId, String rerunType, String scope, boolean refresh, boolean noCleanup)
          Rerun coordinator actions for given rerunType
 void resume(String jobId)
          Resume a job.
 void start(String jobId)
          Deprecated. 
 void streamLog(String jobId, String logRetrievalScope, String logRetrievalType, Writer writer, Map<String,String[]> params)
          Add list of actions to the filter based on conditions
 void streamLog(String jobId, Writer writer, Map<String,String[]> params)
          Stream the log of a job.
 String submitJob(org.apache.hadoop.conf.Configuration conf, boolean startJob)
          Submit a job.
 void suspend(String jobId)
          Suspend a job.
 String updateJob(org.apache.hadoop.conf.Configuration conf, String jobId, boolean dryrun, boolean showDiff)
          Update coord job definition.
 
Methods inherited from class org.apache.oozie.BaseEngine
getJMSTopicName, getUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COORD_ACTIONS_LOG_MAX_COUNT

public static final String COORD_ACTIONS_LOG_MAX_COUNT
See Also:
Constant Field Values

VALID_JOB_FILTERS

public static final String[] VALID_JOB_FILTERS
Constructor Detail

CoordinatorEngine

public CoordinatorEngine()
Create a system Coordinator engine, with no user and no group.


CoordinatorEngine

public CoordinatorEngine(String user)
Create a Coordinator engine to perform operations on behave of a user.

Parameters:
user - user name.
Method Detail

getDefinition

public String getDefinition(String jobId)
                     throws BaseEngineException
Description copied from class: BaseEngine
Return the a job definition.

Specified by:
getDefinition in class BaseEngine
Parameters:
jobId - job Id.
Returns:
the job definition.
Throws:
BaseEngineException - thrown if the job definition could no be obtained.

getCoordAction

public CoordinatorActionBean getCoordAction(String actionId)
                                     throws BaseEngineException
Parameters:
actionId -
Returns:
CoordinatorActionBean
Throws:
BaseEngineException

getCoordJob

public CoordinatorJobBean getCoordJob(String jobId)
                               throws BaseEngineException
Description copied from class: BaseEngine
Return the info about a coord job.

Specified by:
getCoordJob in class BaseEngine
Parameters:
jobId - job Id.
Returns:
the coord job info.
Throws:
BaseEngineException - thrown if the job info could not be obtained.

getCoordJob

public CoordinatorJobBean getCoordJob(String jobId,
                                      String filter,
                                      int offset,
                                      int length,
                                      boolean desc)
                               throws BaseEngineException
Description copied from class: BaseEngine
Return the info about a coord job with actions subset.

Specified by:
getCoordJob in class BaseEngine
Parameters:
jobId - job Id.
filter - the status filter
offset - starting from this index in the list of actions belonging to the job
length - number of actions to be returned
Returns:
the coord job info.
Throws:
BaseEngineException - thrown if the job info could not be obtained.

getJobIdForExternalId

public String getJobIdForExternalId(String externalId)
                             throws CoordinatorEngineException
Description copied from class: BaseEngine
Return the workflow Job ID for an external ID.

This is reverse lookup for recovery purposes.

Specified by:
getJobIdForExternalId in class BaseEngine
Parameters:
externalId - external ID provided at job submission time.
Returns:
the associated workflow job ID if any, null if none.
Throws:
CoordinatorEngineException

kill

public void kill(String jobId)
          throws CoordinatorEngineException
Description copied from class: BaseEngine
Kill a job.

Specified by:
kill in class BaseEngine
Parameters:
jobId - job Id.
Throws:
CoordinatorEngineException

killActions

public CoordinatorActionInfo killActions(String jobId,
                                         String rangeType,
                                         String scope)
                                  throws CoordinatorEngineException
Throws:
CoordinatorEngineException

change

public void change(String jobId,
                   String changeValue)
            throws CoordinatorEngineException
Description copied from class: BaseEngine
Change a coordinator job.

Specified by:
change in class BaseEngine
Parameters:
jobId - job Id.
changeValue - change value.
Throws:
CoordinatorEngineException

ignore

public CoordinatorActionInfo ignore(String jobId,
                                    String type,
                                    String scope)
                             throws CoordinatorEngineException
Throws:
CoordinatorEngineException

reRun

@Deprecated
public void reRun(String jobId,
                             org.apache.hadoop.conf.Configuration conf)
           throws BaseEngineException
Deprecated. 

Description copied from class: BaseEngine
Rerun a job.

Specified by:
reRun in class BaseEngine
Parameters:
jobId - job Id to rerun.
conf - configuration information for the rerun.
Throws:
BaseEngineException - thrown if the job could not be rerun.

reRun

public CoordinatorActionInfo reRun(String jobId,
                                   String rerunType,
                                   String scope,
                                   boolean refresh,
                                   boolean noCleanup)
                            throws BaseEngineException
Rerun coordinator actions for given rerunType

Parameters:
jobId -
rerunType -
scope -
refresh -
noCleanup -
Throws:
BaseEngineException

resume

public void resume(String jobId)
            throws CoordinatorEngineException
Description copied from class: BaseEngine
Resume a job.

Specified by:
resume in class BaseEngine
Parameters:
jobId - job Id.
Throws:
CoordinatorEngineException

start

@Deprecated
public void start(String jobId)
           throws BaseEngineException
Deprecated. 

Description copied from class: BaseEngine
Start a job.

Specified by:
start in class BaseEngine
Parameters:
jobId - job Id.
Throws:
BaseEngineException - thrown if the job could not be started.

streamLog

public void streamLog(String jobId,
                      Writer writer,
                      Map<String,String[]> params)
               throws IOException,
                      BaseEngineException
Description copied from class: BaseEngine
Stream the log of a job.

Specified by:
streamLog in class BaseEngine
Parameters:
jobId - job Id.
writer - writer to stream the log to.
params - additional parameters from the request
Throws:
IOException - thrown if the log cannot be streamed.
BaseEngineException - thrown if there is error in getting the Workflow/Coordinator Job Information for jobId.

streamLog

public void streamLog(String jobId,
                      String logRetrievalScope,
                      String logRetrievalType,
                      Writer writer,
                      Map<String,String[]> params)
               throws IOException,
                      BaseEngineException,
                      CommandException
Add list of actions to the filter based on conditions

Parameters:
jobId - Job Id
logRetrievalScope - Value for the retrieval type
logRetrievalType - Based on which filter criteria the log is retrieved
writer - writer to stream the log to
params - additional parameters from the request
Throws:
IOException
BaseEngineException
CommandException

submitJob

public String submitJob(org.apache.hadoop.conf.Configuration conf,
                        boolean startJob)
                 throws CoordinatorEngineException
Description copied from class: BaseEngine
Submit a job.

It validates configuration properties.

Specified by:
submitJob in class BaseEngine
Parameters:
conf - job configuration.
startJob - indicates if the job should be started or not.
Returns:
the job Id.
Throws:
CoordinatorEngineException

dryRunSubmit

public String dryRunSubmit(org.apache.hadoop.conf.Configuration conf)
                    throws CoordinatorEngineException
Description copied from class: BaseEngine
Dry run a job; like {@link BaseEngine#submitJob(org.apache.hadoop.conf.Configuration, boolean) but doesn't actually execute the job.

It validates configuration properties.

Specified by:
dryRunSubmit in class BaseEngine
Parameters:
conf - job configuration.
Returns:
the result of the dryrun
Throws:
CoordinatorEngineException

suspend

public void suspend(String jobId)
             throws CoordinatorEngineException
Description copied from class: BaseEngine
Suspend a job.

Specified by:
suspend in class BaseEngine
Parameters:
jobId - job Id.
Throws:
CoordinatorEngineException

getJob

public org.apache.oozie.client.WorkflowJob getJob(String jobId)
                                           throws BaseEngineException
Description copied from class: BaseEngine
Return the info about a wf job.

Specified by:
getJob in class BaseEngine
Parameters:
jobId - job Id.
Returns:
the workflow job info.
Throws:
DagEngineException - thrown if the job info could not be obtained.
BaseEngineException

getJob

public org.apache.oozie.client.WorkflowJob getJob(String jobId,
                                                  int start,
                                                  int length)
                                           throws BaseEngineException
Description copied from class: BaseEngine
Return the info about a wf job with actions subset.

Specified by:
getJob in class BaseEngine
Parameters:
jobId - job Id
start - starting from this index in the list of actions belonging to the job
length - number of actions to be returned
Returns:
the workflow job info.
Throws:
DagEngineException - thrown if the job info could not be obtained.
BaseEngineException

getCoordJobs

public CoordinatorJobInfo getCoordJobs(String filter,
                                       int start,
                                       int len)
                                throws CoordinatorEngineException
Parameters:
filter -
start -
len -
Returns:
CoordinatorJobInfo
Throws:
CoordinatorEngineException

parseJobFilter

public Map<Pair<String,CoordinatorEngine.FILTER_COMPARATORS>,List<Object>> parseJobFilter(String filter)
                                                                                   throws CoordinatorEngineException
Throws:
CoordinatorEngineException

getReruns

public List<WorkflowJobBean> getReruns(String coordActionId)
                                throws CoordinatorEngineException
Throws:
CoordinatorEngineException

updateJob

public String updateJob(org.apache.hadoop.conf.Configuration conf,
                        String jobId,
                        boolean dryrun,
                        boolean showDiff)
                 throws CoordinatorEngineException
Update coord job definition.

Parameters:
conf - the conf
jobId - the job id
dryrun - the dryrun
showDiff - the show diff
Returns:
the string
Throws:
CoordinatorEngineException - the coordinator engine exception


Copyright © 2015 Apache Software Foundation. All Rights Reserved.