User Tools

Site Tools


ganga:ganga

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ganga:ganga [2012/08/01 16:56] – [Submitting a ROOT-job] decianmganga:ganga [2017/01/12 12:31] (current) bernet
Line 5: Line 5:
 ===== Where to run ===== ===== Where to run =====
 Ganga can be run on every lxplus node. The preferred option however is to run it locally from Zurich on grid-ui, as there are no (less) disk quota constraints. Ganga can be run on every lxplus node. The preferred option however is to run it locally from Zurich on grid-ui, as there are no (less) disk quota constraints.
 +
 +===== Ganga configuration on Zurich Grid Cluster =====
 +
 +Before starting Ganga the first time on the Zurich cluster, download and install the following [[http://lhcb.physik.uzh.ch/wiki/.gangarc|.gangarc]] file in your home directory. This will create the correct Ganga environement for you.
  
 ===== Starting Ganga on lxplus / grid-ui ===== ===== Starting Ganga on lxplus / grid-ui =====
Line 400: Line 404:
  
 ===== Submitting a ROOT-job ===== ===== Submitting a ROOT-job =====
-It can be useful to submit ROOT-jobs to the Grid via Dirac. You can submit ".C"-ROOT-scripts or python scripts. If your script needs external libraries, they can be added to the inputsandox like+It can be useful to submit ROOT-jobs to the Grid via Dirac. You can submit ''.C''-ROOT-scripts or python scripts. If your script needs external libraries, they can be added to the inputsandox like
 <code python> <code python>
 j = Job() j = Job()
Line 407: Line 411:
 </code> </code>
  
-You can also pass arguments to a script. Suppose you have a script "myScript.Clike:+You can also pass arguments to a script. Suppose you have a script ''myScript.C'' like:
 <code C> <code C>
 void myScript(int a, int b){ void myScript(int a, int b){
Line 432: Line 436:
 which will generate two subjobs with the arguments (1,2) and (2,3). which will generate two subjobs with the arguments (1,2) and (2,3).
  
 +A complete example therefore would look like:
 +<code python>
 +argList=[]
 +for ia in range(1,5): 
 +    for ib in range(1,7):
 +       argList.append([ ia, ib])
 +
 +j = Job()
 +j.name = 'my great ROOT job'
 +j.inputsandbox = [ File ( name = '/somePath/lib1.so'), File ( name = '/somePath2/lib2.so')]
 +j.application = Root (
 +    version = '5.34.00' ,
 +    usepython = False ,
 +    script = File ( name = '/somePath/myScript.C' ) )
 +argSplit = ArgSplitter( args = argList )
 +j.splitter = argSplit
 +j.submit()
 +</code>
 +
 +  *Note: Due to a weird bug (1.8.2012) 0 is not allowed as an argument...
 +  *Note: When submitting a ROOT-job to the LSF, make sure the Ganga version in the shell you submit the ganga-job from and the one requested in ''j.application'' agree. You can set the ROOT version for Ganga in the shell with (for example): ''SetupProject Ganga v508r6 ROOT -v 5.34.00''
 ===== Forcing a job to run on a specific site ===== ===== Forcing a job to run on a specific site =====
 For this, do: For this, do:
Line 445: Line 470:
 dirac-proxy-init -g lhcb_user dirac-proxy-init -g lhcb_user
 </code> </code>
 +
 +===== Bookkeeping information within Ganga =====
 +A simple method that can be added to the ~/.ganga.py to access information directly from the BK can be seen below:
 +
 +<code python>
 +def getBKInfo ( evttype )  :
 +    from subprocess import Popen, PIPE
 +
 +    serr = open ( '/dev/null' )
 +    pipe = Popen ( [ 'get_bookkeeping_info'  , str(evttype) ] ,
 +                   env    = os.environ ,
 +                   stdout = PIPE       ,
 +                   stderr = serr       )
 +            
 +    stdout = pipe.stdout
 +    ts = {} 
 +    result = {} 
 +        
 +    for line in stdout :
 +    
 +        try :
 +            value = eval ( line )
 +        except :
 +            continue
 +            
 +        if not isinstance ( value    , tuple ) : continue
 +        if not isinstance ( value[0] , str   ) : continue
 +        if not isinstance ( value[1] , str   ) : continue
 +        if not isinstance ( value[2] , str   ) : continue
 +
 +        if result.has_key ( value[0] ) : continue
 +        result [ value[0] ] = value[1:]
 +
 +    return result
 +</code>
 +
 +In this case two additional files 'get_bookkeeping_info' and 'dirac-bookkeeping-get-prodinfo-eventtype.py' are required to be saved locally in your ~/bin/ directory. 
 +
 +More info can be found here: [[https://groups.cern.ch/group/lhcb-bender/Lists/Archive/DispForm.aspx?ID=551]]
 +and here: [[https://groups.cern.ch/group/lhcb-bender/Lists/Archive/DispForm.aspx?ID=695]]
  
 ===== Help ===== ===== Help =====
 To see the documentation, type ''help()'' in the interactive mode. To get help about a specific topic, e.g. Dirac, type ''help(Dirac)'' in the interactive mode. To see the documentation, type ''help()'' in the interactive mode. To get help about a specific topic, e.g. Dirac, type ''help(Dirac)'' in the interactive mode.
  
-===== The Commandments when working with Ganga =====+===== The Commandments when working with Ganga =====
   *Thou shall be patient.   *Thou shall be patient.
   *Thou shall never use PFNs when thou needest LFNs.   *Thou shall never use PFNs when thou needest LFNs.
-  *Thou shall write an email to ''lhcb-distributed-analysis@cern.ch'', if thou art desparate. Thou shall wait patiently for a reply and thy wisdom will flourish.+  *Thou shall write an email to ''lhcb-distributed-analysis@cern.ch'', if thou art desperate. Thou shall wait patiently for a reply and thy wisdom will flourish.
   *Thou shall start a test-job before running the full job. The ways of making mistakes are manifold.   *Thou shall start a test-job before running the full job. The ways of making mistakes are manifold.
   *Thou shall always check if thy output will be bearable for thy quota.   *Thou shall always check if thy output will be bearable for thy quota.
Line 459: Line 524:
 Information for using ganga in LHCb (and where I stole most of the information from): [[http://ganga.web.cern.ch/ganga/user/html/LHCb/]] Information for using ganga in LHCb (and where I stole most of the information from): [[http://ganga.web.cern.ch/ganga/user/html/LHCb/]]
  
 +Ganga/Dirac mailing list archive: [[https://groups.cern.ch/group/lhcb-distributed-analysis/Lists/Archive/100.aspx]]
ganga/ganga.1343832983.txt.gz · Last modified: 2012/08/01 16:56 by decianm