1
votes

I have been trying to trigger an action when an action in oozie fails
I can do this using the error to node as below

<ok to="end"/>
<error to="kill"/>

This will work perfectly fine if my requirement is to do a roll back when the current action fails in oozie.
What i was looking for is to trigger a step in case the workflow is killed (if someone goes to the workflow and clicks the kill button in HUE.)
I could see a node named kill that gets generated in workflow.xml when i use oozie through HUE. I tried to put my custom action in this space but every time i save the xml the workflow gets default value as below

<kill name="kill">
    <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>

Is there any way to perform some action(Some Kind of roll backing) when a oozie workflow is killed ?
Is there any way to capture the Kill action and trigger another workflow ? I have gone through the oozie documentation with no success.
Really apprecitate your help on this.

1
AFAIK the Kill node is a "dead end". It can be a common practice to write to a temporary path all the data and move it to the final expected output path in the last step, so that you don't need to really "rollback" - Romain
@Romain : I too have the same understanding about the Kill node(Dead Node - nothing happens), but what i was trying to achieve is to over ride the Kill action in oozie workflow(using HUE). I am not sure if this can be done or not but if it be done then i can override the kill node and put a scripts that will roll back the data from a table (Hive / RDBMS). Or Can i trigger a workflow if my current workflow is killed ? . I was trying to achieve a clean up scenario for tables when i forcefully kill the workflow with out any manual interventions - Garfield
You could try with a sub-workflow probably - Romain

1 Answers

0
votes

The name attribute in the kill node is the name of the Kill action node. The content of the message element will be logged as the kill reason for the workflow job. A kill node does not have transition elements because it ends the workflow job, as KILLED .

So have you tried calling the rollback action while mention the same in "error to" it self instead of calling the kill. some thing like

<ok to="end"/>
<error to="rollBack_action"/>

and afterwards mentioning the "rollBack_Action" someting like

 <action name='rollBack_action'>
                <java>
                        <job-tracker>${jobTracker}</job-tracker>
                        <name-node>${nameNode}</name-node>
                        <arg>action_roll_back</arg>
                </java>
                <ok to="end"/>
        </action>