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

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 mycert.pfx -clcerts -nokeys -out usercert.pem
openssl pkcs12 -in mycert.pfx -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:

Your identity: /C=UK/O=eScience/OU=QueenMaryLondon/L=Physics/CN=steve lloyd
Enter GRID pass phrase for this identity:
Creating proxy .............................................................. Done
Your proxy is valid until: Tue Apr 12 22:03:18 2005

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>

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:


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.

That covers the basics of using Ganga on the grid, however you're more than welcome to play with the various settings and the jobs from the previous section. Basically have a play!

Some help on Useful Commands Outside Ganga

-- MarkSlater - 08 Dec 2008

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 08 Dec 2008 - _47C_61UK_47O_61eScience_47OU_61Birmingham_47L_61ParticlePhysics_47CN_61mark_32slater?
This site is powered by the TWiki collaboration platform Powered by Perl 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