Access Keys:
Skip to content (Access Key - 0)

Workflow

Taverna Developers Guide

Table of Contents

Introduction


The Taverna Workbench allows users to construct complex analysis workflows from components located on both remote and local machines, run these workflows on their own data and visualise the results. To support this core functionality it also allows various operations on the components themselves such as discovery and description and the selection of personalised libraries of components previously discovered to be useful to a particular application. Aside from creating and editing, the most useful thing to be able to do with a workflow is to run it. The Taverna workbench provides an enactment engine for scientific workflows expressed in Scufl (Simple Conceptual Unified Flow language). The workflows can be run from the GUI provided by the Taverna workbench or they can executed programmatically. Since Taverna version 1.4 it has been possible to execute workflow through the WorkflowLauncher helper class. The WorkflowLauncher class provides API that can used to programmatically execute a workflow.

Workflow Architecture


The Workflow component leverages the same infrastructure stack as the caGrid toolkit (GT4, Tomcat, Java, Ant, and Introduce) with the addition of the Taverna workflow engine. The TavernWorkflowService is a standard Introduce-built grid service that allows a workflow instance to be created from a workflow definition file. An EPR is returned to a WorkflowManagementService resource that can be used to start, cancel, and destroy the created workflow. The WorkflowManagementService is layered on top of the Taverna Workflow Engine, which provides the primary functionality for running the Taverna-defined workflows. See Figure 2 for an overview of this architecture.

The following actions are performed when a user invokes start on the workflow management service:

  • Read the workflow definition file.
InputStream workflowInputStream = getWorkflowInputStream();
  • The input arguments to the workflow are declared as an array of xsd:any. They are parsed and cast to the types that they are meant to be.
  • Read the input parameters.
Map<String, DataThing> inputs = loadInputDocument();
  • Initiate a workflow launcher - that is, load the workflow definition file.
WorkflowExecutionThread executor = new WorkflowExecutionThread(args, this.getResourcePropertySet());

Where args is the array holding the input arguments.

  • Invoke the workflow (synchronous) and get output
    launcher.start();
    
  • The admin service responds with deployment summary reporting success if the workflow is deployed successfully.
  • To start the workflow, a message is sent to the receiving partnerLink in the workflow.
  • After the workflow successfully executes the results are returned to the client app/user by a call to getWorkflowOutput

TavernaWorkflowFactoryService API


Workflows are created using the TavernaWorkflowFactoryService, which is a grid service that follows the resource pattern. The returned object holds an EPR to a WorkflowManagementService, which can be used to manipulate the created workflow.

createWorkflow

Public WMSOutputType createWorkflow(WMSInputType wMSInputElement) throws WorkflowException

Description: This method creates a workflow resource from the workflow definition file found in WMSInputType and returns an EPR of the created resource to the client. The Taverna resource, along with the most recent state, is persisted in the container and is recovered in the event of a container crash.

WMSInputType: This is the input to createWorkflow, and it consists of workflowName , a String tavernaDef, an Array of wsdlReferences, and an initial termination time for the workflow. If the termination time is not specified the service defaults to 24hrs. Termination of the workflow invalidates the WorkflowManagementService EPR and any running workflow is stopped.

<xsd:complexType name="WMSInputType">
    <xsd:annotation>
      <xsd:documentation>This type represents the input type for a Taverna workflow</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="workflowName" type="xsd:string" minOccurs="1" maxOccurs="1" />
      <xsd:element name="scuflDoc" type="xsd:string" maxOccurs="1" />
      <xsd:element name="delegationEPR" type="wsa:EndpointReferenceType" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="wsdlReferences" type="tns:WSDLReferences" maxOccurs="unbounded" />
      <xsd:element name="terminationTime" type="xsd:dateTime" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="WSDLReferences">
    <xsd:sequence>
      <xsd:element name="partnerLinkType" type="xsd:string"/>
      <xsd:element name="wsdlNamespace" type="xsd:anyURI"/>
      <xsd:element name="wsdlLocation" type="xsd:string"/>
      <xsd:element name="serviceUrl" type="xsd:anyURI"/>
    </xsd:sequence>
 </xsd:complexType>

WMSOutputType: This is the output of the createWorkflow method. An EPR is constructed by the factory and returned to the client. At this point the workflow document is deployed in the workflow engine, but it has not started. The EPR points to an instance of the WorkflowManagementService, which should be used to start the workflow.

 <xsd:complexType name="WorkflowFactoryOutputType">
    <xsd:annotation>
      <xsd:documentation>This type represents the output from a workflow</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="WorkflowEPR" type="wsa:EndpointReferenceType" />
    </xsd:sequence>
 </xsd:complexType>

Faults:

UnableToDeployWorkflowFault: This fault is thrown if the workflow is unable to be deployed (e.g. the workflow definitions file submitted fails pre-deployment validation). We can probably validate the workflow using the following method:

InvalidBPELFault extends UnableToDeployWorkflowFault: This fault is throw if the workflow definition file submitted fails pre-deployment validation (e.g. not valid XML).

Factory ResourceProperties: We intend to provide aggregate resource properties on the factory service in our next iteration. Following are some of the examples of those:

  • Total number of workflows
  • ListOfWorkflowsSubmitted

TavernaWorkflowManagementService API (Instance)


This service is used to manage the workflow resources created by the TavernaWorkflowFactoryService. The service provides asynchronous execution of deployed workflows. The following are the operations the service provides in addition to the standard WS-RF operations such as destroy(), setTerminationTime(), etc.

start

public WorkflowStatusType start (StartInputType startInput) throws WorkflowException, StartCalledOnStartedWorkflowFault

Description: This operation is used to start the workflow deployed using the factory with a set of input parameters. The input parameters are modeled as an array of xsd:any elements. The output is a void type.

<xsd:complexType name="StartInputType">
    <xsd:sequence>
      <xsd:element name="inputArgs" type="tns:WorkflowInputType" maxOccurs="1" />
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="WorkflowInputType">
    <xsd:sequence>
      <xsd:any maxOccurs="1" />
    </xsd:sequence>
</xsd:complexType>

Faults:

StartCalledOnStartedWorkflowFault: This is thrown if start() is called on a workflow that is not in any one of the terminal states (i.e. Done, Failed, Cancelled).

WorkflowException: Every other fault results in the service throwing this with a message describing more details as to what went wrong.

getStatus

Public WorkflowStatusType getStatus( ) throws WorkflowException

Description: This operation is used to query for the status of the deployed workflow. WorkflowStatusType includes a fault.

<xsd:simpleType name="WorkflowStatusType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Pending" />
      <xsd:enumeration value="Active" />
      <xsd:enumeration value="Done" />
      <xsd:enumeration value="Failed" />
      <xsd:enumeration value="Cancelled" />
    </xsd:restriction>
  </xsd:simpleType>

getWorkflowOutput

Public WorkflowOutputType getWorkflowOutput() throws WorkflowException

Description: This operation is used to get the final output of a completed workflow. It will return a fault if the workflow is not yet completed. If Taverna in future allows for intermediate access of results, then this operation can potentially return the last result that the workflow engine has for this workflow. The output is modeled as a array of xsd:any elements.

<xsd:complexType name="WorkflowOutputType">
    <xsd:sequence>
      <xsd:any maxOccurs="1" />
    </xsd:sequence>
  </xsd:complexType>

pause

Public WorkflowStatusType pause() throws CannotPauseFault

Description: This operation pauses the workflow until resume() or cancel() is invoked.(Currently Taverna doesn't support pause/resume. This operation is not implemented yet.)

resume

Public WorkflowStatusType resume() throws CannotResumeFault

Description: This operation resumes a paused workflow.(Currently Taverna doesn't support pause/resume. This operation is not implemented yet.)

destroy

Public void destroy()

Description: This is a standard WS-RF operation but mentioned here to clarify the semantics and what it means to a Workflow Resource. If called, this method will delete a Workflow resource along with the intermediate results and subscriptions for notifications. This operation is called by the GT4 framework when the lifetime of a resource is expired. The lifetime is set in the initial create() call in the factory. Internally, destroy() removes all the database entries for a particular workflow resource, all the subscriptions for notifications, and other temporary resources both in memory and on the disk.

Last edited by
Knowledge Center (1955 days ago) , ...
Adaptavist Theme Builder Powered by Atlassian Confluence