public class SshActionExecutor extends ActionExecutor
ActionExecutor.Context| Modifier and Type | Field and Description |
|---|---|
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 |
CONF_PREFIX, ERROR_OTHER, MAX_RETRIES, requiresNNJT, RETRY_INTERVAL| Modifier | Constructor and Description |
|---|---|
protected |
SshActionExecutor() |
| Modifier and Type | Method and Description |
|---|---|
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,
boolean preserveArgs)
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.
|
convertException, disableInit, enableInit, getActionDir, getActionDirPath, getActionSignal, getMaxRetries, getOozieConf, getOozieRuntimeDir, getOozieSystemId, getRetryInterval, getType, registerError, resetInitInfo, setMaxRetries, setRetryIntervalpublic 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
protected SshActionExecutor()
public void initActionType()
initActionType in class ActionExecutorpublic void check(ActionExecutor.Context context, org.apache.oozie.client.WorkflowAction action) throws ActionExecutorException
check in class ActionExecutorcontext - 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 ActionExecutorcontext - 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 ActionExecutorcontext - 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 pathpublic 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, boolean preserveArgs) 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 rerunpreserveArgs - tell the ssh scripts to preserve or flatten the argumentsIOException - 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 ActionExecutorcontext - 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)
ActionExecutorisCompleted in class ActionExecutorexternalStatus - external status to check.Copyright © 2014 Apache Software Foundation. All Rights Reserved.