Reply
Contributor
Posts: 58
Registered: ‎10-19-2014
Accepted Solution

Send email from Oozie Kill section

[ Edited ]

Hello,

I would like to send an email in case an oozie workflow fails, i.e. from the "kill" section of the workflow. Is this possible? The documentation I found on oozie website only mentions the "message" element which simply writes to a log.

 

https://oozie.apache.org/docs/4.0.0/WorkflowFunctionalSpec.html#a3.1.3_Kill_Control_Node

 

Thanks, Martin

Cloudera Employee
Posts: 85
Registered: ‎07-31-2013

Re: Send email from Oozie Kill section

Hey,

 

You can't have a kill action send an email.  However, you can have your other actions change their kill to be an email action that sends the email and then the email action goes to a kill.  Like:

 

<workflow-app name="shell-wf" xmlns="uri:oozie:workflow:0.4">
<start to="shell"/>
<action name="shell">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<exec>shell.sh</exec>
<file>shell.sh#shell.sh</file>
</shell>
<ok to="end"/>
<error to="kill-email"/>
</action>
<action name="kill-email">
<email xmlns="uri:oozie:email-action:0.1">
<to>cconner@test.com</to>
<cc>other-cconner@test.com</cc>
<subject>WF ${wf:id()} failed</subject>
<body>Shell action failed.</body>
</email>
<ok to="kill"/>
<error to="kill"/>
</action>
<kill name="kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>

Contributor
Posts: 58
Registered: ‎10-19-2014

Re: Send email from Oozie Kill section

Thanks, that does the trick!
Highlighted
New Contributor
Posts: 1
Registered: ‎11-30-2017

Re: Send email from Oozie Kill section

[ Edited ]

How about rerun? If the oozie job fails during rerun this email action will not send email as this action is marked as SUCCESS during first run. How to kick email action during failure in rerun?

 

Thanks.

Announcements