class DBS2Reader: """ _DBSReader_ General API for reading data from DBS """ def __init__(self, url, **contact): args = {"url": url, "level": 'ERROR', "version": ''} args.update(contact) #try: self.dbs = DbsApi(args) #except DbsException, ex: # msg = "Error in DBSReader with DbsApi\n" # msg += "%s\n" % formatEx(ex) # raise DBSReaderError(msg) # setup DLS api - with either dbs or phedex depending on dbs instance if url.count('cmsdbsprod.cern.ch/cms_dbs_prod_global') or \ self.dbs.getServerInfo()['InstanceName'] == 'GLOBAL': dlsType = 'DLS_TYPE_PHEDEX' dlsUrl = 'https://cmsweb.cern.ch/phedex/datasvc/xml/prod' else: dlsType = 'DLS_TYPE_DBS' dlsUrl = url try: self.dls = dlsClient.getDlsApi(dls_type=dlsType, dls_endpoint=dlsUrl, version=args['version']) except DlsApiError, ex: msg = "Error in DBSReader with DlsApi\n" msg += "%s\n" % str(ex) raise DBSReaderError(msg) except DbsException, ex: msg = "Error in DBSReader with DbsApi\n" msg += "%s\n" % formatEx(ex) raise DBSReaderError(msg)
class DBSReader: """ _DBSReader_ General API for reading data from DBS """ def __init__(self, url, **contact): args = { "url" : url, "level" : 'ERROR', "version" : ''} args.update(contact) #try: self.dbs = DbsApi(args) #except DbsException, ex: # msg = "Error in DBSReader with DbsApi\n" # msg += "%s\n" % formatEx(ex) # raise DBSReaderError(msg) # setup DLS api - with either dbs or phedex depending on dbs instance if url.count('cmsdbsprod.cern.ch/cms_dbs_prod_global') or \ self.dbs.getServerInfo()['InstanceName'] == 'GLOBAL': dlsType = 'DLS_TYPE_PHEDEX' dlsUrl = 'https://cmsweb.cern.ch/phedex/datasvc/xml/prod' else: dlsType = 'DLS_TYPE_DBS' dlsUrl = url try: self.dls = dlsClient.getDlsApi(dls_type = dlsType, dls_endpoint = dlsUrl, version = args['version']) except DlsApiError, ex: msg = "Error in DBSReader with DlsApi\n" msg += "%s\n" % str(ex) raise DBSReaderError(msg) except DbsException, ex: msg = "Error in DBSReader with DbsApi\n" msg += "%s\n" % formatEx(ex) raise DBSReaderError(msg)
from DBSAPI.dbsQueryableParameterSet import DbsQueryableParameterSet from DBSAPI.dbsPrimaryDataset import DbsPrimaryDataset from DBSAPI.dbsProcessedDataset import DbsProcessedDataset from DBSAPI.dbsDQFlag import DbsDQFlag from DBSAPI.dbsRunLumiDQ import DbsRunLumiDQ from DBSAPI.dbsFileProcessingQuality import DbsFileProcessingQuality from DBSAPI.dbsOptions import DbsOptionParser from DBSAPI.dbsUtil import * optManager = DbsOptionParser() (opts,args) = optManager.getOpt() api = DbsApi(opts.__dict__) serverInfo = api.getServerInfo() isMYSQL = serverInfo['InstanceType'] isGlobal = serverInfo['InstanceName'] def genRandom(): return os.popen('uuidgen').readline().strip() ran = genRandom() primName = 'test_Primary_' + ran primType = 'test' algoExe1 = 'test_Exe1_' + ran algoVer1 = 'test_Ver1_' + ran algoFam1 = 'test_Fam1_' + ran psHash1 = 'test_Hash1_' + ran psName1 = 'test_Pname1_' + ran
from DBSAPI.dbsFileBlock import DbsFileBlock from DBSAPI.dbsRun import DbsRun from DBSAPI.dbsFile import DbsFile from DBSAPI.dbsAnalysisDatasetDefinition import DbsAnalysisDatasetDefinition from DBSAPI.dbsAnalysisDataset import DbsAnalysisDataset from DBSAPI.dbsLumiSection import DbsLumiSection from DBSAPI.dbsFileProcessingQuality import DbsFileProcessingQuality from DBSAPI.dbsOptions import DbsOptionParser from DBSAPI.dbsUtil import * from dbsUnitTestApi import DbsUnitTestApi optManager = DbsOptionParser() (opts,args) = optManager.getOpt() api = DbsApi(opts.__dict__) serverInfo = api.getServerInfo() isMYSQL = serverInfo['InstanceType'] isGlobal = serverInfo['InstanceName'] #mytime = str(time.time()) mytime = time.strftime("_%Y%m%d_%Hh%Mm%Ss",time.localtime()) f = open("result.txt", "a+") apiObj = DbsUnitTestApi(api.insertPrimaryDataset, f) apiObj.setVerboseLevel(opts.verbose) f.write("\n\n***********************insertPrimaryDataset API tests***************************") primary = 'TestPrimary_001' + mytime pri1 = DbsPrimaryDataset (Name = primary, Type="test")
from DBSAPI.dbsFile import DbsFile from DBSAPI.dbsLumiSection import DbsLumiSection from DBSAPI.dbsQueryableParameterSet import DbsQueryableParameterSet from DBSAPI.dbsPrimaryDataset import DbsPrimaryDataset from DBSAPI.dbsProcessedDataset import DbsProcessedDataset from DBSAPI.dbsDQFlag import DbsDQFlag from DBSAPI.dbsRunLumiDQ import DbsRunLumiDQ from DBSAPI.dbsOptions import DbsOptionParser optManager = DbsOptionParser() (opts,args) = optManager.getOpt() api = DbsApi(opts.__dict__) isGlobal = api.getServerInfo()['InstanceName'] def genRandom(): return os.popen('uuidgen').readline().strip() ran = genRandom() primName = 'test_Primary_' + ran primType = 'test' algoExe1 = 'test_Exe1_' + ran algoVer1 = 'test_Ver1_' + ran algoFam1 = 'test_Fam1_' + ran psHash1 = 'test_Hash1_' + ran psName1 = 'test_Pname1_' + ran psVer1 = 'test_Pver1_' + ran psType1 = 'test_Ptype1_' + ran psAnno1 = 'test_Panno1_' + ran
from DBSAPI.dbsRun import DbsRun from DBSAPI.dbsFile import DbsFile from DBSAPI.dbsLumiSection import DbsLumiSection from DBSAPI.dbsQueryableParameterSet import DbsQueryableParameterSet from DBSAPI.dbsPrimaryDataset import DbsPrimaryDataset from DBSAPI.dbsProcessedDataset import DbsProcessedDataset from DBSAPI.dbsDQFlag import DbsDQFlag from DBSAPI.dbsRunLumiDQ import DbsRunLumiDQ from DBSAPI.dbsOptions import DbsOptionParser optManager = DbsOptionParser() (opts, args) = optManager.getOpt() api = DbsApi(opts.__dict__) isGlobal = api.getServerInfo()['InstanceName'] def genRandom(): return os.popen('uuidgen').readline().strip() ran = genRandom() primName = 'test_Primary_' + ran primType = 'test' algoExe1 = 'test_Exe1_' + ran algoVer1 = 'test_Ver1_' + ran algoFam1 = 'test_Fam1_' + ran psHash1 = 'test_Hash1_' + ran psName1 = 'test_Pname1_' + ran