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

References join().

Referenced by ConfigBuilder.ConfigBuilder.addOutput().

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

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

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

Definition at line 134 of file ConfigBuilder.py.

References edm.print(), and split.

Referenced by ConfigBuilder.ConfigBuilder.addSource(), ConfigBuilder.ConfigBuilder.addStandardSequences(), and ConfigBuilder.ConfigBuilder.prepare_DATAMIX().

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

Definition at line 100 of file ConfigBuilder.py.

References edm.print(), and split.

Referenced by ConfigBuilder.ConfigBuilder.addSource(), ConfigBuilder.ConfigBuilder.addStandardSequences(), and ConfigBuilder.ConfigBuilder.prepare_DATAMIX().

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