|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.oozie.client.OozieClient
public class OozieClient
Client API to submit and manage Oozie workflow jobs against an Oozie intance.
This class is thread safe. Syntax for filter for thegetJobsInfo(String)
getJobsInfo(String, int, int)
methods:
[NAME=VALUE][;NAME=VALUE]*
.
Valid filter names are:
Nested Class Summary | |
---|---|
protected class |
OozieClient.ClientCallable<T>
|
static class |
OozieClient.SYSTEM_MODE
|
Constructor Summary | |
---|---|
protected |
OozieClient()
|
|
OozieClient(String oozieUrl)
Create a Workflow client instance. |
Method Summary | ||
---|---|---|
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. |
|
static
|
doAs(String userName,
Callable<T> callable)
Allows to impersonate other users in the Oozie server. |
|
String |
dryrun(Properties conf)
dryrun for a given job |
|
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. |
|
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 |
|
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. |
|
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 |
|
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. |
|
WorkflowAction |
getWorkflowActionInfo(String actionId)
Get the info of a workflow action. |
|
void |
kill(String jobId)
Kill a workflow job. |
|
static String |
notEmpty(String str,
String name)
Check if the string is not null or not empty. |
|
static
|
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 |
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. |
|
void |
validateWSVersion()
Validate that the Oozie client and server instances are protocol compatible. |
|
void |
writeToXml(Properties props,
OutputStream out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long WS_PROTOCOL_VERSION_0
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_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 CHANGE_VALUE_ENDTIME
public static final String CHANGE_VALUE_PAUSETIME
public static final String CHANGE_VALUE_CONCURRENCY
public static final String LIBPATH
public static final String USE_SYSTEM_LIBPATH
public int debugMode
Constructor Detail |
---|
protected OozieClient()
public OozieClient(String oozieUrl)
oozieUrl
- URL of the Oozie instance it will interact with.Method Detail |
---|
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 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 createConnection(URL url, String method) throws IOException, OozieClientException
url
- method
-
IOException
OozieClientException
public void writeToXml(Properties props, OutputStream out) throws IOException
IOException
public String submit(Properties conf) throws OozieClientException
conf
- job configuration.
OozieClientException
- thrown if the job could not be submitted.public String dryrun(Properties conf) throws OozieClientException
conf
- Job configuration.
OozieClientException
public 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 void change(String jobId, String changeValue) throws OozieClientException
jobId
- job Id.changeValue
- change value.
OozieClientException
- 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 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 returned
OozieClientException
- 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, 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 interface
OozieClientException
- thrown if the job info could not be retrieved.public 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 returned
OozieClientException
- thrown if the job info could not be retrieved.public 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 option
OozieClientException
public 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 option
OozieClientException
public 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 results
OozieClientException
public 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 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
OozieClientException
public List<String> getQueueDump() throws OozieClientException
OozieClientException
- throw if it the queue dump could not be retrieved.public static String notEmpty(String str, String name)
str
- name
-
public static <T> T notNull(T obj, String name)
T
- obj
- name
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |