ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PsetManipulator.py
(Generate patch)

Comparing COMP/CRAB/python/PsetManipulator.py (file contents):
Revision 1.17 by ewv, Wed Apr 30 19:41:29 2008 UTC vs.
Revision 1.24 by ewv, Tue Dec 16 17:07:08 2008 UTC

# Line 43 | Line 43 | class PsetManipulator:
43                  self.cmsProcess = self.cfo
44              except Exception, ex:
45                  msg =  "Your cfg file is not valid, %s\n" % str(ex)
46 <                msg += "  https://twiki.cern.ch/twiki/bin/view/CMS/CrabFaq#Problem_with_ParameterSet_parsin\n"
46 >                msg += "  https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabFaq#Problem_with_ParameterSet_parsin\n"
47                  msg += "  may help you understand the problem."
48                  raise CrabException(msg)
49          self.cfg = CfgInterface(self.cmsProcess)
# Line 55 | Line 55 | class PsetManipulator:
55          self.cfg.maxEvents.setMaxEventsInput(maxEv)
56          return
57  
58 +    def skipEvent(self, skipEv):
59 +        """
60 +        Set max event in the standalone untracked module
61 +        """
62 +        self.cfg.inputSource.setSkipEvents(skipEv)
63 +        return
64 +
65      def psetWriter(self, name):
66          """
67          Write out modified CMSSW.cfg
# Line 63 | Line 70 | class PsetManipulator:
70          # FUTURE: Can drop cfg mode for CMSSW < 2_1_x
71          outFile = open(common.work_space.jobDir()+name,"w")
72          if name.endswith('py'):
73 <          outFile.write("import FWCore.ParameterSet.Config as cms\n")
74 <          outFile.write(self.cmsProcess.dumpPython())
73 >            outFile.write("import FWCore.ParameterSet.Config as cms\n")
74 >            try:
75 >                outFile.write(self.cmsProcess.dumpPython())
76 >            except Exception, ex:
77 >                msg =  "Your cfg file is not valid, %s\n" % str(ex)
78 >                msg += "  https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabFaq#Problem_with_ParameterSet_parsin\n"
79 >                msg += "  may help you understand the problem."
80 >                raise CrabException(msg)
81 >
82          else:
83 <          outFile.write(str(self.cfg))
83 >            outFile.write(self.cfg.data.dumpConfig())
84          outFile.close()
85  
86          return
# Line 97 | Line 111 | class PsetManipulator:
111              messageLogger.fwkJobReports.append(name)
112  
113          return
114 +
115 +    def getTFileService(self):
116 +        """ Get Output filename from TFileService and return it. If not existing, return None """
117 +        if not self.cfg.data.services.has_key('TFileService'):
118 +            return None
119 +        tFileService = self.cfg.data.services['TFileService']
120 +        if "fileName" in tFileService.parameterNames_():
121 +            fileName = getattr(tFileService,'fileName',None).value()
122 +            return fileName
123 +        return None
124 +
125 +    def getPoolOutputModule(self):
126 +        """ Get Output filename from PoolOutputModule and return it. If not existing, return None """
127 +        if not self.cfg.data.outputModules:
128 +            return None
129 +        poolOutputModule = self.cfg.data.outputModules
130 +        for out in poolOutputModule:
131 +            return poolOutputModule[out].fileName.value()
132 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines