Grid Lab 1: Introduction to Globus Toolkit

Deadline: April 5th (M), 2004

Submit the report to your website

1Introduction

In this LAB we will understand what Globus Toolkit is and develop a small example on Grid Services. This Lab has been adapter from Globus Toolkit 3 Programmer's Tutorial available at

The Globus Toolkit is a software toolkit that allows us to program grid-based applications. The third and latest version of the toolkit is based on something called Grid Services. Before defining Grid Services, we're going to see how Grid Services are related to a lot of acronyms you've probably heard (OGSA, OGSI for example), but aren't quite sure what they mean exactly. The following diagram summarizes the major players in the Grid Service world:

Source: Globus Toolkit 3 Programmer's Guide.

Grid Services are defined by OGSA. The Open Grid Services Architecture (OGSA) aims to define a new common and standard architecture for grid-based applications. Right at the center of this new architecture is the concept of a Grid Service. OGSA defines what Grid Services are, what they should be capable of, what types of technologies they should be based on, but doesn't give a technical and detailed specification (which would be needed to implement a Grid Service).

Grid Services are specified by OGSI. The Open Grid Services Infrastructure is a formal and technical specification of the concepts described in OGSA, including Grid Services. The Globus Toolkit 3 is an implementation of OGSI. GT3 is a usable implementation of everything that is specified in OGSI (and, therefore, of everything that is defined in OGSA).

Grid Services are based on Web Services. Grid Services are an extension of Web Services. Grid Services provide some cool features which are not available with standard Web Services.

  1. Grid Services are Stateful unlike Web Services which are stateless.
  2. Grid Services implement Factory Pattern. (Since you have already studied Patterns I won't describe it further).
  3. Two implementation approaches: A Grid Service can be implemented either by inheriting from a skeleton class or by using a delegation model, where incoming calls are delegated to a series of classes called operation providers.
  4. Lifecycle management: Grid Services provide the necessary tools, such as callback functions during special moments in a Grid Service's lifetime (creation time, destruction time, etc.), to effectively manage its lifecycle (for example, to make Grid Services persistent).
  5. Service Data: A Grid Service can have a set of associated service data that describes it. This is not to be confused with WSDL, which describes details like methods, protocols, etc. Service data is particularly useful to index Grid Services according to their characteristics and capabilities.
  6. Notifications: We can configure a Grid Service to be a notification source, and certain clients to be notification sinks (or subscribers). This means that if a change occurs in the Grid Service, that change is notified to all the subscribers.

You can get more information about Grid Services at

I still don't get it: What is the difference between OGSA, OGSI, and GT3? Consider the following simple example. Suppose you want to build a new house. The first thing you need to do is to hire an architect to draw up the blueprints, so you can get an idea of what your house will look like. Once you're happy with the architect's job, it's time to hire an engineer who will plan all the construction details (where to put the master beams, the power cables, the plumbing, etc.). The engineer then passes all his plans to qualified professional workers (construction workers, electricians, plumbers, etc) who will actually build the house.

We could say that OGSA (the definition) are the blueprints the architect creates to show what the building looks like, OGSI (the specification) is the structural design that the engineer creates to support the architect's vision for the building, and the GT3 is the bricks, cement, and beams used to build the building to the engineer's specifications. The finished building would be a GT3-based application.

For additional Details read the Globus FAQ Located at:

FAQ:

2Programming Assignment

2.1 Prerequisites

Familiarity with Web Services is useful although not essential to complete this tutorial. If you don't know what Web Services are and how they work, then I strongly recommend reading “Short Introduction to Web Services” from Globus website available at

Working Knowledge of Linux/UNIX Operating system and Java programming is required.

Note: All commands are in Bold and Italic.

2.2 Initial Setup

  1. Login to the machine as user “Globus” and password “grid4cs590L”
  2. go to folder /home/globus/cs590l/lab1
  3. create directory by your name e.g. “mkdir uday”
  4. go to this directory (cd uday in my case)
  5. Untar/home/globus/cs590l/lab1/lab1.tar file as tar -xvf ./grid-lab1.tar
  6. Set environment by switching to directory /home/globus/$GLOBUS_LOCATION and run script setenv.sh as “source ./setenv.sh”. Come back to original location.$GLOBUS_LOCATION is an environment variable pre-defined on the system.
  7. Study the folders and files copied by previous command.
  8. Hence forth whenever we refer to <GT3_TUTORIALDIR we are actually referring to directory /home/globus/cs590l/lab1/<your-name>/ and all commands are to be executed from this directory unless specified otherwise.

2.3 Learn to compile and deploy a grid service

  1. Every Web Service has 2 distinct components. An interface and an implementation.
  2. Go to directory <GT3_TUTORIALDIR>/gt3tutorial/core/first/impl and have look at Math.java (the interface) and MathImpl.java (the implementation).
  3. Come back to <GT3_TUTORIALDIR> and compile interface javac Math.java
  4. Generate WSDL (Web Service Description Language File) for your service.

java org.apache.axis.wsdl.Java2WSDL -P MathPortType -S MathService

-l

-n gt3tutorial.core.first.impl.Math

Study MathService.wsdl created in <GT3_TUTORIALDIR>

  1. Decorate this WSDL to make it compatible with Globus. (We learned that a Grid Service is extension of a Web Service.)

javaorg.globus.ogsa.tools.wsdl.DecorateWSDL $GLOBUS_LOCATION/schema/ogsi/ogsi_bindings.wsdl MathService.wsdl

  1. Generate Stubs for your service

java org.globus.ogsa.tools.wsdl.GSDL2Java MathService.wsdl

Look at the stubs generated in <GT3_TUTORIALDIR>/gt3tutorial/core/first/Math directory. Also observe that a new directory org being created in <GT3_TUTORIALDIR>. Study the files created in this directory.

  1. Write Deployment descriptor for your service. Look at the descriptor

<GT3_TUTORIALDIR>/gt3tutorial/core/first/Math.wsdd.

  1. Now compile the stubs: javac -sourcepath ./ gt3tutorial/core/first/Math/*.java
  2. Compile implementation: javac -sourcepath ./ gt3tutorial/core/first/impl/*.java
  3. Package stubs jar file: jar cvf Math-stub.jar gt3tutorial/core/first/Math/*.class
  4. Package implementation jar file: jar cvf Math.jar gt3tutorial/core/first/impl/*.class
  1. Create Grid Archive. Create directories called .gar/ ./gar/schema ./gar/schema /tutorial into <GT3_TUTORIAL> and copy the following files into it:

./gar/Math.jar

./gar/Math-stub.jar

./gar/server-deploy.wsdd

./gar/schema/tutorial/MathService.wsdl

Note that Math.wsdd has been copied as server-deploy.wsdd.

  1. Create the grid-archive file (gar) jar cvf Math-<your-name>.gar -C gar ./

e.g. Math-uday.gar

  1. Deploy your gar file. Go to folder cd $GLOBUS_LOCATION and issue command:

ant deploy -Dgar.name=GAR_PATH where GAR_PATH is the path to your gar file. In my case GAR_PATH is /home/globus/cs590l/lab1/uday/Math-uday.gar

  1. If everything went smoothly: Congratulations!!You just deployed your first Grid Service!

Now comes the fun part, when we finally put it to the test. To test this service we need a client. Don't worry!! We have provided a client for you. Compile itfrom <GT3-TUTORIALDIR> asjavac -sourcepath ./ gt3tutorial/core/first/client/*.java

  1. To be able to invoke your service a special program called “Service Container” should be running for which the command is globus-start-container. Open a new window and go to <GT3_TUTORIALDIR>. Set environment as source etc/globus-user-env.sh. Then run command “grid-proxy-init” and when prompted for a passphrase type ca:grid04@udic. Then run command globus-start-container. This should start the container and you would see some services listed on the console. Ignore any exception messages it may throw out.
  2. Test Your service by running following command:

java gt3tutorial.core.first.client.MathClient 3 2

  1. Where 3 and 2 are the input parameters. If your service has been coded and deployed properly then you should get response “3 + 2 = 5” as you must have guessed already. Don’t forget to stop the container using CTRL-C and then logout.

2.4Shortcut deployment using ant

This compilation and deployment process was really long!! But you don't have to really go through these 15-16 steps. It’s actually one step process, thanks to “ant” a tool from apache project. You can read more about ant at

Make sure that you have build.properties file in <GT3_TUTORIALDIR> and it has ogsa.root variable properly defined to $GLOBUS_LOCATION e.g. /home/uday/gt3.0.2.

Use command “less build.properties” to list contents. You should also have your ant build file build.xml in the same directory. Have a look at ant file and try to make sense out of it. The entities in ${ }are ant environment variables and are defined in one or more build.properties files. The one-step compilation is done as follows:

ant -Djava.interface=true-Dpackage=gt3tutorial.core.first -Dinterface.name=Math

-Dpackage.dir=gt3tutorial/core/first/ -Dservices.namespace=first.core.gt3tutorial

This creates your gar file Math.garand all you need to do is deploy your gar file.

2.5 Deliverables:

Write a short report discussing

  • Advantages and disadvantages of factory pattern for Web Services. You can read more about Grid Services at
  • Argue if addition of statefulness to Grid Services is indeed an improvement over Web Services or not. It’s essential that you think about Grid (Web) Services as delivering some serious enterprise service with commercial value and try to identify the issues that might come due to addition of statefulness.

Notice

The machines allocated for Grid Lab are Black Color, Gateway Machines. These machines are located on a table on the right side of the lab 452.

Two instructions for the students:

1. Don't forget to log-off from the machine once you are done.

2. Never Ever "REBOOT" the machines. If you have any problem email

or try to calling up at FH 508, #6090.

Page 1 of 8