Session 2 - Using Ganga to Access the Grid

In this session we will submit simple jobs to the grid and learn a little about the underlying grid tools.

Preparing your Grid Certificate

To run on the grid, you must have a valid grid certificate. Hopefully, you will all have this already! However, it may currently be still loaded in your browser and so you need to go through a few steps to export it to your userarea:

1) Set up the grid environment:

2) Create a .globus directory:

mkdir ~/.globus
cd ~/.globus

3) First, export the grid certificate. This is browser dependent, but in Firefox do:

Edit -> Preferences -> Advanced -> View Certificates

Select you certificate and click on 'Backup'. You should then be requested to download your certificate. Download it to your .globus directory you created above as 'grid.p12'.

4) Now the certificate must be converted to the correct form by doing the following:

openssl pkcs12 -in grid.p12 -clcerts -nokeys -out usercert.pem
openssl pkcs12 -in grid.p12 -nocerts -out userkey.pem
chmod 400 userkey.pem
chmod 600 usercert.pem

5) Hopefully, everything should now be ready so to check it's all OK, do the following:


which should give something like this:

Cannot find file or dir: /home/slater/.glite/vomses
Enter GRID pass phrase:
Your identity: /C=UK/O=eScience/OU=Birmingham/L=ParticlePhysics/CN=mark slater
Creating proxy ........................................................................................................ Done
Your proxy is valid until Sun Dec 14 03:34:50 2008

Starting Ganga with Grid Tools Enabled

Before you can run jobs on the grid, you must specify what Virtual Organisation you belong to. A single certificate can be associated with several VOs, but you need to pick one when using Ganga. This is most likely to be your experiment (atlas or lhcb). To change this, edit your .gangarc file and find and alter the following part:

VirtualOrganisation = <VO_NAME>
voms = <VO_NAME>

Ganga has been configured to use the local installation of the Grid UI so you don't have to set that up. Simply run Ganga without the --disableLCG option:


You will then most likely be asked for the passphrase for your grid certificate after which you should be presented with the IPython prompt as before. However, now the LCG backend and corresponding grid tools have been enabled. To have a look at the options for the backend, use the help system:

and the config system:

The important options to note are:

  • GLITE_SETUP: The setup script that is sourced to provide access to the Grid UI
  • VirtualOrganisation? : The VO that you wish to be associated with (most likely 'atlas' or 'lhcb')
  • AllowedCEs? : A regular expression determining which CEs to run on (e.g.
  • ExcludedCEs? : A regular expression determining which CEs to exclude

In addition to these options, there is the LCGRequirements object that gives an additional control over the CEs that are submitted to. Again, to find out about this object use the help system:


Finally, there are also settings to control your grid proxy creation that can be changed from your .gangarc file. Look for the 'defaults_GridProxy' section and view the defaults in Ganga using:


Running your first Grid jobs

So now you are all set up to run a job on the grid. The job definition can be created just as detailed in the previous session, the only change is to the backend. For the most basic job, do the following:

j = Job()
j.backend = LCG()

As usual, your job will go through the same submitted, running and completed states. However, you may notice two things: First, it takes a bit longer than running locally and second, the actualCE field displayed when you issue the 'jobs' command will show some random site somewhere in Europe (or maybe Canada!). This indicates where your job actually ran.

All the previous jobs done in the previous session should work on the grid with the only change being that of the backend. Try out a few of these, especially the split job to show the ease of the interface

As noted above, there are several options available to specify where and how your job runs. We will change one of these more often used settings now, that being 'AllowedCEs':

config['LCG']['AllowedCEs'] = ''

This changes the configuration 'on the fly' - it doesn't change the default setting on startup. If you now submit another job, you'll notice that all your jobs get sent to the Oxford CEs.

No that we've covered the basics of running on the grid, try submitting the ROOT split job from the previous section to the LCG backend.

Some help on Useful Commands Outside Ganga

Though almost everything you would want to do is capable within Ganga, at times it can be useful to know some of the grid UI commands so you don't have to start up Ganga just to check them. Some of the more useful ones are:

voms-proxy-init --voms <VONAME>
Create a grid proxy for the given VO

voms-proxy-info --all
View all information about the current proxy

glite-wms-job-status https://...
Query the resource broker for information about the given job. The job id is given by the https tag that be found by doing:

-- MarkSlater - 08 Dec 2008

Topic revision: r4 - 13 Dec 2008 - 15:51:34 - MarkSlater
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback