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

References join().

Referenced by ConfigBuilder.ConfigBuilder.addOutput().

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

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

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

Definition at line 132 of file ConfigBuilder.py.

References edm.print(), and split.

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

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

References edm.print(), and split.

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

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