org.apache.oozie
Class BaseEngine

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

public abstract class BaseEngine
extends Object


Field Summary
protected  String authToken
           
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, boolean startJob)
           
protected  String getAuthToken()
          Return the authentication token.
abstract  CoordinatorJob getCoordJob(String jobId)
          Return the info about a coord job.
abstract  CoordinatorJob getCoordJob(String jobId, int start, int length)
          Return the info about a coord job with actions subset.
abstract  String getDefinition(String jobId)
          Return the a job definition.
abstract  WorkflowJob getJob(String jobId)
          Return the info about a wf job.
abstract  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

user

protected String user

authToken

protected String authToken
Constructor Detail

BaseEngine

public BaseEngine()
Method Detail

getUser

public String getUser()
Return the user name.

Returns:
the user name.

getAuthToken

protected String getAuthToken()
Return the authentication token.

Returns:
the authentication token.

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 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 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 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 CoordinatorJob getCoordJob(String jobId,
                                           int start,
                                           int length)
                                    throws BaseEngineException
Return the info about a coord 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 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,
                                    boolean startJob)
                             throws BaseEngineException
Throws:
BaseEngineException


Copyright © 2011 Yahoo. All Rights Reserved.