""" try: # List some datasets print "" print "Listing datasets %s" % datasetPattern datasets = api.listProcessedDatasets (datasetPattern) for dataset in datasets: print " %s" % dataset except DbsCgiDatabaseError,e: print e """ mydataset = "/CSA06-083-os-Wenu/SIM/CMSSW_0_8_3-GEN-SIM-DIGI-HLT-1156877644-merged" try: # List some datasets print len(api.getDatasetFileBlocks(mydataset)) #for block in api.getDatasetFileBlocks(mydataset): # print " %s" % block except DbsCgiDatabaseError,e: print e otherDatasetPath = "/PreProdR2Pion10GeV/SIM/GEN-SIM-DIGI" otherDatasetPath = "/CSA06-081-os-minbias/DIGI/CMSSW_0_8_1-GEN-SIM-DIGI-1154005302-merged" otherDatasetPath = "/CSA06-082-os-TTbar/SIM/CMSSW_0_8_2-GEN-SIM-DIGI-1155826011-merged" except InvalidDataTier, ex: print "Caught InvalidDataTier API exception: %s" % (ex.getErrorMessage()) except DbsApiException, ex: print "Caught API exception %s: %s" % (ex.getClassName(), ex.getErrorMessage()) except DbsException, ex:
if not aline.startswith('/'): continue # A non datasetPath line dbs1dbs2paths = aline.split() dbs1Path=dbs1dbs2paths[0] dbs2Path=dbs1dbs2paths[1] out.write("\n*****Starting processing Pair DBS1:%s and DBS2:%s*******" %(dbs1Path, dbs2Path)) try: dbs1FileList=[] dbs2FileList=[] dbs1LFNList=[] dbs2LFNList=[] error_flag = 0 out.write( "\nRetrieving files for DBS1 dataset..%s"% dbs1Path) for block in dbs1Api.getDatasetFileBlocks (dbs1Path): fileList=block.get('fileList') dbs1FileList.extend(fileList) out.write("\nTotal files retrieved for DBS1 datasetPath: %s is:%s" %(dbs1Path, str(len(dbs1FileList)))) if len(dbs1FileList) < 1: err.write( "\n*******ERROR dataset in DBS1: %s has no files*************" %dbs1Path) else: for dbs1file in dbs1FileList: out.write("\n"+ dbs1file['logicalFileName']) dbs1LFNList.append(dbs1file['logicalFileName']) out.write( "\n--------------------------------------------------------------------------" ) out.write( "\nRetrieving files for DBS2 dataset..%s"% dbs2Path ) dbs2FileList=api.listFiles(path=dbs2Path)
""" try: # List some datasets print "" print "Listing datasets %s" % datasetPattern datasets = api.listProcessedDatasets (datasetPattern) for dataset in datasets: print " %s" % dataset except DbsCgiDatabaseError,e: print e """ mydataset = "/CSA06-083-os-Wenu/SIM/CMSSW_0_8_3-GEN-SIM-DIGI-HLT-1156877644-merged" try: # List some datasets print len(api.getDatasetFileBlocks(mydataset)) #for block in api.getDatasetFileBlocks(mydataset): # print " %s" % block except DbsCgiDatabaseError, e: print e otherDatasetPath = "/PreProdR2Pion10GeV/SIM/GEN-SIM-DIGI" otherDatasetPath = "/CSA06-081-os-minbias/DIGI/CMSSW_0_8_1-GEN-SIM-DIGI-1154005302-merged" otherDatasetPath = "/CSA06-082-os-TTbar/SIM/CMSSW_0_8_2-GEN-SIM-DIGI-1155826011-merged" except InvalidDataTier, ex: print "Caught InvalidDataTier API exception: %s" % (ex.getErrorMessage()) except DbsApiException, ex: print "Caught API exception %s: %s" % (ex.getClassName(), ex.getErrorMessage()) except DbsException, ex:
continue # A non datasetPath line dbs1dbs2paths = aline.split() dbs1Path = dbs1dbs2paths[0] dbs2Path = dbs1dbs2paths[1] out.write("\n*****Starting processing Pair DBS1:%s and DBS2:%s*******" % (dbs1Path, dbs2Path)) try: dbs1FileList = [] dbs2FileList = [] dbs1LFNList = [] dbs2LFNList = [] error_flag = 0 out.write("\nRetrieving files for DBS1 dataset..%s" % dbs1Path) for block in dbs1Api.getDatasetFileBlocks(dbs1Path): fileList = block.get("fileList") dbs1FileList.extend(fileList) out.write("\nTotal files retrieved for DBS1 datasetPath: %s is:%s" % (dbs1Path, str(len(dbs1FileList)))) if len(dbs1FileList) < 1: err.write("\n*******ERROR dataset in DBS1: %s has no files*************" % dbs1Path) else: for dbs1file in dbs1FileList: out.write("\n" + dbs1file["logicalFileName"]) dbs1LFNList.append(dbs1file["logicalFileName"]) out.write("\n--------------------------------------------------------------------------") out.write("\nRetrieving files for DBS2 dataset..%s" % dbs2Path) dbs2FileList = api.listFiles(path=dbs2Path)