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.26 by ewv, Tue Feb 24 16:19:25 2009 UTC vs.
Revision 1.30 by ewv, Mon Jul 20 19:33:02 2009 UTC

# Line 3 | Line 3
3   import os
4   import common
5   import imp
6 + import pickle
7  
8   from crab_util import *
9   from crab_exceptions import *
9 from crab_logger import Logger
10  
11   from ProdCommon.CMSConfigTools.ConfigAPI.CfgInterface import CfgInterface
12   from FWCore.ParameterSet.DictTypes import SortedKeysDict
# Line 25 | Line 25 | class PsetManipulator:
25          self.pset = pset
26          #convert Pset
27          from FWCore.ParameterSet.Config import include
28 <        common.logger.debug(3,"PsetManipulator::__init__: PSet file = "+self.pset)
28 >        common.logger.debug("PsetManipulator::__init__: PSet file = "+self.pset)
29          # FUTURE: Can drop cfg mode for CMSSW < 2_1_x
30          if self.pset.endswith('py'):
31              handle = open(self.pset, 'r')
# Line 72 | Line 72 | class PsetManipulator:
72          outFile = open(common.work_space.jobDir()+name,"w")
73          if name.endswith('py'):
74              outFile.write("import FWCore.ParameterSet.Config as cms\n")
75 <            try:
76 <                outFile.write(self.cmsProcess.dumpPython())
77 <            except Exception, ex:
78 <                msg =  "Your cfg file is not valid, %s\n" % str(ex)
79 <                msg += "  https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabFaq#Problem_with_ParameterSet_parsin\n"
80 <                msg += "  may help you understand the problem."
81 <                raise CrabException(msg)
82 <
75 >            outFile.write("import pickle\n")
76 >            outFile.write("pickledCfg=\"\"\"%s\"\"\"\n" % pickle.dumps(self.cmsProcess))
77 >            outFile.write("process = pickle.loads(pickledCfg)\n")
78          else:
79              outFile.write(self.cfg.data.dumpConfig())
80          outFile.close()
# Line 101 | Line 96 | class PsetManipulator:
96          if not self.cfg.data.outputModules:
97              return None
98          poolOutputModule = self.cfg.data.outputModules
99 +        # FIXME: Still a "bug" here in that only one name is returned and the POM can be in any order
100          for out in poolOutputModule:
101 +            if poolOutputModule[out].type_() != "PoolOutputModule":
102 +                continue
103              return poolOutputModule[out].fileName.value()
104  
105 +    def getBadFilesSetting(self):
106 +        setting = False
107 +        try:
108 +            if self.cfg.data.source.skipBadFiles.value():
109 +                setting = True
110 +        except AttributeError:
111 +            pass # Either no source or no setting of skipBadFiles
112 +        return setting

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines