Dummy example of looping
Created: 2010-01-27 15:52:50
Last updated: 2013-10-08 11:24:47
Example of looping over asynchronous services. The dummy beanshell scripts represents the operations of an asynchronous submit-status-results style service, such as EBI's
InterProScan and
NCBI Blast.
createJob creates a temporary file with the content "0". Filename retuirned as a "job ID".
checkStatus reads the job, and return state "RUNNING" as long as the content is less than 10, increasing the number for each call. (As no actual job is being run)
getResults reads the file content, with the condition 'Run after checkStatus'.
In Details->Advanced for checkStatus you can check the loop condition, which says it will loop as long as the output 'state' is equal to 'RUNNING' - with a 0.5s delay.
Thus when executing this workflow, checkStatus will be called repeatedly, and finally the 'result' should be '10' and 'state' should be 'COMPLETE'.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (1)
Descriptions (4)
Example of looping over asynchronous services. The dummy beanshell scripts represents the operations of an asynchronous submit-status-results style service, such as EBI's InterProScan and NCBI Blast.
createJob creates a temporary file with the content "0". Filename retuirned as a "job ID".
checkStatus reads the job, and return state "RUNNING" as long as the content is less than 10, increasing the number for each call. (As no actual job is being run)
getResults reads the file content, with the condition 'Run after checkStatus'.
In Details->Advanced for checkStatus you can check the loop condition for checkStatus, which says it will loop as long as the output 'state' is equal to 'RUNNING' - with a 0.5s delay.
Thus when executing this workflow, checkStatus will be called repeatedly, and finally the 'result' should be '10' and 'state' should be 'COMPLETE'.
See http://www.mygrid.org.uk/dev/wiki/display/scrap/Looping+in+Taverna+2.1 for details |
createJob creates a temporary file with the content "0". Filename retuirned as a "job ID".
checkStatus reads the job, and return state "RUNNING" as long as the content is less than 10, increasing the number for each call. (As no actual job is being run)
getResults reads the file content, with the condition 'Run after checkStatus'.
In Details->Advanced for checkStatus you can check the loop condition for checkStatus, which says it will loop as long as the output 'state' is equal to 'RUNNING' - with a 0.5s delay.
Thus when executing this workflow, checkStatus will be called repeatedly, and finally the 'result' should be '10' and 'state' should be 'COMPLETE'.
See http://www.mygrid.org.uk/dev/wiki/display/scrap/Looping+in+Taverna+2.1 for details |
createJob creates a temporary file with the content "0". Filename retuirned as a "job ID".
checkStatus reads the job, and return state "RUNNING" as long as the content is less than 10, increasing the number for each call. (As no actual job is being run)
getResults reads the file content, with the condition 'Run after checkStatus'.
In Details->Advanced for checkStatus you can check the loop condition for checkStatus, which says it will loop as long as the output 'state' is equal to 'RUNNING' - with a 0.5s delay.
Thus when executing this workflow, checkStatus will be called repeatedly, and finally the 'result' should be '10' and 'state' should be 'COMPLETE'.
See |
createJob creates a temporary file with the content "0". Filename retuirned as a "job ID".
checkStatus reads the job, and return state "RUNNING" as long as the content is less than 10, increasing the number for each call. (As no actual job is being run)
getResults reads the file content, with the condition 'Run after checkStatus'.
In Details->Advanced for checkStatus you can check the loop condition for checkStatus, which says it will loop as long as the output 'state' is equal to 'RUNNING' - with a 0.5s delay.
Thus when executing this workflow, checkStatus will be called repeatedly, and finally the 'result' should be '10' and 'state' should be 'COMPLETE'. |
Dependencies (0)
Processors (3)
Name |
Type |
Description |
createJob |
beanshell |
Scriptimport org.apache.commons.io.FileUtils;
file = File.createTempFile("example", "looping");
value = "0";
FileUtils.writeStringToFile(file, value, "utf-8");
jobId = file.getAbsolutePath();
|
checkStatus |
beanshell |
Scriptimport org.apache.commons.io.FileUtils;
file = new File(jobId);
value = FileUtils.readFileToString(file, "utf-8");
intValue = Integer.parseInt(value);
if (intValue < 10) {
state = "RUNNING";
// Increment for next time around
intValue++;
value = Integer.toString(intValue);
FileUtils.writeStringToFile(file, value, "utf-8");
} else {
state = "COMPLETE";
}
|
getResults |
beanshell |
Scriptimport org.apache.commons.io.FileUtils;
file = new File(jobId);
value = FileUtils.readFileToString(file, "utf-8");
|
Beanshells (3)
Name |
Description |
Inputs |
Outputs |
createJob |
|
|
jobId
value
|
checkStatus |
|
jobId
|
state
|
getResults |
|
jobId
|
value
|
Outputs (4)
Name |
Description |
jobId |
|
initial_value |
|
state |
|
result |
|
Datalinks (6)
Source |
Sink |
createJob:jobId |
checkStatus:jobId |
createJob:jobId |
getResults:jobId |
createJob:jobId |
jobId |
createJob:value |
initial_value |
checkStatus:state |
state |
getResults:value |
result |
Coordinations (1)
Controller |
Target |
checkStatus |
getResults |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1 (earliest)
(of 3)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (1)
(Workflows/Files)
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment