K S Nidhin
K S Nidhin

Reputation: 2650

Delete hdfs path after executing the action in oozie

How do I delete a hdfs path after executing an action similar to the prepare tag which deletes before the action.

<workflow-app name="[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.2">
    ...
    <action name="[NODE-NAME]">
        <pig>
            <job-tracker>[JOB-TRACKER]</job-tracker>
            <name-node>[NAME-NODE]</name-node>
            <prepare>
               <delete path="[PATH]"/>
               ...
               <mkdir path="[PATH]"/>
               ...
            </prepare>
            <job-xml>[JOB-XML-FILE]</job-xml>
            <configuration>
                <property>
                    <name>[PROPERTY-NAME]</name>
                    <value>[PROPERTY-VALUE]</value>
                </property>
                ...
            </configuration>
            <script>[PIG-SCRIPT]</script>
            <param>[PARAM-VALUE]</param>
                ...
            <param>[PARAM-VALUE]</param>
            <argument>[ARGUMENT-VALUE]</argument>
                ...
            <argument>[ARGUMENT-VALUE]</argument>
            <file>[FILE-PATH]</file>
            ...
            <archive>[FILE-PATH]</archive>
            ...
        </pig>
        <ok to="[NODE-NAME]"/>
        <error to="[NODE-NAME]"/>
    </action>
    ...
</workflow-app>

Upvotes: 1

Views: 2898

Answers (1)

Alex Libov
Alex Libov

Reputation: 1491

There is no equivalent in the pig action.

You basically have two options:

  • Add delete commands inside your pig script
  • Add a fs action either in the ok element or in both ok and error elements. Note that you need two different actions if you want the flows for success or failure to differ after the deletion.

Upvotes: 1

Related Questions