WS-VLAM Tutorial: Part III (part2): Learn how to WS-VLAM PYTHON API Adam Belloum.

34
WS-VLAM Tutorial: Part III (part2): Learn how to WS-VLAM PYTHON API Adam Belloum

Transcript of WS-VLAM Tutorial: Part III (part2): Learn how to WS-VLAM PYTHON API Adam Belloum.

WS-VLAM Tutorial: Part III (part2): Learn how to WS-VLAM PYTHON API

Adam Belloum

Outline

• Part I: Hands on the User Graphical Interface• Part III: Port a Legacy application to WS-VLAM• Part III: Learn how to use WS-VLAM API

• Notation (Title background):– Generic step – Tutorial specific step

Outline (Part III): Learn how to use WS-VLAM API

Step 1: Define an Interface for your componentStep 2: Create a description for your componentStep 3: Define the component dependencies Step 4: JAVA Tutorial (create a WSVLAM JAVA component)

Step 6: C/C++ Tutorial (create a WSVLAM C/C++ component)

Step 5: PYTHON Tutorial (create a WSVLAM PYTHON component)

Step 6: Deploy the component/dependencies libStep 7: Compose a workflow using the componentStep 8: execute the workflow / monitor

Step 1: Define the component interface

Step 1: Example File Reader

• The file reader “fileReader” opens a file specified as a URI using the parameter Interface “filename” and sends the content through an output port “port_out”.

– fileReader support many protocols: GSIFTP, ftp, http, file

Step 2.1: Create a description

• To create a description of your component: use CLAM workflow component configuration tool

Action: • Click on CLAM

Button in the WS-VLAM menubar

Step 2.2: Create a description

• CLAM workflow component configuration tool will allow you to define: name of the component, default host, ports, parameters, classification, category

Action: • Enter the name of the

component

• Entre the name of the default host “fs2.das3.science.uva.nl”

Step 2.3: Create a description

• CLAM workflow component configuration tool allows you to define: name of the component, default host, ports, and parameters

Action: • Click on ports tab

• Click + to add new input or output port

• Type the name of the ports exactly as you did it in config.xml

Step 2.4: Create a description

• To add a port a pop up window appears “Add input Port” or “Add output port”

Action: • Type the name of the

ports exactly as you did it in source code

• Specify the type of the port either a simple data type, a file type, or Complex data type (see documentation for more details)

Step 2.5: Create a description

• Create a description of your component: use CLAM workflow component configuration tool

Action: • Click on save to

created the description file “component-name.xml”

Step 2.6: Create a description

• Create a description of your component: use CLAM workflow component configuration tool

Action: • You will see in the

filed file path the full path to the created

Step 2.7: Example File Reader

Action: • Perform the tasks described in step 2.1 to step 2.6 to create

the fileReader.xml

Step 3.1: Define the component dependencies

Step 3.2: Create a pseudo-module

# ############ NOTE ##################### In the profile.sh export all the environment # variables needed to execute your package## bash environment# # export VARIABLE_NAME=VARIABLE_VALUE## Add your VARIABLES bellow the line######################################

Step 5.1: PYTHON API

• From a developer’s point of view your components are applications that use a special library provided by the WS-VLAM framework: the “vlport” library

Step 5.2: PYTHON modules (pre-requisite)

Step 5.3: Extend your PYTHON code

Step 5.4: API for writing to an output port

Step 5.5: API for reading from in input port

Step 5.6: API for reading/writing to/from parameter

• getParameter ("paramName”)– Reads the value of “paramName”

• setParameter ("paramName", "paramValue”) – Writes the value of “paramValue” to “ paramName”

Step 5.5: Example of PYTHON component

• The Example : shows the code for a module which open a file using “inputPort” and write is to the ”outputPort”. The name of the file is read through eh parameter interface

#include "vlapp.h" #!/usr/bin/python

import vlport

vlapp=vlport.VLAppFactory.activate([“inpputPort], ["outputPort"])

filename=vlapp.getParameter("fileName") file=open(filename)

outputPort=vlapp.getOutputPort("outputPort") fileDaata = file.read() outputPort.write(fileData) =vlport.VLAppFactory.deactivate(vlapp)

Step 6.1: Deploy your workflow component

• Create a file “main.sh”:

#!/bin/shexport PYTHONPATH=$VLAM_INSTALL/lib: \ $PYTHONPATH

python $BASE_DIR/bin/fileReader $*

Step 6.2: package your component

Create a tar file of your component:

(1) Created fileReader.tar $ tar cf fileReader.tar fileReader/

(1) Compress fileReader.tar

$ gzip fileReader.tar

Step 6.3: Deploy your workflow component

• Test mode: you can test your component

– Perform the steps described in the blue box

• Shared mode: you can share your module with other users:

– by moving the tar file you have created in step 6.2 to a component repository

# On a machine where both GT4 & WS-VLAM# runtime system are installed # Create in your HOME directory called “.wsvlam”

(1) copy fileReader..tar.gz to the default directory $ mkdir .wsvlam$ cd .wsvlam/$ mkdir modules$ cd modules

#untar the component tar file you have created # in step 4

(1)untar fileReader..tar.gz

$ tar –zxvf fileReader.tar.gz

Step 7.1: Compose a workflow fileReader

• In the component list window you will see the created FileREader components as well as other components

Action: • Click on the fileReader

in the list and drag and drop in the composition panel

Step 7.2: Compose a workflow using LA

• An instance of fileReader will be instantiated

Action: • Click on the fileReader

in the list and drag and drop in the composition panel

Step 7.3: Compose a workflow using LA

• Instantiate the fileWriter component:• This component will move the file produced by fileReader

to any remote location the user specifies

Step 7.4: Compose a workflow using LA

• Create a communication channel:• This component will move the file produced by FileReader

to any remote location the user specifies

Step 7.5: customize the composed workflow

• In the step you should check if all the default values of the parameters of the workflow components composing your workflow are set correctly

Step 7.6: customize the composed workflow

• In the step you should check if all the default values of the parameters of the workflow components composing your workflow are set correctly

Step 7.8: customize the composed workflow

• Input file: fileReader parameter

• fs2.das2.science.uva.nl: Type in the following URI for parameter in each fileReader

• gsiftp://fs2.das.3science.uva.nl/home2/<user-account>/<filename-you-want-to-cp>

• output file: fileWriter parameter

• fs0.das3.cs.vu.nl: Type in the following URI for parameter in each fileReader

• gsiftp://fs0.das3.cs.vu.nl/home0/<user-account>/<filename-you-want-to-created>

Step 8: execute the composed workflow

• Now you are ready to execute the omnimatch workflow, which automatically stage in the data file needed for the omnimatch application, and stage out the result files

Some References

1. Science Z Zhao, A Belloum, M Bubak Editorial: Special section on workflow systems and applications in e-Future Generation Computer Systems 25 (5), 525-527

2. A. Wibisono, D. Vasyunin, V. Korkhov, AS.Z. Belloum WS-VLAM: a GT4 based workflow management system , The 2nd International Workshop on Scientific Workflows, In conjunction with ICCS 2007, Beijing, China, 2007

3. A.S.Z. Belloum, V. Korkhov, S. Koulouzis, M. A Inda, and M. Bubak Collaborative e-Science experiments: from scientific workflow to knowledge sharing JULY/AUGUST, IEEE Internet Computing, 2011

4. Ilkay Altintas, Manish Kumar Anand, Daniel Crawl, Shawn Bowers, Adam Belloum, Paolo Missier, Bertram Ludascher, Carole A. Goble, Peter M.A. Sloot, Understanding Collaborative Studies Through Interoperable Workflow Provenance, IPAW2010, Troy, NY, USA

Some References

5. A. Belloum, Z. Zhao, and M. Bubak Workflow systems and applications , Future Generation Comp. Syst. 25 (5): 525-527 (2009)

6.  Z. Zhao, A.S.Z. Belloum, et al., Distributed execution of aggregated multi domain workflows using an agent framework The 1st IEEE International Workshop on Scientific Workflows, Salt Lake City, U.SA, 2007

7. Zhiming Zhao, Adam Belloum, Cees De Laat, Pieter Adriaans, Bob Hertzberger Using Jade agent framework to prototype an e-Science workflow bus Authors Cluster Computing and the Grid, 2007. CCGRID 2007