RStDGangaGuide
Introduction
This is a compendium of best knowledge on how to use Ganga. It also shows how to move from one version to the next. It is unabashedly stolen from the
Ganga Tutorial that was based on 4.0.0-beta3.
Older Versions
Ganga Version 4.0.0-beta5 Instructions are still available.
Newer Versions
Ganga Version 4.0.0-beta5(latest)
The instructions here tell you how to setup and use the Ganga shell that is based on python and allows you to create a job object and examine its attributes. After the basics of getting the shell going are explained, a test "hello world" job is given with the job run locally, on LSF and then on the Grid. After this, an Athena Hello World job is explained, again for local running for LSF and for the Grid.
The Ganga Shell: Getting Ganga installed and running
- Setup Ganga
- Login on LXPLUS
- LSF and LCG UI only on lxplus
- Install Ganga
You may either use the alias method or add to your path. The PATH environment variable can become too long so you choose.
- Alias Method
- csh
- alias ganga /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.0.0-beta5/bin/ganga
- sh
- alias ganga=/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.0.0-beta5/bin/ganga
- PATH Method
- csh
- sh
Modify your .zshenv to contain
export PATH=/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.0.0-beta5/bin:$PATH
- Configure Ganga
- Create configuration file
- Edit configuration file
- emacs ~/.gangarc
- Configuration section
- RUNTIME_PATH = GangaAtlas
- LCG section
- SETUP = /afs/...
- VirtualOrganisation = atlas
- Customize Athena section
- LCGOutputLocation =
- LocalOutputLocation =
In the future there will be VO specific defaults. For now:
- Your Choice
- Secure and tape backup (VO based security)
- /castor/cern.ch/grid/atlas/scratch/$USER/ganga
- Not security and disk only
- /castor/cern.ch/atlas/scratch/$USER/ganga
- Unprotected directory ...
- Try it out: Click Here for a Screen Dump
- Play with the Shell
- It's Python. Well actually IPython, a part of scientific python and has a better python prompt.
- With some some shortcuts
- Tab expand for shell and python
- Some shell commands work directly
- Others can be run with an !
- Jobs are a python object
- Help available
- Helper fucntions
- backends()
- applications()
- ganga --help
- ~/__Ganga4__
- File workspace where input/output is stored.
- Local job registry: a place hwere job objects are stored
Hello World Job
- Create a Generic Job and print the object: Click Here for a Screen Dump
- Configure it
- One option
In [4]: j.application.exe='/bin/echo'
In [5]: j.application.env={'MESSAGE':'Hello World'}
In [6]: j.application.args=['$MESSAGE']
- Another way
In [4]: j.application.exe='/bin/echo'
In [5]: j.application.args=['Hello World']
- Run it Click Here for a Screen Dump of all this
- Locally
- LSF
- j2=j.copy()
- j2.backend=LSF()
- j2.submit
- LCG
- j3=j.copy()
- j3.backend=LCG()
- j3.submit()
- Look at the result
- Try the other option for specifying args Click Here for a Screen Dump of this alternative jobs
- j4=Job()
- j4.application.exe='/bin/echo'
- j4.application.args=['Hello World']
- j4.backend=LCG()
- print j4
- j4.submit()
- outfile4 = file(j4.outputdir+'/stdout')
- print outfile4.read()
- Useful Hints
- The Sandbox
- Input
- ls ~/__Ganga4__/workspace/Local/input/17
- Output
- ls ~/__Ganga4__/workspace/Local/output/17
Athena Jobs
Scenario
User wants to run his own algorithm on AOD data
- Algorithm is sent with the job
- tar file of the user area
- Standard LCG data management
- LCG is used directly
- Prodsys in the near future
Assumptions
- User is a Physicist that ...
- Knows CMT
- Knows how to run Athena
- Does not need to know much on the grid
- Ganga supports the user to get his algorithm on the grid
- The algorithm is run by a Transformation
- Again: it will be the same as used by ProdSys
- A lot of work hs been done by ProdSys group to support an Analysis Transformation
- User has just to configure the transformation
- Our example
- PAT Example
- Package: AnalysisExamples
- Job Options: ttbarExample_jobOptions.py
- AOD Dataset
- rome.004100.recov10.T1_McAtNLO_top
- Versions
- ATLAS Release 10.0.1
- AnalysisExample-00-09-18
- Prepare the CMT Setup
- ~/cmthome/requirements
- set CMTSITE CERN
- macro ATLAS_DIST_AREA "/afs/cern.ch/atlas/software/dist"
- macro ATLAS_TEST_AREA "$HOME/offline" \
Tutorial "$HOME/offline/Tutorial"
- use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)
- No problem if you use a different way to configure your enviroment. Just set it up before you start Ganga
- Go to your work area dn check out your algorithm
- cd ~/offline/10.0.1
- cmt co -r AnalysisExamples-00-09-18 PhysicsAnalysis/AnalysisCommon/AnalysisExamples
- cd PhysicsAnalysis/AnalysisCommon/AnalysisExamples/AnalysisExamples-00-09-18/cmt
- source setup.sh
- gmake -j2
- Now go for coffee...
- Within Ganga you can do the same
- cmtsetup 10.0.1 opt
- cd PhysicsAnalysis/AnalysisCommon/AnalysisExamples/AnalyisExamples-00-09-18/cmt
- Setup
- gmake -j2
- Athena Job
- You could run your job with the Executable application handler
- There is a special Athena application handler which makes youre life much easier
- This concept maps directly to the Production System transformations
Running the Jobs
- Run Athena Hello World on the Grid
- Create Job
- Create Application object and configure it: this creates a tar file of the user area.
- j.application=Athena()
- j.application.prepare()
- Select a job option file
- j.application.option_file='HelloWorldOptions.py'
- Specify input
- Select backend
- Submit job
- Run Athena with input and output on LSF
- Create Job
- Create Application object and configure it: this creates a tar file of the user area.
- j.application=Athena()
- j.application.prepare()
- Select a job option file
- j.application.option_file='ttbarExample_jobOptions.py'
- Specify input (documentation also says j.application.input?)
- j.inputdata=ATLASCastorDataset()
- j.inputdata.list_datasets()
- j.inputdata.get_dataset('rome.004100.recov10.T1_McAtNLO_top','AOD',0,10) This gives an error indicating that the dataset does not exist.
- Define output data
- j.output.files=['ttbar.ntuple.root','ttbar.hist.root']
- Select backend
- Submit job
- Run Athena with input and output on the Grid
- Create Job
- Create Application object and configure it: this creates a tar file of the user area.
- j.application=Athena()
- j.application.prepare()
- Select a job option file
- j.application.option_file='ttbarExample_jobOptions.py'
- Specify input
-
- j.inputdata=ATLASDataset()
- j.inputdata.lfn=['rome.004100.recov10.T10_McAtNLO_top._00001.AOD.pool.root']
The number 00001 can range from 00001 to 00010.
- Define output data
- j.application.output.files=['ttbar.ntuple.root','ttbar.hist.root']
- Select backend
- Submit job
- j.submit() This gives an error indicating "Cannot plan: BrokerHelper: no compatible resources". Try again on Nov 15, 2005. Still failing.
Conversion from4.0.0-beta3
Major updates:
--
RichardStDenis - 19 Oct 2005
%RESPONSIBLE%
%REVIEW%