Prun and ROOT

Hello,

I’m new to prun and am trying to submit a simple pyroot job to the grid. The job is:

import sys
from ROOT import *
inputs = sys.argv[-1].split(’,’)
NTup = TChain(‘physics’)
for i in inputs:
NTup.Add(i)
output = TFile(‘out1.root’,‘recreate’)
NTup.Write()
output.Close()

I’m submitting it as follows:

prun --exec “python filename.py %IN” --inDS data10blablabla --nFiles 2 --outDS user.cmwewa.test1234 --outputs out1.root

However, the job fails. Am suspecting that the problem is with ROOT because when I submit a job that doesn’t involve ROOT, it runs perfectly.

Is there any special way to import ROOT when submitting a job to the grid?
Please help.

Thank you.
Chilufya

Hi,

I’m not familiar with prun, but I presume that any failures are related to the shell environment not setup or setup differently on the grid site. If you need any more specific feedback, it’d be good to at least post how/what goes wrong, or otherwise ask the managers of the grid site.

Cheers,
Wim

Thanks Wim. After submitting the code to the grid, I get the following error:

Traceback (most recent call last):
File “second.py”, line 3, in ?
import ROOT
File “/localdisk/scratch/9851050.moab01.westgrid.uvic.ca/condorg_TLE25321/pilot3/Panda_Pilot_25375_1358456632/PandaJob_1705067428_1358456634/workDir/ROOT.py”, line 23, in ?
reload(ROOT)
ImportError: No module named ROOT

Is there anything I need to add to my working directory to make ROOT work?

Thanks,
Chilufya.

I am on a different grid system than you, where the jobs are bash scripts which run the actual programs. For my jobs which use PyROOT, I had to find a suitable Python+ROOT combination that worked together, so my bash script include these lines:

[code]export PYTHONPATH=/hep25/ATLASLocalRootBase/x86_64/python/2.5.4p2-x86_64-slc5-gcc43/sw/lcg/external/Python/2.5.4p2/x86_64-slc5-gcc43-opt/
. /home1x/hep/babar/package/root/5.32-00/Linux26SL5_x86_64_gcc412/bin/thisroot.sh

export PATH=$ROOTSYS/bin:$PYTHONPATH/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONPATH/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH
[/code]
Now yours will of course be different, but these kinds of things are usually done on an interactive machine as part of installing ROOT/PyROOT, while on a batch machine the environment variables aren’t set properly.

A good way to debug would be to have your job print the current value of the enviroment variables (and binaries on the path). The equivalent of “which root”, “which python”, and “echo $PYTHONPATH” in bash for example.

Jean-François

Thanks Jean-François. My problem has now been solved by adding --athenaTag=AtlasProduction,17.2.8.5 to the prun command. I hope this continues to work for me.

Cheers,
Chilufya.