24 |
|
#convert Pset |
25 |
|
from FWCore.ParameterSet.Config import include |
26 |
|
common.logger.debug(3,"PsetManipulator::__init__: PSet file = "+self.pset) |
27 |
< |
self.cfo = include(self.pset) |
28 |
< |
self.cfg = CfgInterface(self.cfo) |
27 |
> |
if (self.pset.endswith('py') or self.pset.endswith('pycfg') ): |
28 |
> |
handle = open(self.pset, 'r') |
29 |
> |
try: # Nested form for Python < 2.5 |
30 |
> |
try: |
31 |
> |
self.cfo = imp.load_source("pycfg", self.pset, handle) |
32 |
> |
except Exception, ex: |
33 |
> |
msg = "Your pycfg file is not valid python: %s" % str(ex) |
34 |
> |
raise CrabException(msg) |
35 |
> |
finally: |
36 |
> |
handle.close() |
37 |
> |
self.cfg = CfgInterface(self.cfo.process) |
38 |
> |
else: |
39 |
> |
try: |
40 |
> |
self.cfo = include(self.pset) |
41 |
> |
self.cfg = CfgInterface(self.cfo) |
42 |
> |
except Exception, ex: |
43 |
> |
msg = "Your cfg file is not valid, %s\n" % str(ex) |
44 |
> |
msg += " https://twiki.cern.ch/twiki/bin/view/CMS/CrabFaq#Problem_with_ParameterSet_parsin\n" |
45 |
> |
msg += " may help you understand the problem." |
46 |
> |
raise CrabException(msg) |
47 |
> |
pass |
48 |
|
|
49 |
|
def inputModule(self, source): |
50 |
|
""" |
138 |
|
""" |
139 |
|
_addCrabFJR_ |
140 |
|
add CRAB specific FrameworkJobReport (FJR) |
141 |
< |
if a FJR already exists in input CMSSW parameter-set, add a second one |
141 |
> |
if a FJR already exists in input CMSSW parameter-set, add a second one. |
142 |
> |
This code is not needed for CMSSW >= 1.5.x and is non-functional in CMSSW >= 1.7.x. |
143 |
> |
It should be removed at some point in the future. |
144 |
|
""" |
145 |
|
|
146 |
|
# Check if MessageLogger service already exists in configuration. If not, add it |
159 |
|
if name not in messageLogger.fwkJobReports: |
160 |
|
messageLogger.fwkJobReports.append(name) |
161 |
|
|
162 |
< |
return |
162 |
> |
return |