Friday, 28 November 2014

Shell Action Execute Python in Oozie

Shell action can directly execute python program with param and module. Don't need include .sh file.


<action name="shell_action">
      <shell xmlns="uri:oozie:shell-action:0.2">
           <job-tracker>${jobTracker}</job-tracker>
           <name-node>${nameNode}</name-node>
           <prepare>
                 <delete path='${db_path}/${report_date}'/>
           </prepare>
           <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
               </property>
           </configuration>
          <exec>python</exec>
          <argument>${python_script}</argument>
         <argument>${report_date}</argument>
         <argument>${db_path}</argument>
         <file>${python_path}</file>
          <file>${lib_path}</file>
          <capture-output/>
      </shell>
      <ok to="end"/>
      <error to="send_email"/>

 </action>

No comments:

Post a Comment