CMS 3D CMS Logo

Classes | Functions
ConfigBuilder Namespace Reference

Classes

class  ConfigBuilder
 
class  Options
 

Functions

def anyOf (listOfKeys, dict, opt=None)
 
def dumpPython (process, name)
 
def filesFromDASQuery (query, option="", s=None)
 
def filesFromList (fileName, s=None)
 

Function Documentation

def ConfigBuilder.anyOf (   listOfKeys,
  dict,
  opt = None 
)

Definition at line 178 of file ConfigBuilder.py.

References join().

178 def anyOf(listOfKeys,dict,opt=None):
179  for k in listOfKeys:
180  if k in dict:
181  toReturn=dict[k]
182  dict.pop(k)
183  return toReturn
184  if opt!=None:
185  return opt
186  else:
187  raise Exception("any of "+','.join(listOfKeys)+" are mandatory entries of --output options")
188 
def anyOf(listOfKeys, dict, opt=None)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def ConfigBuilder.dumpPython (   process,
  name 
)

Definition at line 88 of file ConfigBuilder.py.

Referenced by htmlCreator.create(), pdfCreator.create(), EgammaHLTValidationUtils.getResult(), EnablePSetHistory.new_recurseDumpModifications_(), ConfigBuilder.ConfigBuilder.prepare(), SequenceTypes.TestModuleCommand.testCopyAndExclude(), and Config.TestModuleCommand.testDelete().

88 def dumpPython(process,name):
89  theObject = getattr(process,name)
90  if isinstance(theObject,cms.Path) or isinstance(theObject,cms.EndPath) or isinstance(theObject,cms.Sequence):
91  return "process."+name+" = " + theObject.dumpPython("process")
92  elif isinstance(theObject,_Module) or isinstance(theObject,cms.ESProducer):
93  return "process."+name+" = " + theObject.dumpPython()+"\n"
94  else:
95  return "process."+name+" = " + theObject.dumpPython()+"\n"
def dumpPython(process, name)
def ConfigBuilder.filesFromDASQuery (   query,
  option = "",
  s = None 
)

Definition at line 130 of file ConfigBuilder.py.

References split.

Referenced by ConfigBuilder.ConfigBuilder.filesFromOption(), and ConfigBuilder.ConfigBuilder.prepare_DATAMIX().

130 def filesFromDASQuery(query,option="",s=None):
131  import os,time
132  import FWCore.ParameterSet.Config as cms
133  prim=[]
134  sec=[]
135  print "the query is",query
136  eC=5
137  count=0
138  while eC!=0 and count<3:
139  if count!=0:
140  print 'Sleeping, then retrying DAS'
141  time.sleep(100)
142  p = Popen('das_client %s --query "%s"'%(option,query), stdout=PIPE,shell=True)
143  pipe=p.stdout.read()
144  tupleP = os.waitpid(p.pid, 0)
145  eC=tupleP[1]
146  count=count+1
147  if eC==0:
148  print "DAS succeeded after",count,"attempts",eC
149  else:
150  print "DAS failed 3 times- I give up"
151  for line in pipe.split('\n'):
152  if line.count(".root")>=2:
153  #two files solution...
154  entries=line.replace("\n","").split()
155  if not entries[0] in prim:
156  prim.append(entries[0])
157  if not entries[1] in sec:
158  sec.append(entries[1])
159  elif (line.find(".root")!=-1):
160  entry=line.replace("\n","")
161  if not entry in prim:
162  prim.append(entry)
163  if s:
164  if not hasattr(s,"fileNames"):
165  s.fileNames=cms.untracked.vstring(prim)
166  else:
167  s.fileNames.extend(prim)
168  if len(sec)!=0:
169  if not hasattr(s,"secondaryFileNames"):
170  s.secondaryFileNames=cms.untracked.vstring(sec)
171  else:
172  s.secondaryFileNames.extend(sec)
173  print "found files: ",prim
174  if len(sec)!=0:
175  print "found parent files:",sec
176  return (prim,sec)
177 
def filesFromDASQuery(query, option="", s=None)
double split
Definition: MVATrainer.cc:139
def ConfigBuilder.filesFromList (   fileName,
  s = None 
)

Definition at line 96 of file ConfigBuilder.py.

References split.

Referenced by ConfigBuilder.ConfigBuilder.filesFromOption(), and ConfigBuilder.ConfigBuilder.prepare_DATAMIX().

96 def filesFromList(fileName,s=None):
97  import os
98  import FWCore.ParameterSet.Config as cms
99  prim=[]
100  sec=[]
101  for line in open(fileName,'r'):
102  if line.count(".root")>=2:
103  #two files solution...
104  entries=line.replace("\n","").split()
105  if not entries[0] in prim:
106  prim.append(entries[0])
107  if not entries[1] in sec:
108  sec.append(entries[1])
109  elif (line.find(".root")!=-1):
110  entry=line.replace("\n","")
111  if not entry in prim:
112  prim.append(entry)
113  if s:
114  if not hasattr(s,"fileNames"):
115  s.fileNames=cms.untracked.vstring(prim)
116  else:
117  s.fileNames.extend(prim)
118  if len(sec)!=0:
119  if not hasattr(s,"secondaryFileNames"):
120  s.secondaryFileNames=cms.untracked.vstring(sec)
121  else:
122  s.secondaryFileNames.extend(sec)
123  print "found files: ",prim
124  if len(prim)==0:
125  raise Exception("There are not files in input from the file list")
126  if len(sec)!=0:
127  print "found parent files:",sec
128  return (prim,sec)
129 
def filesFromList(fileName, s=None)
double split
Definition: MVATrainer.cc:139