|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.oozie.action.ActionExecutor org.apache.oozie.action.ssh.SshActionExecutor
public class SshActionExecutor
Ssh action executor.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.oozie.action.ActionExecutor |
---|
ActionExecutor.Context |
Field Summary | |
---|---|
static String |
ACTION_TYPE
|
static String |
CONF_SSH_ALLOW_USER_AT_HOST
Configuration parameter which specifies whether the specified ssh user is allowed, or has to be the job user. |
static String |
DELETE_TMP_DIR
|
static String |
ERR_AUTH_FAILED
|
static String |
ERR_COULD_NOT_CONNECT
|
static String |
ERR_EXCEDE_LEN
|
static String |
ERR_EXECUTION_FAILED
|
static String |
ERR_FNF
|
static String |
ERR_HOST_RESOLUTION
|
static String |
ERR_NO_EXEC_PERM
|
static String |
ERR_SETUP_FAILED
|
static String |
ERR_UNKNOWN_ERROR
|
static String |
ERR_USER_MISMATCH
|
static String |
HTTP_COMMAND
|
static String |
HTTP_COMMAND_OPTIONS
|
protected static String |
SCP_COMMAND_BASE
|
protected static String |
SSH_COMMAND_BASE
|
protected static String |
SSH_COMMAND_OPTIONS
|
Fields inherited from class org.apache.oozie.action.ActionExecutor |
---|
CONF_PREFIX, ERROR_OTHER, MAX_RETRIES, requiresNNJT, RETRY_INTERVAL |
Constructor Summary | |
---|---|
protected |
SshActionExecutor()
|
Method Summary | |
---|---|
void |
check(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
Check ssh action status. |
protected String |
doExecute(String host,
String dirLocation,
String cmnd,
String args,
boolean ignoreOutput,
org.apache.oozie.client.WorkflowAction action,
String recoveryId)
Execute the ssh command. |
void |
end(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
End action execution. |
int |
executeCommand(String command)
Utility method to execute command. |
protected org.apache.oozie.client.WorkflowAction.Status |
getActionStatus(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
Get action status. |
String |
getRemoteFileName(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action,
String fileExtension,
boolean dirOnly,
boolean useExtId)
Get remote host working location. |
void |
initActionType()
Initialize Action. |
boolean |
isCompleted(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 ssh action. |
protected String |
setupRemote(String host,
ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
Do ssh action execution setup on remote host. |
void |
start(ActionExecutor.Context context,
org.apache.oozie.client.WorkflowAction action)
Start the ssh action execution. |
Methods inherited from class org.apache.oozie.action.ActionExecutor |
---|
convertException, disableInit, enableInit, getActionDir, getActionDirPath, getActionSignal, getMaxRetries, getOozieConf, getOozieRuntimeDir, getOozieSystemId, getRetryInterval, getType, registerError, resetInitInfo, setMaxRetries, setRetryInterval |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ACTION_TYPE
public static final String CONF_SSH_ALLOW_USER_AT_HOST
protected static final String SSH_COMMAND_OPTIONS
protected static final String SSH_COMMAND_BASE
protected static final String SCP_COMMAND_BASE
public static final String ERR_SETUP_FAILED
public static final String ERR_EXECUTION_FAILED
public static final String ERR_UNKNOWN_ERROR
public static final String ERR_COULD_NOT_CONNECT
public static final String ERR_HOST_RESOLUTION
public static final String ERR_FNF
public static final String ERR_AUTH_FAILED
public static final String ERR_NO_EXEC_PERM
public static final String ERR_USER_MISMATCH
public static final String ERR_EXCEDE_LEN
public static final String DELETE_TMP_DIR
public static final String HTTP_COMMAND
public static final String HTTP_COMMAND_OPTIONS
Constructor Detail |
---|
protected SshActionExecutor()
Method Detail |
---|
public void initActionType()
initActionType
in class ActionExecutor
public void check(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
check
in class ActionExecutor
context
- action execution context.action
- action object.
ActionExecutorException
- thrown if the action could not be checked.public void kill(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
kill
in class ActionExecutor
context
- action execution context.action
- object.
ActionExecutorException
- thrown if the action could not be killed.public void start(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
start
in class ActionExecutor
context
- action execution context.action
- action object.
ActionExecutorException
- thrown if the action could not start.public String getRemoteFileName(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action, String fileExtension, boolean dirOnly, boolean useExtId)
context
- action execution contextaction
- ActionfileExtension
- Extension to be added to file namedirOnly
- Get the Directory onlyuseExtId
- Flag to use external ID in the path
public int executeCommand(String command) throws IOException, InterruptedException
command
- Command to execute as String.
IOException
- if process exits with status nonzero.
InterruptedException
- if process does not run properly.protected String setupRemote(String host, ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws IOException, InterruptedException
host
- host name.context
- action execution context.action
- action object.
IOException
- thrown if failed to setup.
InterruptedException
- thrown if any interruption happens.protected String doExecute(String host, String dirLocation, String cmnd, String args, boolean ignoreOutput, org.apache.oozie.client.WorkflowAction action, String recoveryId) throws IOException, InterruptedException
host
- hostname.dirLocation
- location of the base and wrapper scripts.cmnd
- command to be executed.args
- command arguments.ignoreOutput
- ignore output option.action
- action object.recoveryId
- action id + run number to enable recovery in rerun
IOException
- thrown if failed to run the command.
InterruptedException
- thrown if any interruption happens.public void end(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
end
in class ActionExecutor
context
- action execution context.action
- action object.
ActionExecutorException
- thrown if action end execution fails.protected org.apache.oozie.client.WorkflowAction.Status getActionStatus(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
action
- action object.
ActionExecutorException
- thrown if there is any error in getting status.public boolean isCompleted(String externalStatus)
ActionExecutor
isCompleted
in class ActionExecutor
externalStatus
- external status to check.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |