This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
ganga:ganga [2012/01/22 18:23] – decianm | ganga:ganga [2017/01/12 12:21] – 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 .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 84: | Line 88: | ||
===== How to resubmit all failed subjobs ===== | ===== How to resubmit all failed subjobs ===== | ||
Sometimes it is also useful to ban a site and resubmit the jobs. | Sometimes it is also useful to ban a site and resubmit the jobs. | ||
+ | <code python> | ||
+ | for js in jobs(24).subjobs.select(status=' | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | or | ||
<code python> | <code python> | ||
for job in jobs.select(5, | for job in jobs.select(5, | ||
Line 393: | Line 403: | ||
which will take 20 files per job. | which will take 20 files per job. | ||
+ | ===== Submitting a ROOT-job ===== | ||
+ | It can be useful to submit ROOT-jobs to the Grid via Dirac. You can submit '' | ||
+ | <code python> | ||
+ | j = Job() | ||
+ | j.name = 'my great ROOT job' | ||
+ | j.inputsandbox = [ File ( name = '/ | ||
+ | </ | ||
+ | |||
+ | You can also pass arguments to a script. Suppose you have a script '' | ||
+ | <code C> | ||
+ | void myScript(int a, int b){ | ||
+ | | ||
+ | // -- Do something useful | ||
+ | } | ||
+ | </ | ||
+ | and you would like to pass intput arguments for a and b. This can be done with the following piece of code: | ||
+ | <code python> | ||
+ | j.application = Root ( | ||
+ | version = ' | ||
+ | usepython = False , | ||
+ | args = [1,2], | ||
+ | script = File ( name = '/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Furthermore it is very useful to run subjobs with different arguments for the script. For this you need the ArgSplitter: | ||
+ | <code python> | ||
+ | argList = [[1,2], [2,3]] | ||
+ | argSplit = ArgSplitter( args = argList ) | ||
+ | j.splitter = argSplit | ||
+ | </ | ||
+ | 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, | ||
+ | for ib in range(1,7): | ||
+ | | ||
+ | |||
+ | j = Job() | ||
+ | j.name = 'my great ROOT job' | ||
+ | j.inputsandbox = [ File ( name = '/ | ||
+ | j.application = Root ( | ||
+ | version = ' | ||
+ | usepython = False , | ||
+ | script = File ( name = '/ | ||
+ | argSplit = ArgSplitter( args = argList ) | ||
+ | j.splitter = argSplit | ||
+ | j.submit() | ||
+ | </ | ||
+ | |||
+ | *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 '' | ||
===== 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 406: | Line 470: | ||
dirac-proxy-init -g lhcb_user | dirac-proxy-init -g lhcb_user | ||
</ | </ | ||
+ | |||
+ | ===== 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 ( '/ | ||
+ | pipe = Popen ( [ ' | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | In this case two additional files ' | ||
+ | |||
+ | More info can be found here: [[https:// | ||
+ | and here: [[https:// | ||
===== Help ===== | ===== Help ===== | ||
To see the documentation, | To see the documentation, | ||
- | ===== The n Commandments when working with Ganga ===== | + | ===== The N 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 '' | + | *Thou shall write an email to '' |
*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 420: | Line 524: | ||
Information for using ganga in LHCb (and where I stole most of the information from): [[http:// | Information for using ganga in LHCb (and where I stole most of the information from): [[http:// | ||
+ | Ganga/Dirac mailing list archive: [[https:// |