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 179 of file ConfigBuilder.py.

References join().

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

Definition at line 89 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().

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

Definition at line 131 of file ConfigBuilder.py.

References split.

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

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

Definition at line 97 of file ConfigBuilder.py.

References split.

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

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