10 from xml.dom
import minidom
29 from optparse
import OptionParser
35 """Returns the current line number in our program.""" 36 return inspect.currentframe().f_back.f_lineno
41 sz = info[stat.ST_SIZE]
47 string=
"lumiCalc2.py -c frontier://LumiCalc/CMS_LUMI_PROD -i " 48 string1=
" --nowarning overview >" 49 string2= string + file + string1 + namefile
50 data = os.system(string2)
53 print "0 lumi are not avaible" 59 url =
"http://cmsdbsprod.cern.ch/cms_dbs_prod_global/servlet/DBSServlet" 64 args[
'level'] =
'CRITICAL' 67 api = DBSAPI.dbsApi.DbsApi(args)
71 files = api.listFiles(path=dataset,tier_list =site,runNumber=run)
72 except DbsApiException
as ex:
73 print "Caught API Exception %s: %s " % (ex.getClassName(), ex.getErrorMessage() )
75 if ex.getErrorCode()
not in (
None,
""):
76 print "DBS Exception Error Code: ", ex.getErrorCode()
83 file1 = open(namefile ,
'w')
84 stringS =
"process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )\n" 85 stringS = stringS +
"readFiles = cms.untracked.vstring()\n" 86 stringS = stringS +
"secFiles = cms.untracked.vstring()\n" 87 stringS = stringS +
"\n" 92 for filename
in file_list:
95 stringS =
"readFiles.extend([\n" 100 stringS = stringS +
str(filename)
101 stringS = stringS +
"',\n" 103 filecount = filecount + 1
114 stringS =
"process.source = cms.Source(\"PoolSource\",\n" 115 stringS = stringS +
" fileNames = readFiles,\n" 116 stringS = stringS +
" secondaryFileNames = secFiles\n" 117 stringS = stringS +
")\n" 123 parser = OptionParser()
124 parser.add_option(
"-w",
"--workspace",
125 dest=
"workspaceName",
127 help=
"define workspace: GLOBAL TRACKER ")
129 parser.add_option(
"-r",
"--regexp",
132 default=
'groupName : LIKE %Collisions12% , runNumber : = 190000 ',
133 help=
" \"{runNumber} >= 148127 and {runNumber} < 148128 \" ")
135 parser.add_option(
"-d",
"--datasetPath",
137 default=
"/MinimumBias/Run2010A-TkAlMinBias-Dec22ReReco_v1/ALCARECO",
138 help=
"For example : --datasetPath /MinimumBias/Run2010A-TkAlMinBias-Dec22ReReco_v1/ALCARECO")
140 parser.add_option(
"-s",
"--site",
143 help=
"For example : site T2_CH_CAF")
145 parser.add_option(
"-i",
"--info",
149 help=
"printout the column names on which it's possible to cut")
151 (options, args) = parser.parse_args()
152 if len(sys.argv) == 1:
153 print(
"\nUsage: %s --help"%sys.argv[0])
162 server = xmlrpclib.ServerProxy(
'http://cms-service-runregistry-api.web.cern.ch/cms-service-runregistry-api/xmlrpc')
165 data = server.RunDatasetTable.export(workspaceName,
'xml_all' ,regexp)
172 for node
in nodelist:
173 if node.nodeType == node.TEXT_NODE:
178 return obj.getElementsByTagName(name)
187 server = xmlrpclib.ServerProxy(
'http://cms-service-runregistry-api.web.cern.ch/cms-service-runregistry-api/xmlrpc')
197 txtLongData+= txtrun + sep +
"\n" 200 if not (test
in lista):
203 file2=open(
"lista_key.txt",
'w')
204 for pkey
in range(len(lista)):
205 pwkey = lista[pkey] +
"\n" 208 print lineno(), lista[pkey]
212 for i
in range(len(lista)):
216 nameDBS=
str(i)+
".data" 220 nameLumi=
str(i)+
".lumi" 221 file1 = open( name ,
'w')
227 if (key == lista[i]):
228 print "running......", key
231 txtruns =
"{runNumber} >= " +
printObj(run,
'NUMBER') +
" and {runNumber} <= " +
str(
int(
printObj(run,
'NUMBER')))
232 txtriv = txtruns +
" and {cmpDcsBPix} = 1 and {cmpDcsFPix} = 1 and {cmpDcsTibTid} = 1 and {cmpDcsTob} = 1 and {cmpDcsTecM} = 1 and {cmpDcsTecP} = 1" 233 lumirun = server.RunLumiSectionRangeTable.export(
'GLOBAL',
'json',txtriv)
244 stringDBS = uno[
'LogicalFileName']
245 listaDBS += [stringDBS]
249 if (lumirun == comp):
256 string=
"sed -i 's/}{/, /g'" 258 string2= string +
" " + name
261 os.system(
"sed -i 's/\//_/g' lista_key.txt")
263 for rootLSF
in listaDBS:
264 if not (rootLSF
in listaDBS2):
265 listaDBS2.append(rootLSF)
274 return getData(doc,options,dataset,site)
277 items = regexp.split(
',')
280 key,value = item.split(
':')
281 dd[key.replace(
' ',
'')] = value
288 data=
extractData(options.workspaceName,options.regexp,options.dataset,options.site,options)
def getData(doc, options, dataset, site)
S & print(S &os, JobReport::InputFile const &f)
def makecff(file_list, namefile)
file cff data
def printLumi(file, namefile)
lumiCalc
def serverQuery(workspaceName, regexp)
def DBSquery(dataset, site, run)
file dbs
def extractData(mode, reg, dataset, site, options)
def getElement(obj, name)