CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
cond2xml.CondXmlProcessor Class Reference
Inheritance diagram for cond2xml.CondXmlProcessor:

Public Member Functions

def __del__
 
def __init__
 
def payload2xml
 
def prepPayload2xml
 

Public Attributes

 conddb
 
 doCleanup
 

Static Public Attributes

tuple buildTime = time.time()
 
string cmd = "source /afs/cern.ch/cms/cmsset_default.sh;"
 
tuple libDir = os.path.join( os.environ["CMSSW_BASE"], 'tmp', os.environ["SCRAM_ARCH"], 'src', self.fakePkgName, 'src', self.fakePkgName.replace('/',''))
 
string libName = libDir+'/lib%s.so'
 
tuple ret = os.system(cmd)
 

Private Attributes

 _pl2xml_isPrepared
 

Detailed Description

Definition at line 109 of file cond2xml.py.

Constructor & Destructor Documentation

def cond2xml.CondXmlProcessor.__init__ (   self,
  condDBIn 
)

Definition at line 111 of file cond2xml.py.

112  def __init__(self, condDBIn):
113  self.conddb = condDBIn
114  self._pl2xml_isPrepared = False
def cond2xml.CondXmlProcessor.__del__ (   self)

Definition at line 123 of file cond2xml.py.

References cond2xml.CondXmlProcessor.doCleanup, and join().

124  def __del__(self):
125 
126  if self.doCleanup:
127  shutil.rmtree( '/'.join( self._pl2xml_tmpDir.split('/')[:-1] ) )
128  os.unlink( os.path.join( os.environ['CMSSW_BASE'], 'src', './pl2xmlComp.so') )
129  return
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Function Documentation

def cond2xml.CondXmlProcessor.payload2xml (   self,
  session,
  payload 
)

Definition at line 174 of file cond2xml.py.

References cond2xml.CondXmlProcessor._pl2xml_isPrepared, alcazmumu_cfi.filter, and cond2xml.CondXmlProcessor.prepPayload2xml().

175  def payload2xml(self, session, payload):
176 
177  if not self._pl2xml_isPrepared:
178  if not self.prepPayload2xml(session, payload):
179  msg = "Error preparing code for "+payload
180  raise Exception(msg)
181  self._pl2xml_isPrepared = True
182 
183  # get payload from DB:
184  result = session.query(self.conddb.Payload.data, self.conddb.Payload.object_type).filter(self.conddb.Payload.hash == payload).one()
185  data, plType = result
186 
187  sys.path.append('.')
188  import pl2xmlComp
189  resultXML = pl2xmlComp.payload2xml( str(data), str(plType) )
190  print resultXML
191 
def cond2xml.CondXmlProcessor.prepPayload2xml (   self,
  session,
  payload 
)

Definition at line 130 of file cond2xml.py.

References alcazmumu_cfi.filter.

Referenced by cond2xml.CondXmlProcessor.payload2xml().

131  def prepPayload2xml(self, session, payload):
132 
133  startTime = time.time()
134 
135  # get payload from DB:
136  result = session.query(self.conddb.Payload.data, self.conddb.Payload.object_type).filter(self.conddb.Payload.hash == payload).one()
137  data, plType = result
138 
139  info = { "mdName" : "pl2xmlComp",
140  'plType' : plType,
141  }
142 
143  code = payload2xmlCodeTemplate % info
144 
145  tmpDir = self._pl2xml_tmpDir
146  if ( os.path.exists( tmpDir ) ) :
147  msg = '\nERROR: %s already exists, please remove if you did not create that manually !!' % tmpDir
148  self.doCleanup = False
149  raise Exception(msg)
150 
151  os.makedirs( tmpDir+'/src' )
152 
153  buildFileName = "%s/BuildFile.xml" % (tmpDir,)
154  with open(buildFileName, 'w') as buildFile:
155  buildFile.write( buildFileTemplate )
156  buildFile.close()
157 
158  tmpFileName = "%s/src/%s" % (tmpDir, info['mdName'],)
159  with open(tmpFileName+'.cpp', 'w') as codeFile:
160  codeFile.write(code)
161  codeFile.close()

Member Data Documentation

cond2xml.CondXmlProcessor._pl2xml_isPrepared
private

Definition at line 113 of file cond2xml.py.

Referenced by cond2xml.CondXmlProcessor.payload2xml().

tuple cond2xml.CondXmlProcessor.buildTime = time.time()
static

Definition at line 169 of file cond2xml.py.

string cond2xml.CondXmlProcessor.cmd = "source /afs/cern.ch/cms/cmsset_default.sh;"
static

Definition at line 164 of file cond2xml.py.

cond2xml.CondXmlProcessor.conddb

Definition at line 112 of file cond2xml.py.

cond2xml.CondXmlProcessor.doCleanup

Definition at line 147 of file cond2xml.py.

Referenced by cond2xml.CondXmlProcessor.__del__().

tuple cond2xml.CondXmlProcessor.libDir = os.path.join( os.environ["CMSSW_BASE"], 'tmp', os.environ["SCRAM_ARCH"], 'src', self.fakePkgName, 'src', self.fakePkgName.replace('/',''))
static

Definition at line 162 of file cond2xml.py.

string cond2xml.CondXmlProcessor.libName = libDir+'/lib%s.so'
static

Definition at line 163 of file cond2xml.py.

tuple cond2xml.CondXmlProcessor.ret = os.system(cmd)
static

Definition at line 166 of file cond2xml.py.