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

Send email from Oozie Kill section

[ Edited ]


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.


Thanks, Martin

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

Re: Send email from Oozie Kill section



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">
<ok to="end"/>
<error to="kill-email"/>
<action name="kill-email">
<email xmlns="uri:oozie:email-action:0.1">
<subject>WF ${wf:id()} failed</subject>
<body>Shell action failed.</body>
<ok to="kill"/>
<error to="kill"/>
<kill name="kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
<end name="end"/>

Posts: 58
Registered: ‎10-19-2014

Re: Send email from Oozie Kill section

Thanks, that does the trick!
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?