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 Test Version 4.1.0-beta4-t1New testing with new RLC, private release.

Ganga Test Version 4.1.0Test of 4.1.0.

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

  1. Setup Ganga
    1. Login on LXPLUS
      • LSF and LCG UI only on lxplus
    2. 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
  2. Configure Ganga
    1. Create configuration file
    2. Edit configuration file
      • emacs ~/.gangarc
        • Configuration section
          • RUNTIME_PATH = GangaAtlas
        • LCG section
          • SETUP = /afs/...
          • VirtualOrganisation = atlas
        • Customize Athena section
          • LCGOutputLocation =
          • LocalOutputLocation =
            note.gif 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 ...
                • rfchmod 777 ...
  3. Try it out: hand.gif Click Here for a Screen Dump
  4. Play with the Shell
    • It's Python. Well actually IPython, a part of scientific python and has a better python prompt.
      • print 'hello World'
    • With some some shortcuts
      • p 5 + 10
    • Tab expand for shell and python
    • Some shell commands work directly
      • ls, cd, pwd, less, edit
    • Others can be run with an !
      • cmt show macros
      • make
    • Jobs are a python object
    • Help available
      • help 'index'
      • help Job
    • 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

  1. Create a Generic Job and print the object: hand.gif Click Here for a Screen Dump
    • j=Job()
    • p j
  2. 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']
  3. Run it hand.gif Click Here for a Screen Dump of all this
    • Locally
      • j.submit()
    • LSF
      • j2=j.copy()
      • j2.backend=LSF()
      • j2.submit
    • LCG
      • j3=j.copy()
      • j3.backend=LCG()
      • j3.submit()
  4. Look at the result
  5. 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()
  6. Useful Hints
    • List of your jobs hand.gif Click Here for a Screen Dump of the commands below
      • p jobs
        tip.gif p is a shorthand for print
      • jobs
    • Kill a job
      • j.kill()
    • See the status of a job
      • print j.backend.status
    • Clean up all jobs
      • jobs.clean()
    • Try also tab-expand on j
    • print j.id hand.gif Screen Dump
    • for jj in jobs.ids(0,150): print jobs[jj].id,jobs[jj].name hand.gif Screen Dump
    • for jj in range(100):
      ... jj=Job() hand.gif Screen Dump This example created 100 jobs. One could put addition items into the loop to distinguish jobs and submit them all.
    • for id in range(30):
      ... jobs[id].kill()
    • Use a specific Grid Site: hand.gif Exmaples of success and failures in using this
      • j120=j4.copy()
      • j120.backend.CE='mu6.matrix.sara.nl:2119/jobmanager-pbs-atlas"
  7. 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
    • DDM in the near future
  • 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

  1. Run Athena Hello World on the Grid
    • Create Job
      • j=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
      • j.inputdata=None
    • Select backend
      • j.backend=LCG()
    • Submit job
      • j.submit()
  2. Run Athena with input and output on LSF
    • Create Job
      • j=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) stop.gif 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
      • j.backend=LSF()
    • Submit job
      • j.submit()
  3. Run Athena with input and output on the Grid
    • Create Job
      • j=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
      • j.backend=LCG()
    • Submit job
      • j.submit() stop.gif This gives an error indicating "Cannot plan: BrokerHelper: no compatible resources". Try again on Nov 15, 2005. Still failing.
  • Job Splitting
     for I in xrange(0,10):
            j=j.copy()
            j.inputdata=["rome.004100.recov10.T10_McAtNLO_top._[%5.5d-%5.5d].AOD.pool.root' % ((i-1)*10+1,i*10)]
            j.submit()
    
    We are working to have a better mechanism in the next release
  • Not so far future
    • New ATLAS data management
    • Integration with ATLAS Prodsys
    • Next Ganga features
    • GUI

Conversion from4.0.0-beta3


Major updates:
-- RichardStDenis - 19 Oct 2005

%RESPONSIBLE%
%REVIEW%

Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r13 - 2006-03-30 - RichardStDenis
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback