You should use <capture-output/> and decision node to check for script
failures,
Also, oozie will transition to fail node if the exception is related to ssh
permission or host-connectivity.

Ex;

<action name="add-to-db">
        <ssh>
            <host>${mvn.launcher.host}</host>
            <command>${mvn.user.work.dir}/yourscript.sh</command>
            <args>${finalTime}</args>
            <args>${output}</args>
            <args>conceptual-sizing</args>
            <capture-output/>
        </ssh>
        <ok to="*check-status*" />
        <error to="fail" />
    </action>
    <decision name="check-status">
        <switch>
            <case to="cleanup">
                *${wf:actionData('add-to-db')['output'] == '0'}*
            </case>
            <default to="fail" />
        </switch>
    </decision>

And in Script,

echo *"output=0" *After the required commands.


Thanks,

-Idris


On Mon, Nov 24, 2014 at 11:46 AM, Annie Lane <[email protected]> wrote:

> Hi,
>
> I have the following config in Oozie:
>
>  <action name="publish">
>         <shell xmlns="uri:oozie:shell-action:0.2">
>            <job-tracker>${jobTracker}</job-tracker>
>            <name-node>${nameNode}</name-node>
>            <exec>run</exec>
>            <file>${dir}/run</file>
>            <capture-output/>
>         </shell>
>         <ok to="end"/>
>         <error to="publishfail"/>
>     </action>
>
>     <kill name="publishfail">
>         <message>Publish action failed, error
> message[${wf:errorMessage(wf:lastErrorNode())}]</message>
>     </kill>
>
>  <end name="end"/>
>
> I have broken the shell script on purpose, to test the failure state, but
> when I look at the logs in the Oozie Web Console, I don't see the message
> inside my 'publishfail' kill step. I only see:
>
>
> 2014-11-24 15:01:27,884  WARN ShellActionExecutor:542 - USER[gpadmin]
> GROUP[-] TOKEN[] APP[shell-wf] JOB[0000098-141030154252253-oozie-oozi-W]
> ACTION[0000098-141030154252253-oozie-oozi-W@publish] Launcher ERROR,
> reason: Main class [org.apache.oozie.action.hadoop.ShellMain], exit code
> [1]
> 2014-11-24 15:01:27,947  INFO ActionEndXCommand:539 - USER[gpadmin]
> GROUP[-] TOKEN[] APP[shell-wf] JOB[0000098-141030154252253-oozie-oozi-W]
> ACTION[0000098-141030154252253-oozie-oozi-W@publish] ERROR is considered
> as
> FAILED for SLA
>
> I would like to be able to see what went wrong in the shell script from the
> Oozie web console, is this possible? I would have at least have expected to
> have seen that message "Publish action failed, error...." in the Oozie
> logs.
>
> Thanks.
>

Reply via email to