[ 
https://issues.apache.org/jira/browse/OOZIE-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16497726#comment-16497726
 ] 

Andras Piros commented on OOZIE-3156:
-------------------------------------

Hi [~txsing], this is only about readability / code maintainability. For 
clarity I'd extract these lines:
{code:java}
                String baseDir = getTestCaseDir();
                Path appPath = new Path(getNameNodeUri(), baseDir);
        
                XConfiguration protoConf = new XConfiguration();
                protoConf.setStrings(WorkflowAppService.HADOOP_USER, 
getTestUser());
        
                XConfiguration wfConf = new XConfiguration();
                wfConf.set(OozieClient.APP_PATH, appPath.toString());
        
                WorkflowJobBean workflow = new WorkflowJobBean();
                workflow.setConf(wfConf.toXmlString());
                workflow.setAppPath(wfConf.get(OozieClient.APP_PATH));
                workflow.setProtoActionConf(protoConf.toXmlString());
                
workflow.setId(Services.get().get(UUIDService.class).generateId(ApplicationType.WORKFLOW));
        
                final WorkflowActionBean action = new WorkflowActionBean();
                action.setId("actionId");
                action.setConf("<ssh xmlns='" + getActionXMLSchema() + "'>" +
                               "<host>localhost</host>" +
                               "<command>echo</command>" +
                               "<capture-output/>" +
                               "<args>\"prop1=something\"</args>" +
                               "</ssh>");
                action.setName("ssh");
{code}

to a method called {{WorkflowActionBean createSshWorkflowAction()}}.

Moreover, I'd extract these lines:
{code:java}
                final SshActionExecutor ssh = new SshActionExecutor();
                final Context context = new Context(workflow, action);
                ssh.start(context, action);
        
                String originTrackerUri = action.getTrackerUri();
                action.setTrackerUri("dummy@dummyHost");
{code}

to a method called {{SshActionExecutor 
createAndStartFailingSshActionExecutor(WorkflowAction base)}}.

> SSH action status turns OK wrongly when failed to connect to host
> -----------------------------------------------------------------
>
>                 Key: OOZIE-3156
>                 URL: https://issues.apache.org/jira/browse/OOZIE-3156
>             Project: Oozie
>          Issue Type: Bug
>          Components: action
>    Affects Versions: 5.0.0
>            Reporter: TIAN XING
>            Assignee: TIAN XING
>            Priority: Major
>         Attachments: OOZIE-3156-v1.patch, OOZIE-3156-v2.patch, 
> OOZIE-3156-v3.patch, ssh-check-bug.patch
>
>
> When {{check()}} method of {{SshActionExecutor}} gets invoked, oozie will ssh 
> connect to the host and check whether the pid of the process that ssh action 
> started is still there (by checking the returned value of command "{{ssh 
> <host-ip> ps -p <pid>}}" ) to determine whether ssh action completes or not.
> However, we found cases where oozie fails to connect to host during action 
> status check (e.g., the host is under heavy load, or network is bad etc.).
> In such cases, the return value of command "{{ssh <host-ip> ps -p <pid>}}" 
> will be 255 (ssh command exits with the exit status of the remote command or 
> with 255 if an error occurred.).
> According the current logic of method {{getActionStatus()}} in 
> {{SshActionExecutor}}, the action status will be determined as OK which may 
> not be correct. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to