Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 08-17-2016 11:00 AM
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.shBelow 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>
Created 08-18-2016 05:00 AM
@ 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
Created 08-18-2016 03:44 AM
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.
Created 08-18-2016 05:00 AM
@ 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
Created 08-18-2016 06:47 AM
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.