Support Questions

Find answers, ask questions, and share your expertise

Oozie job is getting killed

avatar
Rising Star

I am trying to schedule a Oozie job (Shell Action).

But it is getting killed by going to <fail-output> section after script execution and <capture-output/> action.

Same job is however running fine from example folder.

Below is the job.properties we are using.

nameNode=hdfs://ip-xxx-xx-xx-xx
jobTracker=ip-xxx-xx-xx-xx
queueName=default 
examplesRoot=examples 
oozie.use.system.libpath=true 
oozie.libpath=${nameNode}/user/oozie/share/lib 
oozie.wf.application.path=${nameNode}/user/${user.name}/generic/oozie_dir
myscript=myscript.sh 
myscriptPath=${oozie.wf.application.path}/myscript.sh

Below is the workflow.xml we are using.

<workflow-app
xmlns="uri:oozie:workflow:0.4" name="shell-wf">  <start
to="shell-node"/>  <action
name="shell-node"> 
<shell xmlns="uri:oozie:shell-action:0.2"> 
<job-tracker>${jobTracker}</job-tracker> 
<name-node>${nameNode}</name-node> 
<configuration> 
<property> 
<name>mapred.job.queue.name</name> 
<value>${queueName}</value> 
</property> 
</configuration> 
<!-- <exec>echo</exec> --><!--
 <argument>my_output='Hello'</argument> --> 
<exec>${myscript}</exec> 
<file>${myscriptPath}</file> 
<capture-output/> 
</shell> 
<ok to="check-output"/> 
<error to="fail"/> 
</action> 
<decision name="check-output"> 
<switch> 
<case to="end"> 
${wf:actionData('shell-node')['my_output'] eq 'Hello'} 
</case> 
<default to="fail-output"/> 
</switch> 
</decision>  <kill
name="fail"> 
<message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message> 
</kill>  <kill
name="fail-output"> 
<message>Incorrect output, expected [Hello] but was
[${wf:actionData('shell-node')['my_output']}]</message> 
</kill>  <end
name="end"/></workflow-app>
1 ACCEPTED SOLUTION

avatar
Rising Star

@ Gaurab D can you share your shell script?

Looks like the script has been executed but the desired output which we are comparing are not correct?

Thanks

View solution in original post

3 REPLIES 3

avatar
Expert Contributor

Shell action will get executed on one of the data nodes. Have you tried executing the script there?

If you want to execute your script on a specific node I would look into using ssh action to ssh to the node you've succesffuly run the script on.

avatar
Rising Star

@ Gaurab D can you share your shell script?

Looks like the script has been executed but the desired output which we are comparing are not correct?

Thanks

avatar
Rising Star

Hi Murali, you are right. Script was executing but output wasn't matching with the below action.

${wf:actionData('shell-node')['my_output'] eq 'Hello'}

Now, I have changed the shell script as below and oozie job has finished successfully.

>> echo "my_output=Hello"

Thanks.