for opt, arg in opts: if opt == "--DBSAddress": dbsinstance = arg if opt == "--datasetName": datasetName = arg if opt == "--help": print usage sys.exit(1) if dbsinstance == None: print "--DBSAddress option not provided. For example : --DBSAddress=MCLocal_4/Writer \n" print usage sys.exit(1) if datasetName == None: print "--datasetPath option not provided. For example : --datasetPath=/primarydataset/datatier/processeddataset \n" print usage sys.exit(1) # inargs = {'instance': dbsinstance} api = DbsCgiApi(DEFAULT_URL, inargs) nevttot = 0 for block in api.getDatasetContents(datasetName): for evc in block.get('eventCollectionList'): nevttot = nevttot + evc.get('numberOfEvents') print nevttot
print "" tiers = [ "Hit" ] print "Provenance for: %s (dataTiers: %s)" % (datasetPath, tiers) for parent in api.getDatasetProvenance(datasetPath, tiers): print " %s" % parent print "" tiers = [ "Digi", "Hit" ] print "Provenance for: %s (dataTiers: %s)" % (otherDatasetPath, tiers) for parent in api.getDatasetProvenance(otherDatasetPath, tiers): print " %s" % parent # Get dataset contents, returning a list of blocks with event collections print "" print "Dataset contents for: %s" % otherDatasetPath for block in api.getDatasetContents(otherDatasetPath): print " File block name/id: %s/%d, %d event collections}" % \ (block.getBlockName(), block.getObjectId(), len(block.getEventCollectionList())) # Get dataset contents as a list of blocks with files print "" # print "Dataset files for: %s" % datasets[0] # for block in api.getDatasetFileBlocks (datasets[0]): print "Dataset files for: %s" % datasetPath for block in api.getDatasetFileBlocks (datasetPath): print " File block name/id: %s/%d, %d files}" % \ (block.getBlockName(), block.getObjectId(), len(block.getFileList())) except InvalidDataTier, ex: print "Caught InvalidDataTier API exception: %s" % (ex.getErrorMessage()) except DbsApiException, ex:
for opt, arg in opts: if opt == "--DBSAddress": dbsinstance = arg if opt == "--datasetName": datasetName = arg if opt == "--help": print usage sys.exit(1) if dbsinstance == None: print "--DBSAddress option not provided. For example : --DBSAddress=MCLocal_4/Writer \n" print usage sys.exit(1) if datasetName == None: print "--datasetPath option not provided. For example : --datasetPath=/primarydataset/datatier/processeddataset \n" print usage sys.exit(1) # inargs = {'instance' : dbsinstance} api = DbsCgiApi(DEFAULT_URL, inargs) nevttot=0 for block in api.getDatasetContents(datasetName): for evc in block.get('eventCollectionList'): nevttot = nevttot + evc.get('numberOfEvents') print nevttot