Assignment 2 Simple Grid Services Assignment This assignment
- Slides: 19
Assignment 2 “Simple” Grid Services Assignment This assignment and slides are derived from “Classroom Exercises for Grid Services” by A. Apon, J. Mache, Y. Yara, and K. Landrus, Proc. 5 th Int. Conference on Linux Clusters: The HPC Revolution May 2004. Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Grid Services Exercise Motivation: Web services are stateless, whereas Grid services can be either stateful or stateless, and transient or persistent. Grid services also use a factory pattern to manufacture instances. • Build on the Web Services example • Show to create a stateful Grid service and how Grid services differ from Web services using GT 3 Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Purpose of Grid service • To store an integer value which can be acted upon by methods to get its value, increment its value (add one), and decrement its value (subtract one). These methods are given. Further methods will be implemented. This service is stateful (the value is retained). Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Steps • • • Implement the Grid Service Define the Grid Service Interface using GWSDL Writing the Deployment Descriptor Building the Math Service Deploying the Math Service using ANT Write and Compile the Client Start the Grid Service Execute the Client Add Functionality to the Grid Service Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 1: Implement the Grid Service // package and import statements not shown public class Math. Impl extends Grid. Service. Impl implements Math. Port. Type { private int value = 0; public Math. Impl() { super(“Math Factory Service”); } public void add(int a) throws Remote. Exception { value = value + a; } public void subtract(int a) throws Remote. Exception { value = value - a; } public int get. Value() throws Remote. Exception { return value; } } Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 1 (continued) This server is stateful. The value can be modified via add or subtract, and can be accessed via get. Value. • The service is implemented in Java. The code is provided in yourusername. Assignments/services/Math. Service/impl/Math. Impl. java which is in the directory /home/yourusername/Grid. Services/ • Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 2: Define the Grid Service Interface using GWSDL The service interface is implemented in Java. The code is provided in schema/yourusername. Assignments/Math. Service/impl/Math. gwsdl which is in the directory /home/yourusername/Grid. Services/ • Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 2 (continued) This GWSDL (Grid Web Services Description Language) file specifies • the namespace being used http: //www. globus. org/namespaces/yourusername. Assignments/Math. S ervice • each element of that namespace. These are the methods of the Math. Service (add, subtract, get. Value) • the input messages, the output messages, and the Port. Type Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 3: Writing the Deployment Descriptor The code for the deployment descriptor for the Math Service is provided in yourusername. Assignments/services/Math. Service/server -deploy. wsdd which is in the directory /home/yourusername/Grid. Services/ • The two key sections of the deployment descriptor specify the Math Service and the Math Service Factory • Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 4: Building the Math Service [yourusername@terra Grid. Services] $. /build. sh yourusername. Assignments/services/Math. Service schema/yourusername. Assignments/Math. Service/Math. gwsdl • Use the build script which specifies the path to your service and the path to the GWSDL file for the service. • a directory named build is created that contains all the stub files, class files, and the GAR file • the GAR file contains the java class files, GWSDL files, compiled stubs, and the deployment descriptor Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 5: Deploy the Grid Service using ant [yourusername@terra Grid. Services]cd $GLOBUS_LOCATION [user] ant deploy -Dgar. name=/home/yourusername/Grid. Services/build/lib/yourusername/Assignments _services_Math. Service. gar ANT is a build program similar to the make program but the dependencies are specified using xml Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 6: Write and compile the client public class Math. Client { public static void main(String[] args) { try { // Get command-line arguments URL GSH = new java. net. URL(args[0]); int a = Integer. parse. Int(args[1]); // Get a reference to the Math. Service instance Math. Service. Grid. Locator my. Service. Locator = new Math. Service. Grid. Locator(); Math. Port. Type myprog = my. Service. Locator. get. Math. Service(GSH); // Call remote method 'add' myprog. add(a); System. out. println("Added " + a); // Get current value through remote method 'get. Value' int value = myprog. get. Value(); System. out. println("Current value: " + value); }catch(Exception e) {System. out. println("ERROR!"); e. print. Stack. Trace(); } } } Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 6 (continued) The code for the client is provided in yourusername. Assignments/clients/ Math. Service/Client. java which is in the directory /home/yourusername/Grid. Services compile it using javac Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 7: Start the Grid Service Start the globus container on a TCP port that is not in use (this example assumes port 8081 is not in use; use netstat –t –all to see which ports are in use) [yourusername@terra Grid. Services] globus-start-container -p 8081 Math. Service and Math. Service. Factory will be listed as two of the services that are available once the container has started Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 8: Execute Client Execute client [yourusername@terra Grid. Services] java – classpath. /build/classes/: $CLASSPATH yourusername. Assignments. clients. Math. Service. Client http: //152. 30. 5. 102: 8081/ogsa/services/youru sername. Assignments/Math. Service 5 You will see the following result: Added 5 Current value: 5 Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Step 9: Extend Functionality of the Service • • Add a multiply method to your Math Service Repeat all the steps to test it Mark Holliday and Barry Wilkinson, 2004 A 2. 1
GT 3 Setup • GT 3 not set up for a multiuser environment ant uses a common build directory for the deployment of all services – All users added to a common “globus” group – Users to create unique service names – Users to revise subdirectory structure of services in user’s home directory Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Web Services Setup • Grid Services extends Web Services and uses Axis. • However, the GT 3 installation does not support Web Services development using Axis • Had to install and configure the Tomcat servlet container to support the Axis tools for the example Java version "1. 4. 2_02" Jakarta Tomcat Ver 4. 1. 29 http: //jakarta. apache. org/tomcat/index. html Apache Axis Ver 1. 1 http: //xml. apache. org/axis Mark Holliday and Barry Wilkinson, 2004 A 2. 1
Web Services Setup • A shell script was used to set the environmental variables so that Java can find all of the required libraries #!/bin/sh AXIS_HOME=/usr/local/axis AXIS_LIB=$AXIS_HOME/lib AXISCLASSPATH=$AXIS_LIB/axis. jar: $AXIS_LIB/commonsdiscovery. jar: $AXIS_LIB/commonslogging. jar: $AXIS_LIB/jaxrpc. jar: $AXIS_LIB/saaj. jar: $AXIS_LIB/log 4 j -1. 2. 8. jar: $AXIS_LIB/xml-apis. jar: $AXIS_LIB/xerces. Impl. jar: $AXIS_LIB/wsdl 4 j. jar: . export AXIS_HOME AXIS_LIB AXISCLASSPATH docs!! Mark Holliday and Barry Wilkinson, 2004 # this is missing in the A 2. 1
- Pga vs lga
- Ogsa in grid computing
- Present simple past simple future
- Simple past simple present simple future
- Past simple future
- Present simple present continuous past simple future simple
- Simple present, simple past, simple future
- Present simple, past simple, future simple
- Present past future tense
- Simple present exemplos
- Present simple past simple future simple
- Unit 1 exploring business assignment 1
- Diffserv vs intserv
- Wake county human services community services center
- Compound assignment operator
- Making simple electrical gadgets
- X simple and y simple
- Simple vs complete predicate
- Likedrome
- Wish in present