ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PsetManipulator150.py
Revision: 1.2
Committed: Tue Jun 26 16:02:20 2007 UTC (17 years, 10 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_1_5_3_pre2
Changes since 1.1: +0 -1 lines
Log Message:
printout removed

File Contents

# User Rev Content
1 slacapra 1.1 from PsetManipulator import *
2    
3     class PsetManipulator(PsetManipulator) :
4     def __init__(self, pset):
5     """
6     Convert Pset in Python format and initialize
7     To be used with CMSSW version >150
8     """
9    
10     self.pset = pset
11     #convert Pset
12     self.pyPset = os.path.basename(pset)
13     # Check wether edmConfigToPython or EdmConfigToPython is the right command
14    
15     cmdEdmToPy = ''
16     cmdUp = 'which EdmConfigToPython > /dev/null 2>&1'
17     cmdLow = 'which edmConfigToPython > /dev/null 2>&1'
18     if os.system(cmdUp) == 0:
19     cmdEdmToPy = 'EdmConfigToPython'
20     elif os.system(cmdLow) == 0:
21     cmdEdmToPy = 'edmConfigToPython'
22     else:
23     msg = 'Could not find EdmConfigToPython nor edmConfigToPython in the path\m'
24     raise CrabException(msg)
25    
26     cmd = cmdEdmToPy+' > '+common.work_space.shareDir()+self.pyPset+'py < '+ self.pset
27     print cmd
28     exit_code = os.system(cmd)
29     if exit_code != 0 :
30     msg = 'Could not convert '+self.pset+' into a python Dictionary \n'
31     msg += 'Failed to execute \n'+cmd+'\n'
32     msg += 'Exit code : '+str(exit_code)
33    
34     raise CrabException(msg)
35     pass
36    
37     self.par = file(common.work_space.shareDir()+self.pyPset+'py').read()
38    
39     # get PSet
40     self.cfg = CfgInterface(self.par,True)
41    
42     def maxEvent(self, maxEv):
43     """ Set max event in the standalone untracked module """
44     self.cfg.hackMaxEvents(maxEv)
45     return