org.apache.oozie
Class BundleEngine

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

public class BundleEngine
extends BaseEngine


Field Summary
 
Fields inherited from class org.apache.oozie.BaseEngine
authToken, USE_XCOMMAND, user
 
Constructor Summary
BundleEngine()
          Create a system Bundle engine, with no user and no group.
BundleEngine(String user, String authToken)
          Create a Bundle 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, boolean startJob)
           
 BulkResponseInfo getBulkJobs(String bulkFilter, int start, int len)
          Get bulk job response
 BundleJobBean getBundleJob(String jobId)
           
 BundleJobInfo getBundleJobs(String filter, int start, int len)
          Get bundle jobs
 org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId)
          Return the info about a coord job.
 org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId, String filter, int start, int length)
          Return the info about a coord job with actions subset.
 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.
 void kill(String jobId)
          Kill a job.
static Map<String,List<String>> parseBulkFilter(String bulkParams)
          Parse filter string to a map with key = filter name and values = filter values Allowed keys are defined as constants on top
 void reRun(String jobId, org.apache.hadoop.conf.Configuration conf)
          Deprecated. 
 void reRun(String jobId, String coordScope, String dateScope, boolean refresh, boolean noCleanup)
          Rerun Bundle actions for given rerunType
 void resume(String jobId)
          Resume a job.
 void start(String jobId)
          Start a job.
 void streamLog(String jobId, Writer writer)
          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.
 
Methods inherited from class org.apache.oozie.BaseEngine
getAuthToken, getUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleEngine

public BundleEngine()
Create a system Bundle engine, with no user and no group.


BundleEngine

public BundleEngine(String user,
                    String authToken)
Create a Bundle engine to perform operations on behave of a user.

Parameters:
user - user name.
authToken - the authentication token.
Method Detail

change

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

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

dryrunSubmit

public String dryrunSubmit(org.apache.hadoop.conf.Configuration conf,
                           boolean startJob)
                    throws BundleEngineException
Specified by:
dryrunSubmit in class BaseEngine
Throws:
BundleEngineException

getCoordJob

public org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId)
                                                   throws BundleEngineException
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:
BundleEngineException

getBundleJob

public BundleJobBean getBundleJob(String jobId)
                           throws BundleEngineException
Throws:
BundleEngineException

getCoordJob

public org.apache.oozie.client.CoordinatorJob getCoordJob(String jobId,
                                                          String filter,
                                                          int start,
                                                          int length)
                                                   throws BundleEngineException
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
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:
BundleEngineException

getDefinition

public String getDefinition(String jobId)
                     throws BundleEngineException
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:
BundleEngineException

getJob

public org.apache.oozie.client.WorkflowJob getJob(String jobId)
                                           throws BundleEngineException
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:
BundleEngineException

getJob

public org.apache.oozie.client.WorkflowJob getJob(String jobId,
                                                  int start,
                                                  int length)
                                           throws BundleEngineException
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:
BundleEngineException

getJobIdForExternalId

public String getJobIdForExternalId(String externalId)
                             throws BundleEngineException
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:
BundleEngineException

kill

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

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

reRun

@Deprecated
public void reRun(String jobId,
                             org.apache.hadoop.conf.Configuration conf)
           throws BundleEngineException
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:
BundleEngineException

reRun

public void reRun(String jobId,
                  String coordScope,
                  String dateScope,
                  boolean refresh,
                  boolean noCleanup)
           throws BaseEngineException
Rerun Bundle actions for given rerunType

Parameters:
jobId - bundle job id
coordScope - the rerun scope for coordinator job names separated by ","
dateScope - the rerun scope for coordinator nominal times separated by ","
refresh - true if user wants to refresh input/outpur dataset urls
noCleanup - false if user wants to cleanup output events for given rerun actions
Throws:
BaseEngineException - thrown if failed to rerun

resume

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

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

start

public void start(String jobId)
           throws BundleEngineException
Description copied from class: BaseEngine
Start a job.

Specified by:
start in class BaseEngine
Parameters:
jobId - job Id.
Throws:
BundleEngineException

streamLog

public void streamLog(String jobId,
                      Writer writer)
               throws IOException,
                      BundleEngineException
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.
Throws:
IOException - thrown if the log cannot be streamed.
BundleEngineException

submitJob

public String submitJob(org.apache.hadoop.conf.Configuration conf,
                        boolean startJob)
                 throws BundleEngineException
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:
BundleEngineException

suspend

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

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

getBundleJobs

public BundleJobInfo getBundleJobs(String filter,
                                   int start,
                                   int len)
                            throws BundleEngineException
Get bundle jobs

Parameters:
filter - the filter string
start - start location for paging
len - total length to get
Returns:
bundle job info
Throws:
BundleEngineException - thrown if failed to get bundle job info

getBulkJobs

public BulkResponseInfo getBulkJobs(String bulkFilter,
                                    int start,
                                    int len)
                             throws BundleEngineException
Get bulk job response

Parameters:
filter - the filter string
start - start location for paging
len - total length to get
Returns:
bulk job info
Throws:
BundleEngineException - thrown if failed to get bulk job info

parseBulkFilter

public static Map<String,List<String>> parseBulkFilter(String bulkParams)
                                                throws BundleEngineException
Parse filter string to a map with key = filter name and values = filter values Allowed keys are defined as constants on top

Parameters:
filter - the filter string
Returns:
filter key-value pair map
Throws:
BundleEngineException - thrown if failed to parse filter string


Copyright © 2012 Apache Software Foundation. All Rights Reserved.