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

Richard Williams commented on OOZIE-1920:
-----------------------------------------

After looking through the Oozie code for a while, I believe I understand what's 
causing this problem.

Basically, the issue is with the WorkflowJobBean contained in the 
ActionExecutorContext that gets passed to the SshActionExecutor's start, check, 
end, and kill methods by the corresponding ActionXCommands. The ActionXCommands 
in question appear to populate it in their loadState methods using one of two 
different named queries, both defined in WorkflowJobBean.java. In the case of 
ActionStartXCommand, the query is GET_WORKFLOW, which is defined as: 
{code}"select OBJECT(w) from WorkflowJobBean w where w.id = :id"{code} In the 
case of ActionCheckXCommand, ActionEndXCommand, and ActionKillXCommand, the 
query is GET_WORKFLOW_ACTION_OP, which is defined as: {code}"select w.id, 
w.user, w.group, w.appName, w.appPath, w.statusStr, w.parentId, w.logToken, 
w.wfInstance, w.protoActionConf from WorkflowJobBean w where w.id = :id"{code} 
Missing from GET_WORKFLOW_ACTION_OP is WorkflowJobBean's run field...which 
defaults to 1.

The upshot of all this is that whenever ActionStartXCommand calls start on an 
ActionExecutor, the context it passes to the executor will have a 
WorkflowJobBean with all of its fields populated, but whenever 
ActionCheckXCommand calls check on an ActionExecutor, the context it passes to 
the executor will have a WorkflowJobBean whose run field is 1. Since the 
process that gets the running PID of the SSH action's configured command is 
executed in SshActionExecutor's start method, it checks the correct file; in 
contrast, since the processes that capture the command's output and check for 
its failure are executed in SshActionExecutor's check method, they always check 
the files that would have been created if the run were 1...even on run 0, 2, 3, 
and so on.

> Capture Output for SSH Action doesn't work
> ------------------------------------------
>
>                 Key: OOZIE-1920
>                 URL: https://issues.apache.org/jira/browse/OOZIE-1920
>             Project: Oozie
>          Issue Type: Bug
>          Components: action
>    Affects Versions: 4.0.0
>         Environment: CDH 5.0.2
>            Reporter: Alessandro Costantino
>            Priority: Blocker
>              Labels: cloudera, oozie, ssh
>
> Running a simple workflow that have a shell action with capture-output 
> enabled, the SShActionExecutor look at the wrong stdout file. This is the the 
> command that I found in the log:
>     ssh -o PasswordAuthentication=no -o KbdInteractiveDevices=no -o 
> StrictHostKeyChecking=no -o ConnectTimeout=20 workflow@redhat5 cat 
> oozie-oozi/0000008-140708170302737-oozie-oozi-W/fileProcessing--ssh/22350.0000008-140708170302737-oozie-oozi-W@fileProcessing@1.stdout
> But the generated stdout file is 
> `/home/instadoc/oozie-oozi/0000008-140708170302737-oozie-oozi-W/fileProcessing--ssh/22350.0000008-140708170302737-oozie-oozi-W@fileProcessing@0.stdout`
> If you relaunch the action the ID that prepend the .stdout extension could 
> vary (ie: @9.stdout, @4.stdout) but the SShActionExecutor looks always at 
> @0.stdout.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to