title: Handling loops in oozie workflow
body: <p>I have an oozie use case for checking input data availability and trigger mapreduce job based on availability of data.
  So I wrote a shell script for checking input data and created an ssh action for it in oozie, </p>
  
  <p>The number of retries and and retry intervals of Input data checking should be configurable and after each retry if the data is still missing I got to send an alert, after specified number of retries mapreduce job can start with the available data </p>
  
  <p>I wrote a workflow as follows : </p>
  
  <pre><code>&lt;start to="datacheck" /&gt;
  
  &lt;action name="datacheck"&gt;
      &lt;ssh xmlns="uri:oozie:ssh-action:0.1"&gt;
          &lt;host&gt;${sshUserHost}&lt;/host&gt;
          &lt;command&gt;${Oozieutilsscript}&lt;/command&gt;
      &lt;/ssh&gt;
      &lt;ok to="datacheckswitch" /&gt;
      &lt;error to="fail" /&gt;
  &lt;/action&gt;
  
  &lt;decision name="datacheckswitch"&gt;
      &lt;switch&gt;
          &lt;case to="mapreduce"&gt;${(wf:actionData('datacheck')['datatransfer'] == "complete" )}&lt;/case&gt;
          &lt;case to="retry"&gt;${(wf:actionData('datacheck')['datatransfer'] == "incomplete" )}&lt;/case&gt;        
          &lt;default to="fail" /&gt;    
      &lt;/switch&gt;
  &lt;/decision&gt;
  
  &lt;action name="retry"&gt;
      &lt;ssh xmlns="uri:oozie:ssh-action:0.1"&gt;
          &lt;host&gt;${sshUserHost}&lt;/host&gt;
          &lt;command&gt;${Oozieutilsscript1}&lt;/command&gt;
      &lt;/ssh&gt;
      &lt;ok to="retryswitch" /&gt;
      &lt;error to="fail" /&gt;
  &lt;/action&gt;
  
  &lt;decision name="retryswitch"&gt;
      &lt;switch&gt;
          &lt;case to="datacheck"&gt;${(wf:actionData('datacheck')['retry'] == "notfinished" )}&lt;/case&gt;
          &lt;case to="datacheck"&gt;${(wf:actionData('datacheck')['retry'] == "finished" )}&lt;/case&gt;     
          &lt;default to="fail" /&gt;    
      &lt;/switch&gt;
  &lt;/decision&gt;
  
  &lt;action name="mapreduce"&gt;
  ...............
  &lt;/action&gt;
  
  
  &lt;!--Kill and End portion--&gt;
  &lt;kill name="fail"&gt;
      &lt;message&gt;Java failed, error message[${wf:errorMessage(wf:lastErrorNode())}&lt;/message&gt;
  &lt;/kill&gt;
  &lt;end name="end" /&gt;
  </code></pre>
  
  <p>Only when I executed the workflow I came to know that oozie doesn't support cycles since its workflow is DAG. got the error Error: E0707 : E0707: Loop detected at parsing, node [datacheck] while parsing workflow.xml</p>
  
  <p>Is there any different approach for handling this usecase ?</p>
  
  <p>Any help is appreciated .</p>