Skip to content

Instantly share code, notes, and snippets.

@paraita
Last active March 23, 2018 13:54
Show Gist options
  • Save paraita/5033b4baf1173d73180947379e5d80f7 to your computer and use it in GitHub Desktop.
Save paraita/5033b4baf1173d73180947379e5d80f7 to your computer and use it in GitHub Desktop.
The ping pong workflow
<?xml version="1.0" encoding="UTF-8"?>
<job
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:proactive:jobdescriptor:3.10"
xsi:schemaLocation="urn:proactive:jobdescriptor:3.10 http://www.activeeon.com/public_content/schemas/proactive/jobdescriptor/3.10/schedulerjob.xsd"
name="EscapeDeath" projectName="Epoch${COUNTER}"
priority="normal"
onTaskError="continueJobExecution"
maxNumberOfExecution="2"
>
<variables>
<variable name="COUNTER" value="0" />
</variables>
<genericInformation>
<info name="bucketName" value="paraita"/>
<info name="pca.action.icon" value="/automation-dashboard/styles/patterns/img/wf-icons/controls_submit_job_no_wait.png"/>
<info name="group" value="public-objects"/>
</genericInformation>
<taskFlow>
<task name="SubmitJobNoWait">
<description>
<![CDATA[ The simplest task, ran by a groovy engine. ]]>
</description>
<variables>
<variable name="workflowURL" value="http://try.activeeon.com:8080/workflow-catalog/buckets/1/workflows/4?alt=xml" inherited="false" model="String"/>
</variables>
<genericInformation>
<info name="TASK.ICON" value="/automation-dashboard/styles/patterns/img/wf-icons/controls_submit_job_no_wait.png"/>
</genericInformation>
<scriptExecutable>
<script>
<code language="groovy">
<![CDATA[
// connect to the scheduler
schedulerapi.connect()
// get the job URL from Task Variables
jobURL = new URL("https://gist.githubusercontent.com/paraita/5033b4baf1173d73180947379e5d80f7/raw/6e6e1830a287584c70078ae25b45a1818056c684/pingpong.xml")
counter = variables.get("COUNTER").toInteger() + 1
variables = ["COUNTER": Integer.toString(counter)]
// add sessionId to request header map
requestHeader = Collections.singletonMap("sessionId", schedulerapi.getSession())
// submitting the job
jobid = schedulerapi.submit(jobURL, variables, requestHeader)
]]>
</code>
</script>
</scriptExecutable>
</task>
</taskFlow>
</job>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment