public class JavaActionExecutor extends ActionExecutor
ActionExecutor.Context, ActionExecutor.RETRYPOLICY| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACL_MODIFY_JOB |
static java.lang.String |
ACL_VIEW_JOB |
static java.lang.String |
CONF_HADOOP_YARN_UBER_MODE |
static java.lang.String |
HADOOP_CHILD_JAVA_ENV |
static java.lang.String |
HADOOP_CHILD_JAVA_OPTS |
static java.lang.String |
HADOOP_JOB_CLASSLOADER |
static java.lang.String |
HADOOP_JOB_TRACKER |
static java.lang.String |
HADOOP_JOB_TRACKER_2 |
static java.lang.String |
HADOOP_MAP_JAVA_ENV |
static java.lang.String |
HADOOP_MAP_JAVA_OPTS |
static java.lang.String |
HADOOP_MAP_MEMORY_MB |
static java.lang.String |
HADOOP_NAME_NODE |
static java.lang.String |
HADOOP_REDUCE_JAVA_OPTS |
static java.lang.String |
HADOOP_USER_CLASSPATH_FIRST |
static java.lang.String |
HADOOP_YARN_KILL_CHILD_JOBS_ON_AMRESTART |
static java.lang.String |
HADOOP_YARN_RM |
static java.lang.String |
HADOOP_YARN_UBER_MODE |
protected XLog |
LOG |
static java.lang.String |
MAX_EXTERNAL_STATS_SIZE |
static java.lang.String |
OOZIE_ACTION_LAUNCHER_PREFIX |
static java.lang.String |
OOZIE_COMMON_LIBDIR |
static java.lang.String |
OOZIE_CREDENTIALS_SKIP |
XConfiguration |
workflowConf |
static java.lang.String |
YARN_AM_COMMAND_OPTS |
static java.lang.String |
YARN_AM_ENV |
static java.lang.String |
YARN_AM_RESOURCE_MB |
static int |
YARN_MEMORY_MB_MIN |
ACTION_RETRY_INTERVAL, ACTION_RETRY_POLICY, CONF_PREFIX, ERROR_OTHER, MAX_RETRIES, OOZIE_ACTION_YARN_TAG, RETRY_INTERVAL| Modifier | Constructor and Description |
|---|---|
|
JavaActionExecutor() |
protected |
JavaActionExecutor(java.lang.String type) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addActionLibs(org.apache.hadoop.fs.Path appPath,
org.apache.hadoop.conf.Configuration conf) |
protected void |
addShareLib(org.apache.hadoop.conf.Configuration conf,
java.lang.String[] actionShareLibNames) |
protected void |
addSystemShareLibForAction(org.apache.hadoop.conf.Configuration conf) |
void |
check(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
Check if an action has completed.
|
org.apache.hadoop.mapred.JobConf |
createBaseHadoopConf(ActionExecutor.Context context,
org.jdom.Element actionXml) |
protected org.apache.hadoop.mapred.JobClient |
createJobClient(ActionExecutor.Context context,
org.apache.hadoop.mapred.JobConf jobConf)
Create job client object
|
void |
end(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
End an action after it has executed.
|
int |
extractHeapSizeMB(java.lang.String input) |
protected java.util.HashMap<java.lang.String,CredentialsProperties> |
getActionCredentialsProperties(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action) |
protected void |
getActionData(org.apache.hadoop.fs.FileSystem actionFs,
org.apache.hadoop.mapred.RunningJob runningJob,
org.apache.oozie.client.WorkflowAction action,
ActionExecutor.Context context)
Get the output data of an action.
|
protected java.lang.String |
getActualExternalId(org.apache.oozie.client.WorkflowAction action)
Useful for overriding in actions that do subsequent job runs
such as the MapReduce Action, where the launcher job is not the
actual job that then gets monitored.
|
protected boolean |
getCaptureOutput(org.apache.oozie.client.WorkflowAction action) |
static java.util.List<java.lang.Class> |
getCommonLauncherClasses() |
protected CredentialsProperties |
getCredProperties(ActionExecutor.Context context,
java.lang.String credName) |
protected java.lang.String |
getDefaultShareLibName(org.jdom.Element actionXml)
Returns the default sharelib name for the action if any.
|
java.util.List<java.lang.Class> |
getLauncherClasses() |
protected java.lang.String |
getLauncherMain(org.apache.hadoop.conf.Configuration launcherConf,
org.jdom.Element actionXml) |
static int |
getMaxExternalStatsSize()
Get the maximum allowed size of stats
|
protected static int |
getMaxOutputData(org.apache.hadoop.conf.Configuration actionConf) |
protected org.apache.hadoop.mapred.RunningJob |
getRunningJob(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action,
org.apache.hadoop.mapred.JobClient jobClient) |
java.lang.String[] |
getShareLibFilesForActionConf() |
protected java.lang.String[] |
getShareLibNames(ActionExecutor.Context context,
org.jdom.Element actionXml,
org.apache.hadoop.conf.Configuration conf)
Return the sharelib names for the action.
|
protected static java.lang.String |
getTrimmedEncodedPath(java.lang.String path) |
void |
initActionType()
Invoked once at system initialization time.
|
boolean |
isCompleted(java.lang.String externalStatus)
Return if the external status indicates that the action has completed.
|
void |
kill(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
Kill an action.
|
static void |
parseJobXmlAndConfiguration(ActionExecutor.Context context,
org.jdom.Element element,
org.apache.hadoop.fs.Path appPath,
org.apache.hadoop.conf.Configuration conf) |
static void |
parseJobXmlAndConfiguration(ActionExecutor.Context context,
org.jdom.Element element,
org.apache.hadoop.fs.Path appPath,
org.apache.hadoop.conf.Configuration conf,
boolean isLauncher) |
void |
prepareActionDir(org.apache.hadoop.fs.FileSystem actionFs,
ActionExecutor.Context context) |
boolean |
requiresNameNodeJobTracker()
Returns true if this action type requires a NameNode and JobTracker.
|
protected void |
setActionCompletionData(ActionExecutor.Context context,
org.apache.hadoop.fs.FileSystem actionFs)
Sets some data for the action on completion
|
protected java.util.HashMap<java.lang.String,CredentialsProperties> |
setCredentialPropertyToActionConf(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action,
org.apache.hadoop.conf.Configuration actionConf) |
protected void |
setCredentialTokens(org.apache.hadoop.mapred.JobConf jobconf,
ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action,
java.util.HashMap<java.lang.String,CredentialsProperties> credPropertiesMap) |
void |
setLibFilesArchives(ActionExecutor.Context context,
org.jdom.Element actionXml,
org.apache.hadoop.fs.Path appPath,
org.apache.hadoop.conf.Configuration conf) |
void |
start(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
Start an action.
|
void |
submitLauncher(org.apache.hadoop.fs.FileSystem actionFs,
ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action) |
boolean |
supportsConfigurationJobXML()
Returns true if this action type supports a Configuration and JobXML.
|
convertException, disableInit, enableInit, getActionDir, getActionDirPath, getActionSignal, getActionYarnTag, getMaxRetries, getOozieConf, getOozieRuntimeDir, getOozieSystemId, getRetryInterval, getRetryPolicy, getType, registerError, resetInitInfo, setMaxRetries, setRetryInterval, setRetryPolicypublic static final java.lang.String HADOOP_JOB_TRACKER
public static final java.lang.String HADOOP_JOB_TRACKER_2
public static final java.lang.String HADOOP_YARN_RM
public static final java.lang.String HADOOP_NAME_NODE
public static final java.lang.String OOZIE_COMMON_LIBDIR
public static final java.lang.String MAX_EXTERNAL_STATS_SIZE
public static final java.lang.String ACL_VIEW_JOB
public static final java.lang.String ACL_MODIFY_JOB
public static final java.lang.String HADOOP_YARN_UBER_MODE
public static final java.lang.String OOZIE_ACTION_LAUNCHER_PREFIX
public static final java.lang.String HADOOP_YARN_KILL_CHILD_JOBS_ON_AMRESTART
public static final java.lang.String HADOOP_MAP_MEMORY_MB
public static final java.lang.String HADOOP_CHILD_JAVA_OPTS
public static final java.lang.String HADOOP_MAP_JAVA_OPTS
public static final java.lang.String HADOOP_REDUCE_JAVA_OPTS
public static final java.lang.String HADOOP_CHILD_JAVA_ENV
public static final java.lang.String HADOOP_MAP_JAVA_ENV
public static final java.lang.String YARN_AM_RESOURCE_MB
public static final java.lang.String YARN_AM_COMMAND_OPTS
public static final java.lang.String YARN_AM_ENV
public static final int YARN_MEMORY_MB_MIN
public static final java.lang.String CONF_HADOOP_YARN_UBER_MODE
public static final java.lang.String HADOOP_JOB_CLASSLOADER
public static final java.lang.String HADOOP_USER_CLASSPATH_FIRST
public static final java.lang.String OOZIE_CREDENTIALS_SKIP
public XConfiguration workflowConf
public JavaActionExecutor()
protected JavaActionExecutor(java.lang.String type)
public static java.util.List<java.lang.Class> getCommonLauncherClasses()
public java.util.List<java.lang.Class> getLauncherClasses()
public void initActionType()
ActionExecutorActionExecutor.registerError(java.lang.String, org.apache.oozie.action.ActionExecutorException.ErrorType, java.lang.String) method to register
all its possible errors. Subclasses overriding must invoke super.initActionType in class ActionExecutorpublic static int getMaxExternalStatsSize()
public org.apache.hadoop.mapred.JobConf createBaseHadoopConf(ActionExecutor.Context context, org.jdom.Element actionXml)
public int extractHeapSizeMB(java.lang.String input)
public static void parseJobXmlAndConfiguration(ActionExecutor.Context context, org.jdom.Element element, org.apache.hadoop.fs.Path appPath, org.apache.hadoop.conf.Configuration conf) throws java.io.IOException, ActionExecutorException, HadoopAccessorException, java.net.URISyntaxException
java.io.IOExceptionActionExecutorExceptionHadoopAccessorExceptionjava.net.URISyntaxExceptionpublic static void parseJobXmlAndConfiguration(ActionExecutor.Context context, org.jdom.Element element, org.apache.hadoop.fs.Path appPath, org.apache.hadoop.conf.Configuration conf, boolean isLauncher) throws java.io.IOException, ActionExecutorException, HadoopAccessorException, java.net.URISyntaxException
java.io.IOExceptionActionExecutorExceptionHadoopAccessorExceptionjava.net.URISyntaxExceptionpublic void prepareActionDir(org.apache.hadoop.fs.FileSystem actionFs, ActionExecutor.Context context) throws ActionExecutorException
ActionExecutorExceptionprotected void addShareLib(org.apache.hadoop.conf.Configuration conf, java.lang.String[] actionShareLibNames) throws ActionExecutorException
ActionExecutorExceptionprotected void addSystemShareLibForAction(org.apache.hadoop.conf.Configuration conf) throws ActionExecutorException
ActionExecutorExceptionprotected void addActionLibs(org.apache.hadoop.fs.Path appPath, org.apache.hadoop.conf.Configuration conf) throws ActionExecutorException
ActionExecutorExceptionpublic void setLibFilesArchives(ActionExecutor.Context context, org.jdom.Element actionXml, org.apache.hadoop.fs.Path appPath, org.apache.hadoop.conf.Configuration conf) throws ActionExecutorException
ActionExecutorExceptionprotected static java.lang.String getTrimmedEncodedPath(java.lang.String path)
protected java.lang.String getLauncherMain(org.apache.hadoop.conf.Configuration launcherConf, org.jdom.Element actionXml)
protected static int getMaxOutputData(org.apache.hadoop.conf.Configuration actionConf)
public void submitLauncher(org.apache.hadoop.fs.FileSystem actionFs, ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
ActionExecutorExceptionprotected java.util.HashMap<java.lang.String,CredentialsProperties> setCredentialPropertyToActionConf(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action, org.apache.hadoop.conf.Configuration actionConf) throws java.lang.Exception
java.lang.Exceptionprotected void setCredentialTokens(org.apache.hadoop.mapred.JobConf jobconf, ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action, java.util.HashMap<java.lang.String,CredentialsProperties> credPropertiesMap) throws java.lang.Exception
java.lang.Exceptionprotected java.util.HashMap<java.lang.String,CredentialsProperties> getActionCredentialsProperties(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws java.lang.Exception
java.lang.Exceptionprotected CredentialsProperties getCredProperties(ActionExecutor.Context context, java.lang.String credName) throws java.lang.Exception
java.lang.Exceptionpublic void start(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
ActionExecutorActionExecutor.Context.setStartData(java.lang.String, java.lang.String, java.lang.String) method must be called within this method. If the
action has completed, the ActionExecutor.Context.setExecutionData(java.lang.String, java.util.Properties) method must be called within this method.start in class ActionExecutorcontext - executor context.action - the action to start.ActionExecutorException - thrown if the action could not start.public void end(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
ActionExecutorActionExecutor.Context.setEndData(org.apache.oozie.client.WorkflowAction.Status, java.lang.String) method must be called within this
method.end in class ActionExecutorcontext - executor context.action - the action to end.ActionExecutorException - thrown if the action could not end.protected org.apache.hadoop.mapred.JobClient createJobClient(ActionExecutor.Context context, org.apache.hadoop.mapred.JobConf jobConf) throws HadoopAccessorException
context - jobConf - HadoopAccessorExceptionprotected org.apache.hadoop.mapred.RunningJob getRunningJob(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action, org.apache.hadoop.mapred.JobClient jobClient) throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String getActualExternalId(org.apache.oozie.client.WorkflowAction action)
public void check(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
ActionExecutorActionExecutor.Context.setExecutionData(java.lang.String, java.util.Properties) method must be called within this method. If the action
has not completed, the ActionExecutor.Context.setExternalStatus(java.lang.String) method must be called within this method.check in class ActionExecutorcontext - executor context.action - the action to end.ActionExecutorException - thrown if the action could not be checked.protected void getActionData(org.apache.hadoop.fs.FileSystem actionFs, org.apache.hadoop.mapred.RunningJob runningJob, org.apache.oozie.client.WorkflowAction action, ActionExecutor.Context context) throws HadoopAccessorException, org.jdom.JDOMException, java.io.IOException, java.net.URISyntaxException
actionFs - the FileSystem objectrunningJob - the runningJobaction - the Workflow actioncontext - executor contextHadoopAccessorExceptionorg.jdom.JDOMExceptionjava.io.IOExceptionjava.net.URISyntaxExceptionprotected boolean getCaptureOutput(org.apache.oozie.client.WorkflowAction action) throws org.jdom.JDOMException
org.jdom.JDOMExceptionpublic void kill(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
ActionExecutorActionExecutor.Context.setEndData(org.apache.oozie.client.WorkflowAction.Status, java.lang.String) method must be called within this method.kill in class ActionExecutorcontext - executor context.action - the action to kill.ActionExecutorException - thrown if the action could not be killed.public boolean isCompleted(java.lang.String externalStatus)
ActionExecutorisCompleted in class ActionExecutorexternalStatus - external status to check.protected java.lang.String[] getShareLibNames(ActionExecutor.Context context, org.jdom.Element actionXml, org.apache.hadoop.conf.Configuration conf)
NULL or empty, it means that the action does not use the action
sharelib.
If a non-empty string, i.e. foo, it means the action uses the
action sharelib sub-directory foo and all JARs in the sharelib
foo directory will be in the action classpath. Multiple sharelib
sub-directories can be specified as a comma separated list.
The resolution is done using the following precedence order:
getDefaultShareLibName() methodcontext - executor context.actionXml - conf - action configuration.protected java.lang.String getDefaultShareLibName(org.jdom.Element actionXml)
actionXml - the action XML fragment.NULL if none.public java.lang.String[] getShareLibFilesForActionConf()
protected void setActionCompletionData(ActionExecutor.Context context, org.apache.hadoop.fs.FileSystem actionFs) throws java.io.IOException, HadoopAccessorException, java.net.URISyntaxException
context - executor contextactionFs - the FileSystem objectjava.io.IOExceptionHadoopAccessorExceptionjava.net.URISyntaxExceptionpublic boolean requiresNameNodeJobTracker()
ActionExecutorrequiresNameNodeJobTracker in class ActionExecutorpublic boolean supportsConfigurationJobXML()
ActionExecutorsupportsConfigurationJobXML in class ActionExecutorCopyright © 2017 Apache Software Foundation. All Rights Reserved.