Running Workflows


Contents


Introduction

This section tells you how to invoke worklfow Jython scripts from command-line.

Preparation

Web services created by GFac are automatically created during the workflow execution. However, since we use some sample Web services, we need to start them manually.

Start an Adder service

First, you need to start an Adder service that a simple workflow scrip uses. The following command will do.

% ./run.sh adder

This will create a WSDL of the service instance (wsdls/sample/adder-wsdl.xml)

Run a simple workflow script

"simple-math.py" is the simple workflow script to run, and "simplex-math.png" is a snapshot image of the workflow if you are interested in. To get to know the arguments of the script, run the following command.

% ./jython.sh scripts/jython/simple-math.py -help

This will show the option that the workflow script take as follows.

Options: -f properties_file
         -brokerURL value
         -topic value
         -x value
         -y value
         -Adder_wsdl value

The argument, "-topic", specifies a topic used for the workflow execution. The argument, "-AdderWsdl", specifies the WSDL that specifies an Adder service used for this execution. We specify the WSDL that is created at the previous step. The arguments, "-x" and "-y", specifies actual parameters for the workflow. The "-f" arguments allows us to specify all inputs with a properties file, but we don't use it here.

The following is an example to run the workflow script.

% ./jython.sh scripts/jython/simple-math.py \
              -topic test-topic \
              -Adder_wsdl wsdls/sample/adder-wsdl.xml  \
              -x 2 -y 3

If the execution ends correctly, you will see the following line at the end of a lot of debugging message.

Everything is done successfully.

If you curious about the result of "2 + 3", there is a line somewhere above as follow.

z =  5

Start a Multiplier service

A Multiplier service is needed to run a complex workflow script. To start a Multiplier service, run the following command.

% ./run.sh multiplier

This will create a WSDL of the service instance (wsdls/sample/multiplier-wsdl.xml).

Run a complex workflow script

"complex-math.py" is the complex workflow script to run, and "complex-math.png" is a snapshot of the workflow. As before, run the following command to get to know the arguments of the script.

   
% ./jython.sh scripts/jython/complex-math.py  -help

Options: -f properties_file
         -brokerURL value
         -topic value
         -x value
         -y value
         -x_2 value
         -y_2 value
         -Adder_wsdl value
         -Adder_2_wsdl value
         -Multiplier_wsdl value

Now, you need to specify a WSDL file for each component in the workflow. You can use difference instance of the Adder service, if you wish by specifying different WSDL file.

The following is an example to run the workflow script.

% ./jython.sh scripts/jython/complex-math.py \
              -topic test-topic \
              -Adder_wsdl wsdls/sample/adder-wsdl.xml \
              -Adder_2_wsdl wsdls/sample/adder-wsdl.xml \
              -Multiplier_wsdl wsdls/multiplier-wsdl.xml \
              -x 2 -y 3 -x_2 4 -y_2 5

This script invokes two Adder services concurrently. At the end of the execution, you will see something as follows.

z = 45

...
Everything is done successfully.

Satoshi Shirasuna