How to execute one particular workflow action in Oozie. If I killed Oozie workflow manually?

2k Views Asked by At

I have below Oozie workflow,Suppose manually I killed the job when action "Do_task1" was executing, but still I want to execute action "Do_task2" in spite of killing oozie job manually(when action "Do_task1" was running). How can I do that?

<workflow-app name="simple-Workflow"
    xmlns="uri:oozie:workflow:0.4">
    <start to = "Do_task1" />
    <!—Step 1 -->
    <action name = "Do_task1">
        <hive xmlns = "uri:oozie:hive-action:0.4">
            <job-tracker>xyz.com:8088</job-tracker>
            <name-node>hdfs://rootname</name-node>
            <script>hdfs_path_of_script/external.hive</script>
        </hive>
        <ok to = "Do_task2" />
        <error to = "kill_job" />
    </action>
    <!—Step 2 -->
    <action name = "Do_task2">
        <hive xmlns = "uri:oozie:hive-action:0.4">
            <job-tracker>xyz.com:8088</job-tracker>
            <name-node>hdfs://rootname</name-node>
            <script>hdfs_path_of_script/orc.hive</script>
        </hive>
        <ok to = "end" />
        <error to = "kill_job" />
    </action>
    <kill name = "kill_job">
        <message>Job failed</message>
    </kill>
    <end name = "end" />
</workflow-app>
2

There are 2 best solutions below

0
Archit Agarwal On

Once the oozie workflow is killed by killing the first action, it can not be restarted unless this property is set to true in the properties file.

oozie.wf.rerun.failnodes=true 

If you have configured this property , after executing the command:

oozie job -rerun jobId

It will restart the workflow from "Do_task1" and not "Do_task2" with old properties.

Or another way to execute only the second action is : set

 <start to = "Do_task2"/> 

and run the workflow again.

0
user1502721 On

You can trigger that specific oozie action.

oozie job -oozie http://localhost:8080/oozie -rerun <FailedOrKilledWorkflowId> -action <actionName or actionId>