Reputation: 5010
I have around 50 workflows like this, below code just an example,
<workflow-app name="exit_1_email_test" xmlns="uri:oozie:workflow:0.5">
<start to="ssh-8e73"/>
<action name="Kill">
<email xmlns="uri:oozie:email-action:0.2">
<to>***</to>
<cc>***</cc>
<subject>exit1_email_test workflow failed</subject>
<body>exit1_email_test workflow failed on</body>
</email>
<ok to="Kill-kill"/>
<error to="Kill-kill"/>
</action>
<kill name="Kill-kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<action name="ssh-8e73">
<ssh xmlns="uri:oozie:ssh-action:0.1">
<host>[email protected]</host>
<command>bash /home/ubuntu/exit_1.sh</command>
<capture-output/>
</ssh>
<ok to="End"/>
<error to="Kill"/>
</action>
<end name="End"/>
</workflow-app>
I am configuring email action for the workflows so that I can receive notifications in case of any failures.
The parameters in the email action will be mostly same except the workflow name.
How can I configure this email action globally in Oozie instead of configuring the same in each workflow?
Upvotes: 0
Views: 262
Reputation: 361
One of the option is to place the configured email action in a separate workflow and execute it as an sub-workflow in each of 50 workflows:
...
<action name="send-email">
<sub-workflow>
<app-path>[PATH-TO-EMAIL-WORKFLOW-FILE]</app-path>
<propagate-configuration/>
<configuration>
<property>
<name>[WF-NAME-OR-OTHER-PROPERTY-NAME]</name>
<value>[PROPERTY-VALUE]</value>
</property>
...
</configuration>
</sub-workflow>
<ok to="End"/>
<error to="Kill"/>
</action>
...
Upvotes: 1