Gridwise Technologies tutorial on Globus Toolkit 4.0
Exercises on WS-GRAM
Author: Krzysztof Wilk <chris@gridwisetech.com>
online version of this material: <http://www.gridwisetech.com/resources>
Examples are taken from our integration document:
<https://gridwise.pnet.com.pl/test/resources/sge 6_gt4/integration_description.pdf>
Exercise 0: environment configuration
-----------
Goal: prepare environment for practical exercises.
0. configure pathnames:
$ export GLOBUS_LOCATION='/opt/globus/apps/globus-4.0.0'
$ source $GLOBUS_LOCATION/etc/globus-user-env.sh
$ source $GLOBUS_LOCATION/etc/globus-devel-env.sh
1. set tutorial directory
$ export TUTORIAL_DIR='/files/wilk/training/rsl'
$ cd $TUTORIAL_DIR
2. set machine hostnames as variables:
$ export MACHINE_0="globus03.ncgrid.org"
$ export MACHINE_1="globus04.ncgrid.org"
$ export MACHINE_2="globus05.ncgrid.org"
2. create new grid-proxy
$ grid-proxy-init
4. in the server console, start the container
$ globus-start-container
Conclusion: our environment is set for further exercises.
Exercise 1a: first GRAM job
-----------
Goal: submit our first job to WS-GRAM
1. submit a job which should print information about free and used memory
on the system it runs on
$ globusrun-ws -submit -streaming -c /usr/bin/free
Delegating user credentials...Done.
Submitting job...Done.
Job ID: uuid:462184e4-de7f-11d9-b556-0003ba2dfd1c
Termination time: 06/17/2005 15:57 GMT
Current job state: Active
Current job state: CleanUp-Hold
total used free shared buffers cached
Mem: 2055460 2002416 53044 0 283104 1150088
-/+ buffers/cache: 569224 1486236
Swap: 4096532 7348 4089184
Current job state: CleanUp
Current job state: Done
Destroying job...Done.
Cleaning up any delegated credentials...Done.
Conclusion: we learned how to submit simple jobs to WS-GRAM.
We can see that the job executed successfully and information about free
memory was printed.
Exercise 1b: job defined by RSL file
-----------
Goal: learn how to define more complex jobs
In most cases GRAM job are defined by Resource Specification Language
(RSL) files. RSL is an XML-based language.
You can find its syntax at:
<http://www-
unix.globus.org/toolkit/docs/4.0/execution/wsgram/schemas/gram_job_description.html
>
2. submit job which should print current date to file.
$ globusrun-ws -submit -f example_1.rsl
Submitting job...Done.
Job ID: uuid:dde4a4de-cd7a-11d9-b81c-000e7b5a4527
Termination time: 05/27/2005 00:12 GMT
Current job state: Active
Current job state: CleanUp
Current job state: Done
Destroying job...Done.
This RLS file is included in the following document:
<https://gridwise.pnet.com.pl/test/resources/sge 6_gt4/integration_description.pdf>
3. check if the results are correct
$ cat /files/tmp/example1.stdout
Conclusion: we learned how to specify standard output and standard error
streams for job submissions. We know that with a help of RSL syntax we can
define jobs execution more precisely.
Exercise 2: job with arguments and environmental variables
----------
Goal: learn how to specify a job as a command
with arbitrary list of arguments and additional environmental variables.
In previous exercise (examples '1a' and '1b') we relied on default factory
(i.e. https://localhost:8443/wsrf/services/ManagedJobFactoryService).
From this exercise on we will specify factory explicitly with '-F' argument
of our GRAM client (globusrun-ws).
1. submit a job
$ ssh ${MACHINE_2}
$ cd ${TUTORIAL_DIR}
$ globusrun-ws -submit -F
https://globus03.ncgrid.org:8443/wsrf/services/ManagedJobFactoryService -f
example_2.rsl
This RSL file is included in the following document:
<https://gridwise.pnet.com.pl/test/resources/sge 6_gt4/integration_description.pdf>
2. examine the results
$ cat /files/tmp/example2.stdout
This file contains the output of 'free' command as expected.
Conclusion: we learned how to submit a command
with arbitrary arguments and environmental variables for execution.
We learned how to specify Globus container we contact to submit a job.
Exercise 3: job with file staging
----------
Goal: at execution time use the auxiliary files
which are unavailable on the execution machine
1. submit a job
$ ssh ${MACHINE_2}
$ cd ${TUTORIAL_DIR}
$ globusrun-ws -submit -F
https://globus03.ncgrid.org:8443/wsrf/services/ManagedJobFactoryService -J -S -f
example_3.rsl
This RSL file is included in the following document:
<https://gridwise.pnet.com.pl/test/resources/sge 6_gt4/integration_description.pdf>
2. examine the results
$ cat /files/tmp/example3.stage_in_out.stdout
This file contains the output of 'date' command as expected.
Conclusion: we learned how to transfer auxiliary execution files on-demand.
This process is called input staging (file transfer prior to command execution)
and output staging (file transfer after the execution).
Exercise 4: job defined as shell script
----------
Goal: define command or commands to be executed in more flexible way
1. submit a job
$ ssh ${MACHINE_2}
$ globusrun-ws -submit -F
https://globus03.ncgrid.org:8443/wsrf/services/ManagedJobFactoryService -f
example_4.rsl
This RSL file is included in the following document:
<https://gridwise.pnet.com.pl/test/resources/sge 6_gt4/integration_description.pdf>
2. examine the results
$ cat /files/wilk/tmp/example_4_stdout
This file contains the output of the following sequence of commands: hostname,
date, free.
Conclusion: we learned how to submit a job which is defined as shell script.
The script can contain many commands to be executed.
Exercise 5: parallel job (MPI)
----------
Goal: submit an MPI job
1. submit a job
$ ssh ${MACHINE_2}
$ globusrun-ws -submit -F
https://globus03.ncgrid.org:8443/wsrf/services/ManagedJobFactoryService -f
example_5.rsl
2. examine the results
$ cat /files/tmp/example5.parallel.cpi_stdout
This file contains the value of Pi (with error of this calculation), and wall clock
time of this calculation.
This RSL file is included in the following document:
<https://gridwise.pnet.com.pl/test/resources/sge 6_gt4/integration_description.pdf>
Conclusion: we learned how to submit a parallel job (MPI job).
Exercise 6: various job managers
-----------
Goal: learn how to use various job managers and how to specify them explicitly
In this exercise we will use file example_5.rsl again.
1. log to another machine
$ ssh ${MACHINE_2}
2. use SGE (Sun Grid Engine) job manager
This is default job manager in our testbed therefore it was used in exercises so
far.
However, in other Globus installation needs to be specified explicitly.
This job manager uses SGE job scheduler.
$ globusrun-ws -submit -F
https://globus03.ncgrid.org:8443/wsrf/services/ManagedJobFactoryService -Ft SGE -f
example_5.rsl
3. use DRMAA (Distributed Resource Management Application API) job manager
This job manager uses SGE job scheduler. From the user's perspective is almost
equivalent to SGE job manager.
$ globusrun-ws -submit -F
https://globus03.ncgrid.org:8443/wsrf/services/ManagedJobFactoryService -Ft DRMAA
-f example_5.rsl
4. use Fork job manager
In most Globus configurations, and in default configuration this job manager is
used by default.
However in our testbed we need to specify that we want to use it explicitly.
$ globusrun-ws -submit -F
https://globus03.ncgrid.org:8443/wsrf/services/ManagedJobFactoryService -Ft Fork -f
example_5.rsl
Conclusion: we learned how to specify which job manager we want to use for our jobs
download Gridwise Technologies tutorial on Globus Toolkit 4.0 Exercises on WS ...
