<?xml version="1.0" encoding="UTF-8"?>
<pipeline
   xmlns="http://glast-ground.slac.stanford.edu/pipeline"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://glast-ground.slac.stanford.edu/pipeline http://glast-ground.slac.stanford.edu/pipeline/schemas/2.0/pipeline.xsd">
   <task>
      <name>Complex Example</name>
      <version>
         <major>1</major>
         <minor>0</minor>
      </version>
      <type>Data</type>
      <notation>Just Testing</notation>
      <prerequisites>
         <prerequisite></prerequisite>
      </prerequisites>
      <process name="step1" type="script">
         <notation>Simple Example Step 1</notation>
         <script language="python">
            <![CDATA[
            from java.lang import Thread
            print "Hello from Step1"
            Thread.currentThread().sleep(5000)
            pipeline.setVariable("message","Hello from Step1")
            for i in range(1,100):
               pipeline.createSubstream("Example Subtask",i)
            print "Gooodbye from Step1"
            ]]>
         </script>
         <!--
         <createsSubtasks>
            <subtask>Example Subtask</subtask>
         </createsSubtasks>
         -->
      </process>
      <process name="step2" type="script">
         <notation>Simple Example Step 2</notation>
         <script language="python">
            <![CDATA[
            from java.lang import Thread
            from java.util import Random
            print "Hello from step2"
            Thread.currentThread().sleep(Random().nextInt(10000))
            pipeline.setVariable("message","Hello from step2")
            print "Gooodbye from step2"
            ]]>
         </script>
         <depends>
            <after process="Example Subtask.stepA" status="DONE"/>
         </depends>
      </process>
      <process name="step3" type="script">
         <notation>Simple Example Step 3</notation>
         <script language="python">
            <![CDATA[
            from java.lang import Thread
            from java.util import Random
            print "Hello from step3"
            Thread.currentThread().sleep(Random().nextInt(10000))
            pipeline.setVariable("message","Hello from step3")
            print "Gooodbye from step3"
            ]]>
         </script>
         <depends>
            <after process="Example Subtask.stepB" status="DONE"/>
         </depends>
      </process>
      
      <task>
         <name>Example Subtask</name>
         <version>
            <major>1</major>
            <minor>0</minor>
         </version>
         <type>Data</type>
         <notation>Just Testing</notation>
         <prerequisites>
            <prerequisite></prerequisite>
         </prerequisites>
         <process name="stepA" type="script">
            <notation>Simple Example Step A</notation>
            <script language="python">
               <![CDATA[
               from java.lang import Thread
               print "Hello from stepA"
               Thread.currentThread().sleep(5000)
               pipeline.setVariable("message","Hello from stepA")
               print "Gooodbye from stepA"
               ]]>
            </script>
         </process>
         <process name="stepB" type="script">
            <notation>Simple Example Step B</notation>
            <script language="python">
               <![CDATA[
               from java.lang import Thread
               print "Hello from stepB"
               Thread.currentThread().sleep(5000)
               pipeline.setVariable("message","Hello from stepB")
               print "Gooodbye from stepB"
               ]]>
            </script>
            <depends>
               <after process="stepA" status="DONE"/>
            </depends>
         </process>
      </task>
   </task>
</pipeline>
