Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Is there anyway to run multiple oozie jobs in sequence.

Is there anyway to run multiple oozie jobs in sequence.

New Contributor

Hi,

Is there anyway to run multiple oozie jobs in sequence.

For example: I have three applications, assume A1,A2,A3. A2 should trigger once A1 has completed execution and A3 should trigger once A2 has completed execution. How can this be acheived using Oozie.

Thanks.

2 REPLIES 2

Re: Is there anyway to run multiple oozie jobs in sequence.

@Saumidh Mhatre

Yes this should be possible by specifying multiple actions in single workflow.xml

<?xml version="1.0" ?>
<workflow-app name="sample" xmlns="uri:oozie:workflow:0.5">
 <global>
  <job-tracker>${RESOURCE_MANAGER}</job-tracker>
  <name-node>${NAME_NODE}</name-node>
  <configuration>
   <property>
    <name>mapreduce.job.queuename</name>
    <value>${DEFAULT_QUEUE}</value>
   </property>
  </configuration>
 </global>
 <start to="query1"/>
 <action name="query1">
  <java>
   <prepare>
    <delete path="/tmp/query1"/>
   </prepare>
   <job-xml>${APP_PATH}/lib/hbase-site.xml</job-xml>
   <main-class>com.org.test.TestSample</main-class>
   <java-opts>-cp $CLASSPATH:/usr/hdp/current/hbase-client/lib/hbase-protocol.jar:/etc/hbase/conf</java-opts>
   <archive>${APP_PATH}/lib/test-sample.jar</archive>
  </java>
  <ok to="metrics"/>
  <error to="kill"/>
 </action>
 <action name="metrics">
  <shell xmlns="uri:oozie:shell-action:0.2">
   <job-tracker>${RESOURCE_MANAGER}</job-tracker>
   <name-node>${NAME_NODE}</name-node>
   <exec>oozie_hook.py</exec>
   <file>${APP_PATH}/shell/oozie_hook.py#oozie_hook.py</file>
  </shell>
  <ok to="end"/>
  <error to="kill"/>
 </action>
 <kill name="kill">
  <message>Workflow action failed, killing workflow</message>
 </kill>
 <end name="end"/>
</workflow-app>

Re: Is there anyway to run multiple oozie jobs in sequence.

Rising Star

@Saumidh Mhatre

And FYI, most actions are asynchronous, so one has to end before the next begins, which you mention you want to happen. For a list of some of the actions available and which are synchronous vs asynchronous, see the Workflow Action Types table in the Workflow Management (WFM) guide (the table applies even if you aren't using WFM, as WFM is based on Oozie).