示例#1
0
class DBSInfo_EDM:
     def __init__(self):
         """
         Construct api object.
         """
         ## cgi service API
         DEFAULT_URL = "http://cmsdoc.cern.ch/cms/aprom/DBS/CGIServer/prodquery"
         args = {}
         args['instance']="Dev/fanfani"

         self.api = DbsCgiApi(DEFAULT_URL, args)
         ## set log level
         # self.api.setLogLevel(dbsApi.DBS_LOG_LEVEL_INFO_)
         #self.api.setLogLevel(dbsApi.DBS_LOG_LEVEL_QUIET_)

     def getMatchingDatasets (self, datasetPath):
         """ Query DBS to get provenance """
         try:
           list = self.api.listProcessedDatasets("%s" %datasetPath)
         except dbsApi.InvalidDataTier, ex:
           raise DBSInvalidDataTierError(ex.getClassName(),ex.getErrorMessage())
         except dbsApi.DbsApiException, ex:
           raise DBSError(ex.getClassName(),ex.getErrorMessage())
示例#2
0
        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 datasetPath == None:
    print "--datasetPath option not provided. For example : --datasetPath=/primarydataset/datatier/processeddataset \n"
    print usage
    sys.exit(1)

if logfile == None:
    print "--logfile option not provided. For example : --logfile=logs_TOB/proddatasetlist.txt \n"
    print usage
    sys.exit(1)

f = open(logfile, "w")

inargs = {'instance': dbsinstance}
api = DbsCgiApi(DEFAULT_URL, inargs)

datasets = api.listProcessedDatasets(datasetPath)

for dataset in datasets:

    f.write("DatasetName: %s \n" % (dataset))
#
f.close()
示例#3
0
  try:
   # List all primary datasets
   print ""
   print "Listing primary datasets t*"
   for p in api.listPrimaryDatasets("*"):
     print "  %s" % p
  except DbsCgiDatabaseError,e:
   print e
  # Datasets we play with
  datasetPattern = "/*/*/*"
  
  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

  """
  try:
   # Get dataset provenance. It returns list of dataset parents.
   print ""
   tiers = [ "Hit" ]
   datasetPath = datasets[1]
   print "Provenance for: %s (dataTiers: %s)" % (datasetPath, tiers)
   for parent in api.getDatasetProvenance(datasetPath, tiers):
     print "  %s" % parent
  except DbsCgiDatabaseError,e: