RStDGanga410beta4

Ganga Version 4.1.0beta4

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/user/l/liko/working/ganga/bin/ganga
        • sh
          • alias ganga=/afs/cern.ch/user/l/liko/working/ganga/bin/ganga
      • PATH Method
        • csh
        • sh
          Modify your .zshenv to contain
          export PATH=/afs/cern.ch/user/l/liko/working/ganga/bin:$PATH
  2. Configure Ganga
    1. Create configuration file
    2. Edit configuration file
      • emacs ~/.gangarc
        • Configuration section: normally the first, we are using the second.
          • RUNTIME_PATH = GangaAtlas
          • RUNTIME_PATH = /afs/cern.ch/user/l/liko/public/GangaAtlas
        • LCG section
          • SETUP = /afs/...
          • VirtualOrganisation = atlas
  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 Screen Dump Failure for another method
      • 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 11.0.3
      • 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
  • Determine the latest version of AnalysisExamples
    • ls /afs/cern.ch/atlas/software/dist/11.0.3/PhysicsAnalysis/AnalysisCommon/AnalysisExamples
    • You see that it is: AnalysisExamples-00-11-00
  • Go to your work area dn check out your algorithm
    • cd ~/offline/11.0.3
    • cmt co -r AnalysisExamples-00-11-00 PhysicsAnalysis/AnalysisCommon/AnalysisExamples
    • cd PhysicsAnalysis/AnalysisCommon/AnalysisExamples/AnalysisExamples-00-11-00/cmt
    • source setup.sh
    • gmake -j2
    • Now go for coffee...
  • Within Ganga you can do the same
    • cmt setup 11.0.3 opt
    • cd PhysicsAnalysis/AnalysisCommon/AnalysisExamples/AnalyisExamples-00-11-00/cmt
    • Setup
    • gmake -
  • 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
    • Set up the environment variables for the right replica catalog (perhaps in your .bashrc or .zshrc)
      • export LFC_HOST=lfc-atlas-test.cern.ch
      • export LCG_CATALOG_TYPE=lfc
    • Go to the run directory
      • cd ~/testarea/11.0.3/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/AnalysisExamples-00-11-00/run
    • Start ganga Screen Dump
      • ganga
    • Create Job
      • j=Job()
    • Create Application object and configure it: this creates a tar file of the user area. Screen Dump
      • j.application=Athena()
      • j.application.prepare()
    • Select a job option file like HelloWorldOptions.py:
      • j.application.option_file='HelloWorldOptions.py'
    • Specify input
      • j.inputdata=None
    • Select backend
      • j.backend=LCG()
    • Submit job (Screen Dump)
      • j.submit()
  2. Run Athena with input and output on LSF
    • Create Job
      • j2=Job()
    • Create Application object and configure it: this creates a tar file of the user area.
      • j2.application=Athena()
      • j2.application.prepare() Screen Dump
    • Select a job option file
      • j2.application.option_file='ttbarExample_jobOptions.py'
    • Specify input (documentation also says j.application.input?)
      • j2.inputdata=ATLASCastorDataset()
      • j2.inputdata.set_dataset_type('rome-aod')
      • j2.inputdata.list_datasets() Screen Dump
      • j2.inputdata.get_dataset('rome.004100.recov10.T1_McAtNLO_top',0,10) Screen Dump
    • Define output data
      • j2.application.output.files=['ttbar.ntuple.root','ttbar.hist.root']
    • Select backend
      • j2.backend=LSF()
    • Submit job
    • Examine Results
      • p j2 Screen Dump
      • outfile2=file(j2.outputdir+'/stdout')
      • print outfile2.read() Screen Dump
      • Output is at: /castor/cern.ch/atlas/scratch/$USER/ganga/$JOBID Screen Dump
  3. Run Athena with input and output on the Grid
    • Create Job
      • j3=Job()
    • Create Application object and configure it: this creates a tar file of the user area.
      • j3.application=Athena()
      • j3.application.prepare()
    • Select a job option file
      • j3.application.option_file='ttbarExample_jobOptions.py'
    • Specify input
      • j3.inputdata=ATLASDataset()
      • j3.inputdata.lfn=['rome.004100.recov10.T1_McAtNLO_top._00001.AOD.pool.root']
        The number 00001 can range from 00001 to 00010.
    • Define output data
      • j3.application.output.files=['ttbar.ntuple.root','ttbar.hist.root']
    • Select backend
      • j3.backend=LCG()
    • Submit job
      • j3.submit()
    • Examine result
      • p j3 Screen Dump
      • outfile3 = file(j3.outputdir+'/stdout')
      • print outfile3.read() stop.gif There is an error when trying to run the job.
    • tip.gif Error Hint: The error indicating "Cannot plan: BrokerHelper: no compatible resources". is in fact due to a misspelling of the filename. So if you get this error, check your spelling.
  • Job Splitting
     for j4 in xrange(0,10):
            j4=j3.copy()
            j4.inputdata=["rome.004100.recov10.T10_McAtNLO_top._[%5.5d-%5.5d].AOD.pool.root' % ((i-1)*10+1,i*10)]
            j4.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


Major updates:
-- RichardStDenis - 19 Oct 2005

%RESPONSIBLE%
%REVIEW%

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r7 - 2006-03-21 - 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