org.apache.oozie
Class BaseEngine

java.lang.Object
  extended by org.apache.oozie.BaseEngine
Direct Known Subclasses:
BundleEngine, CoordinatorEngine, DagEngine

public abstract class BaseEngine
extends Object


Field Summary
static String USE_XCOMMAND
           
protected  String user
           
 
Constructor Summary
BaseEngine()
           
 
Method Summary
abstract  void change(String jobId, String changeValue)
          Change a coordinator job.
abstract  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.
abstract  org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId)
          Return the info about a coord job.
abstract  org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId, String filter, int start, int length, boolean desc)
          Return the info about a coord job with actions subset.
abstract  String getDefinition(String jobId)
          Return the a job definition.
 String getJMSTopicName(String jobId)
          Return the jms topic name for the job.
abstract  org.apache.oozie.client.WorkflowJob getJob(String jobId)
          Return the info about a wf job.
abstract  org.apache.oozie.client.WorkflowJob getJob(String jobId, int start, int length)
          Return the info about a wf job with actions subset.
abstract  String getJobIdForExternalId(String externalId)
          Return the workflow Job ID for an external ID.
 String getUser()
          Return the user name.
abstract  void kill(String jobId)
          Kill a job.
abstract  void reRun(String jobId, org.apache.hadoop.conf.Configuration conf)
          Rerun a job.
abstract  void resume(String jobId)
          Resume a job.
abstract  void start(String jobId)
          Start a job.
abstract  void streamLog(String jobId, Writer writer)
          Stream the log of a job.
abstract  String submitJob(org.apache.hadoop.conf.Configuration conf, boolean startJob)
          Submit a job.
abstract  void suspend(String jobId)
          Suspend a job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_XCOMMAND

public static final String USE_XCOMMAND
See Also:
Constant Field Values

user

protected String user
Constructor Detail

BaseEngine

public BaseEngine()
Method Detail

getUser

public String getUser()
Return the user name.

Returns:
the user name.

submitJob

public abstract String submitJob(org.apache.hadoop.conf.Configuration conf,
                                 boolean startJob)
                          throws BaseEngineException
Submit a job.

It validates configuration properties.

Parameters:
conf - job configuration.
startJob - indicates if the job should be started or not.
Returns:
the job Id.
Throws:
BaseEngineException - thrown if the job could not be created.

start

public abstract void start(String jobId)
                    throws BaseEngineException
Start a job.

Parameters:
jobId - job Id.
Throws:
BaseEngineException - thrown if the job could not be started.

resume

public abstract void resume(String jobId)
                     throws BaseEngineException
Resume a job.

Parameters:
jobId - job Id.
Throws:
BaseEngineException - thrown if the job could not be resumed.

suspend

public abstract void suspend(String jobId)
                      throws BaseEngineException
Suspend a job.

Parameters:
jobId - job Id.
Throws:
BaseEngineException - thrown if the job could not be suspended.

kill

public abstract void kill(String jobId)
                   throws BaseEngineException
Kill a job.

Parameters:
jobId - job Id.
Throws:
BaseEngineException - thrown if the job could not be killed.

change

public abstract void change(String jobId,
                            String changeValue)
                     throws BaseEngineException
Change a coordinator job.

Parameters:
jobId - job Id.
changeValue - change value.
Throws:
BaseEngineException - thrown if the job could not be changed.

reRun

public abstract void reRun(String jobId,
                           org.apache.hadoop.conf.Configuration conf)
                    throws BaseEngineException
Rerun a job.

Parameters:
jobId - job Id to rerun.
conf - configuration information for the rerun.
Throws:
BaseEngineException - thrown if the job could not be rerun.

getJob

public abstract org.apache.oozie.client.WorkflowJob getJob(String jobId)
                                                    throws BaseEngineException
Return the info about a wf job.

Parameters:
jobId - job Id.
Returns:
the workflow job info.
Throws:
DagEngineException - thrown if the job info could not be obtained.
BaseEngineException

getJob

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

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

getCoordJob

public abstract org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId)
                                                            throws BaseEngineException
Return the info about a coord job.

Parameters:
jobId - job Id.
Returns:
the coord job info.
Throws:
BaseEngineException - thrown if the job info could not be obtained.

getCoordJob

public abstract org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId,
                                                                   String filter,
                                                                   int start,
                                                                   int length,
                                                                   boolean desc)
                                                            throws BaseEngineException
Return the info about a coord job with actions subset.

Parameters:
jobId - job Id.
filter - the status filter
start - starting from this index in the list of actions belonging to the job
length - number of actions to be returned
order - true if actions are sorted in a descending order of nominal time, false if asc order
Returns:
the coord job info.
Throws:
BaseEngineException - thrown if the job info could not be obtained.

getDefinition

public abstract String getDefinition(String jobId)
                              throws BaseEngineException
Return the a job definition.

Parameters:
jobId - job Id.
Returns:
the job definition.
Throws:
BaseEngineException - thrown if the job definition could no be obtained.

streamLog

public abstract void streamLog(String jobId,
                               Writer writer)
                        throws IOException,
                               BaseEngineException
Stream the log of a job.

Parameters:
jobId - job Id.
writer - writer to stream the log to.
Throws:
IOException - thrown if the log cannot be streamed.
BaseEngineException - thrown if there is error in getting the Workflow/Coordinator Job Information for jobId.

getJobIdForExternalId

public abstract String getJobIdForExternalId(String externalId)
                                      throws BaseEngineException
Return the workflow Job ID for an external ID.

This is reverse lookup for recovery purposes.

Parameters:
externalId - external ID provided at job submission time.
Returns:
the associated workflow job ID if any, null if none.
Throws:
BaseEngineException - thrown if the lookup could not be done.

dryRunSubmit

public abstract String dryRunSubmit(org.apache.hadoop.conf.Configuration conf)
                             throws BaseEngineException
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.

Parameters:
conf - job configuration.
Returns:
the result of the dryrun
Throws:
BaseEngineException - thrown if there was a problem doing the dryrun

getJMSTopicName

public String getJMSTopicName(String jobId)
                       throws DagEngineException
Return the jms topic name for the job.

Parameters:
jobId - job Id.
Returns:
String the topic name
Throws:
DagEngineException - thrown if the jms info could not be obtained.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.