public class OozieClient extends Object
getJobsInfo(String) getJobsInfo(String, int, int) methods:
[NAME=VALUE][;NAME=VALUE]*.
Valid filter names are:
| Modifier and Type | Class and Description |
|---|---|
protected class |
OozieClient.ClientCallable<T> |
static class |
OozieClient.SYSTEM_MODE |
| Modifier | Constructor and Description |
|---|---|
protected |
OozieClient() |
|
OozieClient(String oozieUrl)
Create a Workflow client instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
change(String jobId,
String changeValue)
Change a coordinator job.
|
Properties |
createConfiguration()
Create an empty configuration with just the
USER_NAME set to the JVM user name. |
protected HttpURLConnection |
createConnection(URL url,
String method)
Create http connection to oozie server.
|
protected HttpURLConnection |
createRetryableConnection(URL url,
String method)
Create retryable http connection to oozie server.
|
static <T> T |
doAs(String userName,
Callable<T> callable)
Allows to impersonate other users in the Oozie server.
|
String |
dryrun(Properties conf)
dryrun for a given job
|
Map<String,String> |
getAvailableOozieServers()
Return the list of available Oozie servers.
|
List<BulkResponse> |
getBulkInfo(String filter,
int start,
int len) |
BundleJob |
getBundleJobInfo(String jobId)
Get the info of a bundle job.
|
List<BundleJob> |
getBundleJobsInfo(String filter,
int start,
int len)
Return the info of the bundle jobs that match the filter.
|
String |
getClientBuildVersion()
Return the Oozie client build version.
|
CoordinatorAction |
getCoordActionInfo(String actionId)
Get the info of a coordinator action.
|
CoordinatorJob |
getCoordJobInfo(String jobId)
Get the info of a coordinator job.
|
CoordinatorJob |
getCoordJobInfo(String jobId,
String filter,
int start,
int len)
Get the info of a coordinator job and subset actions.
|
CoordinatorJob |
getCoordJobInfo(String jobId,
String filter,
int start,
int len,
String order)
Get the info of a coordinator job and subset actions.
|
List<CoordinatorJob> |
getCoordJobsInfo(String filter,
int start,
int len)
Return the info of the coordinator jobs that match the filter.
|
int |
getDebugMode() |
String |
getHeader(String name)
Get the value of a set HTTP header from the workflow instance.
|
Iterator<String> |
getHeaderNames()
Return an iterator with all the header names set in the workflow instance.
|
Map<String,String> |
getHeaders()
Get the set HTTP header
|
JMSConnectionInfo |
getJMSConnectionInfo()
Get the JMS Connection info
|
String |
getJMSTopicName(String jobId)
Gets the JMS topic name for a particular job
|
String |
getJobDefinition(String jobId)
Get the definition of a workflow job.
|
String |
getJobId(String externalId)
Return the workflow job Id for an external Id.
|
WorkflowJob |
getJobInfo(String jobId)
Get the info of a workflow job.
|
WorkflowJob |
getJobInfo(String jobId,
int start,
int len)
Get the info of a workflow job and subset actions.
|
String |
getJobLog(String jobId)
Get the log of a workflow job.
|
void |
getJobLog(String jobId,
String logRetrievalType,
String logRetrievalScope,
PrintStream ps)
Get the log of a job.
|
void |
getJobLog(String jobId,
String logRetrievalType,
String logRetrievalScope,
String logFilter,
PrintStream ps)
Get the log of a job.
|
List<WorkflowJob> |
getJobsInfo(String filter)
Return the info of the workflow jobs that match the filter.
|
List<WorkflowJob> |
getJobsInfo(String filter,
int start,
int len)
Return the info of the workflow jobs that match the filter.
|
String |
getOozieUrl()
Return the Oozie URL of the workflow client instance.
|
String |
getProtocolUrl()
Return the Oozie URL used by the client and server for WS communications.
|
List<String> |
getQueueDump()
Return the Oozie queue's commands' dump
|
int |
getRetryCount() |
String |
getServerBuildVersion()
Return the Oozie server build version.
|
void |
getSlaInfo(int start,
int len,
String filter)
Print sla info about coordinator and workflow jobs and actions.
|
OozieClient.SYSTEM_MODE |
getSystemMode()
Returns if Oozie is in safe mode or not.
|
List<WorkflowJob> |
getWfsForCoordAction(String coordActionId) |
WorkflowAction |
getWorkflowActionInfo(String actionId)
Get the info of a workflow action.
|
List<CoordinatorAction> |
ignore(String jobId,
String scope)
Ignore a coordinator job.
|
void |
kill(String jobId)
Kill a workflow/coord/bundle job.
|
List<CoordinatorAction> |
kill(String jobId,
String rangeType,
String scope)
Kill coordinator actions
|
String |
listShareLib(String sharelibKey) |
static String |
notEmpty(String str,
String name)
Check if the string is not null or not empty.
|
static <T> T |
notNull(T obj,
String name)
Check if the object is not null.
|
void |
removeHeader(String name)
Remove a HTTP header from the workflow client instance.
|
void |
reRun(String jobId,
Properties conf)
Rerun a workflow job.
|
Void |
reRunBundle(String jobId,
String coordScope,
String dateScope,
boolean refresh,
boolean noCleanup)
Rerun bundle coordinators.
|
List<CoordinatorAction> |
reRunCoord(String jobId,
String rerunType,
String scope,
boolean refresh,
boolean noCleanup)
Rerun coordinator actions.
|
void |
resume(String jobId)
Resume a workflow job.
|
String |
run(Properties conf)
Submit and start a workflow job.
|
void |
setDebugMode(int debugMode)
Set debug mode.
|
void |
setHeader(String name,
String value)
Set a HTTP header to be used in the WS requests by the workflow instance.
|
void |
setRetryCount(int retryCount) |
void |
setSystemMode(OozieClient.SYSTEM_MODE status)
Enable or disable safe mode.
|
void |
start(String jobId)
Start a workflow job.
|
String |
submit(Properties conf)
Submit a workflow job.
|
void |
suspend(String jobId)
Suspend a workflow job.
|
String |
updateCoord(String jobId,
Properties conf,
String dryrun,
String showDiff)
Update coord definition.
|
String |
updateCoord(String jobId,
String dryrun,
String showDiff)
Update coord definition without properties.
|
String |
updateShareLib() |
void |
validateWSVersion()
Validate that the Oozie client and server instances are protocol compatible.
|
void |
writeToXml(Properties props,
OutputStream out) |
public static final long WS_PROTOCOL_VERSION_0
public static final long WS_PROTOCOL_VERSION_1
public static final long WS_PROTOCOL_VERSION
public static final String USER_NAME
@Deprecated public static final String GROUP_NAME
public static final String JOB_ACL
public static final String APP_PATH
public static final String COORDINATOR_APP_PATH
public static final String BUNDLE_APP_PATH
public static final String BUNDLE_ID
public static final String EXTERNAL_ID
public static final String WORKFLOW_NOTIFICATION_URL
public static final String ACTION_NOTIFICATION_URL
public static final String COORD_ACTION_NOTIFICATION_URL
public static final String RERUN_SKIP_NODES
public static final String RERUN_FAIL_NODES
public static final String LOG_TOKEN
public static final String ACTION_MAX_RETRIES
public static final String ACTION_RETRY_INTERVAL
public static final String FILTER_USER
public static final String FILTER_GROUP
public static final String FILTER_NAME
public static final String FILTER_STATUS
public static final String FILTER_NOMINAL_TIME
public static final String FILTER_FREQUENCY
public static final String FILTER_ID
public static final String FILTER_UNIT
public static final String FILTER_JOBID
public static final String FILTER_APPNAME
public static final String FILTER_SLA_APPNAME
public static final String FILTER_SLA_ID
public static final String FILTER_SLA_PARENT_ID
public static final String FILTER_SLA_NOMINAL_START
public static final String FILTER_SLA_NOMINAL_END
public static final String CHANGE_VALUE_ENDTIME
public static final String CHANGE_VALUE_PAUSETIME
public static final String CHANGE_VALUE_CONCURRENCY
public static final String CHANGE_VALUE_STATUS
public static final String LIBPATH
public static final String USE_SYSTEM_LIBPATH
public static final String OOZIE_SUSPEND_ON_NODES
public int debugMode
protected OozieClient()
public OozieClient(String oozieUrl)
oozieUrl - URL of the Oozie instance it will interact with.public static <T> T doAs(String userName, Callable<T> callable) throws Exception
userName - user to impersonate.callable - callable with OozieClient calls impersonating the specified user.Callable.call() method.Exception - thrown by the Callable.call() method.public String getOozieUrl()
public String getProtocolUrl() throws OozieClientException
OozieClientException - thrown in the client and the server are not protocol compatible.public int getDebugMode()
public void setDebugMode(int debugMode)
debugMode - : 0 means no debugging. > 0 means debuggingpublic int getRetryCount()
public void setRetryCount(int retryCount)
public void validateWSVersion() throws OozieClientException
OozieClientException - thrown in the client and the server are not protocol compatible.public Properties createConfiguration()
USER_NAME set to the JVM user name.public void setHeader(String name, String value)
name - header name.value - header value.public String getHeader(String name)
name - header name.null if not set.public Map<String,String> getHeaders()
public void removeHeader(String name)
name - header name.public Iterator<String> getHeaderNames()
protected HttpURLConnection createRetryableConnection(URL url, String method) throws IOException
url - method - IOExceptionOozieClientExceptionprotected HttpURLConnection createConnection(URL url, String method) throws IOException, OozieClientException
url - method - IOExceptionOozieClientExceptionpublic void writeToXml(Properties props, OutputStream out) throws IOException
IOExceptionpublic String submit(Properties conf) throws OozieClientException
conf - job configuration.OozieClientException - thrown if the job could not be submitted.public String updateCoord(String jobId, Properties conf, String dryrun, String showDiff) throws OozieClientException
jobId - the job idconf - the confdryrun - the dryrunshowDiff - the show diffOozieClientException - the oozie client exceptionpublic String updateCoord(String jobId, String dryrun, String showDiff) throws OozieClientException
jobId - the job iddryrun - the dryrunshowDiff - the show diffOozieClientException - the oozie client exceptionpublic String dryrun(Properties conf) throws OozieClientException
conf - Job configuration.OozieClientExceptionpublic void start(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job could not be started.public String run(Properties conf) throws OozieClientException
conf - job configuration.OozieClientException - thrown if the job could not be submitted.public void reRun(String jobId, Properties conf) throws OozieClientException
jobId - job Id to rerun.conf - configuration information for the rerun.OozieClientException - thrown if the job could not be started.public void suspend(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job could not be suspended.public void resume(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job could not be resume.public void kill(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job could not be killed.public List<CoordinatorAction> kill(String jobId, String rangeType, String scope) throws OozieClientException
jobId - coordinator Job IdrangeType - type 'date' if -date is used, 'action-num' if -action is usedscope - kill scope for date or action numsOozieClientException - thrown if some actions could not be killed.public void change(String jobId, String changeValue) throws OozieClientException
jobId - job Id.changeValue - change value.OozieClientException - thrown if the job could not be changed.public List<CoordinatorAction> ignore(String jobId, String scope) throws OozieClientException
jobId - coord job Id.scope - list of coord actions to be ignoredOozieClientException - thrown if the job could not be changed.public WorkflowJob getJobInfo(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job info could not be retrieved.public JMSConnectionInfo getJMSConnectionInfo() throws OozieClientException
OozieClientExceptionpublic WorkflowJob getJobInfo(String jobId, int start, int len) throws OozieClientException
jobId - job Id.start - starting index in the list of actions belonging to the joblen - number of actions to be returnedOozieClientException - thrown if the job info could not be retrieved.public WorkflowAction getWorkflowActionInfo(String actionId) throws OozieClientException
actionId - Id.OozieClientException - thrown if the job info could not be retrieved.public String getJobLog(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job info could not be retrieved.public void getJobLog(String jobId, String logRetrievalType, String logRetrievalScope, String logFilter, PrintStream ps) throws OozieClientException
jobId - job Id.logRetrievalType - Based on which filter criteria the log is retrievedlogRetrievalScope - Value for the retrieval typelogFilter - log filterps - Printstream of command line interfaceOozieClientException - thrown if the job info could not be retrieved.public void getJobLog(String jobId, String logRetrievalType, String logRetrievalScope, PrintStream ps) throws OozieClientException
jobId - job Id.logRetrievalType - Based on which filter criteria the log is retrievedlogRetrievalScope - Value for the retrieval typeps - Printstream of command line interfaceOozieClientException - thrown if the job info could not be retrieved.public String getJMSTopicName(String jobId) throws OozieClientException
jobId - given jobIdOozieClientExceptionpublic String getJobDefinition(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job info could not be retrieved.public BundleJob getBundleJobInfo(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job info could not be retrieved.public CoordinatorJob getCoordJobInfo(String jobId) throws OozieClientException
jobId - job Id.OozieClientException - thrown if the job info could not be retrieved.public CoordinatorJob getCoordJobInfo(String jobId, String filter, int start, int len) throws OozieClientException
jobId - job Id.filter - filter the status filterstart - starting index in the list of actions belonging to the joblen - number of actions to be returnedOozieClientException - thrown if the job info could not be retrieved.public CoordinatorJob getCoordJobInfo(String jobId, String filter, int start, int len, String order) throws OozieClientException
jobId - job Id.filter - filter the status filterstart - starting index in the list of actions belonging to the joblen - number of actions to be returnedorder - order to list coord actions (e.g, desc)OozieClientException - thrown if the job info could not be retrieved.public List<WorkflowJob> getWfsForCoordAction(String coordActionId) throws OozieClientException
OozieClientExceptionpublic CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientException
actionId - Id.OozieClientException - thrown if the job info could not be retrieved.public List<CoordinatorAction> reRunCoord(String jobId, String rerunType, String scope, boolean refresh, boolean noCleanup) throws OozieClientException
jobId - coordinator jobIdrerunType - rerun type 'date' if -date is used, 'action-id' if -action is usedscope - rerun scope for date or actionIdsrefresh - true if -refresh is given in command optionnoCleanup - true if -nocleanup is given in command optionOozieClientExceptionpublic Void reRunBundle(String jobId, String coordScope, String dateScope, boolean refresh, boolean noCleanup) throws OozieClientException
jobId - bundle jobIdcoordScope - rerun scope for coordinator jobsdateScope - rerun scope for daterefresh - true if -refresh is given in command optionnoCleanup - true if -nocleanup is given in command optionOozieClientExceptionpublic List<WorkflowJob> getJobsInfo(String filter, int start, int len) throws OozieClientException
filter - job filter. Refer to the OozieClient for the filter syntax.start - jobs offset, base 1.len - number of jobs to return.OozieClientException - thrown if the jobs info could not be retrieved.public List<WorkflowJob> getJobsInfo(String filter) throws OozieClientException
filter - job filter. Refer to the OozieClient for the filter syntax.OozieClientException - thrown if the jobs info could not be retrieved.public void getSlaInfo(int start, int len, String filter) throws OozieClientException
start - starting offsetlen - number of resultsOozieClientExceptionpublic String getJobId(String externalId) throws OozieClientException
externalId - external Id given at job creation time.null if none.OozieClientException - thrown if the operation could not be done.public void setSystemMode(OozieClient.SYSTEM_MODE status) throws OozieClientException
status - true to enable safe mode, false to disable safe mode.OozieClientException - if it fails to set the safe mode status.public OozieClient.SYSTEM_MODE getSystemMode() throws OozieClientException
OozieClientException - throw if it could not obtain the safe mode status.public String updateShareLib() throws OozieClientException
OozieClientExceptionpublic String listShareLib(String sharelibKey) throws OozieClientException
OozieClientExceptionpublic String getServerBuildVersion() throws OozieClientException
OozieClientException - throw if it the server build version could not be retrieved.public String getClientBuildVersion()
public List<CoordinatorJob> getCoordJobsInfo(String filter, int start, int len) throws OozieClientException
filter - job filter. Refer to the OozieClient for the filter syntax.start - jobs offset, base 1.len - number of jobs to return.OozieClientException - thrown if the jobs info could not be retrieved.public List<BundleJob> getBundleJobsInfo(String filter, int start, int len) throws OozieClientException
filter - job filter. Refer to the OozieClient for the filter syntax.start - jobs offset, base 1.len - number of jobs to return.OozieClientException - thrown if the jobs info could not be retrieved.public List<BulkResponse> getBulkInfo(String filter, int start, int len) throws OozieClientException
OozieClientExceptionpublic List<String> getQueueDump() throws OozieClientException
OozieClientException - throw if it the queue dump could not be retrieved.public Map<String,String> getAvailableOozieServers() throws OozieClientException
OozieClientException - throw if it the list of available Oozie servers could not be retrieved.public static String notEmpty(String str, String name)
str - name - Copyright © 2014 Apache Software Foundation. All Rights Reserved.