100 likes | 124 Views
Learn how Java CogKit enables developers to utilize Java for Grid tasks with services like security, job submission, and data access. Exercise GridFTP and Gram examples. Implement parallel counting tasks using Java.
E N D
Java Commodity Grid (Java CogKit) • Java CogKits allow developers to use commodity technologies such as Java or Python in programming the Grid based on Globus. The Java CogKit provides a mapping between Java and the Globus Toolkit. However, it is not a wrapper of the Globus Toolkit. Java CogKit provides the following basic services: • Security • Remote job submission and monitoring • Remote data access • Information service access • Certificate store
Java Commodity Grid (Java CogKit) • Aim: To download a file using GridFTP. • Create a directory under /grid/users/<your_name>/samples/ called ‘resourcemanagement.’. • cd grid/users/tugba • mkdir samples • cd samples • mkdir resourcemanagement • Create a test file called “TestGridFile” then write something to the file. Save it under /grid/users/<your_name>/samples/resourcemanagement. • Open another terminal and create the same directory structure as above. Then, download “MyGridFTP.java” and “GramExampleMulti.java” files to newly created directory. Then compile the files.
Java Commodity Grid (Java CogKit) • Create a new Java file called “TestGridFTP.java”. Then write the following lines to that file: import org.apache.log4j.Logger; import org.apache.log4j.Level; import org.globus.ftp.*; public class TestGridFTP { public static void main(String [] args){ Logger.getRoot().setLevel(Level.INFO); // remote files String rf1 = "/grid/users/tugba/samples/resourcemanagement/TestGridFile"; String host = "concorde01.mcs.surrey.ac.uk"; // local files String lf1 = "/grid/users/tugba/samples/resourcemanagement/TestGridFile"; int TRANSFER_TYPE = GridFTPSession.TYPE_ASCII; MyGridFTP myGridFTP1 = new MyGridFTP(host, MyGridFTP.GRIDFTP_PORT,"/tmp/x509up_u28008",true); myGridFTP1.parallelDownload(rf1,lf1); myGridFTP1.close(); } } • Run the “TestGridFTP.java”. java TestGridFTP • Exercise: Look at the Java implementation of MyGridFTP and transfer a local file to a remote computer.
Java Commodity Grid (Java CogKit) • Create a Java file called “TestGram.java” under the same directory. Write the following lines to the file. public class TestGram { public static void main(String [] args){ String [] contact = new String[1]; contact[0] = “concorde02.mcs.surrey.ac.uk”; GramExampleMulti gramm = new GramExampleMulti(contact, false); String [] rsl_command = new String[1]; rsl_command[0] = new String("&(executable=/opt/SUNWjava/j2sdk1.4.1_01/bin/java)(directory=/grid/users/tugba/samples/resourcemanagement)(arguments= HelloWorld)"); String jobOut = gramm.GlobusRun(rsl_command); System.out.println("Output:" + jobOut); } } • Compile and run the program.
Java Commodity Grid (Java CogKit) • Exercise: • Implement the following tasks: • You want to count from 1 to a number x (such as 10000). The number x and the number of machines y to be used for counting process will be submitted to the service provider. • The service that received the request will parallelise the process by executing the query on y number of machines. • The service provider will send the output back to the client machine.