def test06(self): """DBSDataset.listDatasets""" from dbs.business.DBSDataset import DBSDataset bo = DBSDataset(self.logger, self.dbi) bo.listDatasets() bo.listDatasets("a") bo.listDatasets("a", "%b") bo.listDatasets("a", "b", "c%") bo.listDatasets(primdsname="a", datatiername="c", procdsname="vax")
def test02(self): """business.DBSDataset.listDatasetParents: Basic""" dburl = os.environ["DBS_TEST_DBURL_READER"] dbowner = os.environ["DBS_TEST_DBOWNER_READER"] dbi = DBFactory(self.logger, dburl).connect() bo = DBSDataset(self.logger, dbi, dbowner) result = bo.listDatasetParents(dataset='%') self.assertTrue(type(result) == list) self.assertEqual(len(result), 0)
def __init__(self, config, dbi=None): """ All parameters are provided through DBSConfig module """ config.__dict__['default_expires'] = config.dbs.default_expires RESTModel.__init__(self, config) dbowner = config.database.dbowner if dbi: self.dbi = dbi self.logger = logger self.dbsDataset = DBSDataset(self.logger, self.dbi, dbowner) self.dbsFile = DBSFile(self.logger, self.dbi, dbowner) self.dbsBlock = DBSBlock(self.logger, self.dbi, dbowner)
def test03(self): """business.DBSDataset.listDatasets: with parent_dataset, release_version, pset_hash, app_name, output_module_label""" dburl = os.environ["DBS_TEST_DBURL_READER"] dbowner = os.environ["DBS_TEST_DBOWNER_READER"] dbi = DBFactory(self.logger, dburl).connect() bo = DBSDataset(self.logger, dbi, dbowner) bo.listDatasets() bo.listDatasets(dataset='%') bo.listDatasets(dataset='%', release_version='%') bo.listDatasets(pset_hash='%') bo.listDatasets(app_name='%') bo.listDatasets(output_module_label='%') result = bo.listDatasets("ThisDoesNotExist") self.assertTrue(type(result) == list) self.assertEqual(len(result), 0)
def test02(self): """DBSDataset.insertDataset""" from dbs.business.DBSDataset import DBSDataset bo = DBSDataset(self.logger, self.dbi) binput = { "dataset": "/BUT_%s/BUT_PROCESSED_DATASET_V%s/GEN-SIM-RECO" % (IC, IC), "isdatasetvalid": True, "primaryds": "BUT_%s" % IC, "processedds": "BUT_PROCESSED_DATASET_V%s" % IC, "datatier": "GEN-SIM-RECO", "datasettype": "PRODUCTION", "acquisitionera": "TEST", "processingversion": "TEST", "physicsgroup": "Individual", "xtcrosssection": 999., "globaltag": "DaoTESTGlobalTag", "creationdate": 1234, "createby": "me", "lastmodificationdate": 1235, "lastmodifiedby": "alsome" } bo.insertDataset(binput)
def testDatasetInsert(self): """ This method is being used for testing datasets's insert DAO """ bo = DBSDataset(self.logger, self.dbi, self.owner) binput = { 'is_dataset_valid': 1, 'primary_ds_name': 'TkCosmics38T', 'physics_group_name': 'Tracker', 'global_tag': 'STARTUP31X_V3::All', 'processed_ds_name': 'Summer09-STARTUP31X_V3-v2', 'dataset': '/TkCosmics38T/Summer09-STARTUP31X_V3-v2/GEN-SIM-DIGI-RAW', 'dataset_type': 'PRODUCTION', 'xtcrosssection': 123, 'data_tier_name': 'GEN-SIM-DIGI-RAW', 'creation_date': 1234, 'create_by': '__MYSQL__', "last_modification_date": 1234, "last_modified_by": "anzar", 'output_configs': [{ 'app_name': 'Repacker', 'release_version': 'CMSSW_2_1_7', 'pset_hash': 'NO_PSET_HASH' }] } binput = { 'is_dataset_valid': 1, 'physics_group_name': 'Tracker', 'dataset': u'/QCD_BCtoMu_Pt20/Summer08_IDEAL_V9_v1/GEN-SIM-RAW', 'dataset_type': 'PRODUCTION', 'processed_ds_name': u'Summer08_IDEAL_V9_v1', 'primary_ds_name': u'QCD_BCtoMu_Pt20', 'output_configs': [{ 'release_version': u'CMSSW_2_1_7', 'pset_hash': u'NO_PSET_HASH', 'app_name': u'cmsRun', 'output_module_label': u'Merged' }, { 'release_version': u'CMSSW_2_1_7', 'pset_hash': u'76e303993a1c2f842159dbfeeed9a0dd', 'app_name': u'cmsRun', 'output_module_label': u'output' }], 'global_tag': u'', 'xtcrosssection': 123, 'primary_ds_type': 'test', 'data_tier_name': 'GEN-SIM-RAW', 'creation_date': 1234, 'create_by': 'anzar', "last_modification_date": 1234, "last_modified_by": "anzar", #'processing_version': '1', 'acquisition_era_name': u'', } binput = { 'is_dataset_valid': 1, 'physics_group_name': 'Tracker', 'dataset': u'/TkCosmics38T/Summer09-STARTUP31X_V3-v1/GEN-SIM-DIGI-RAW', 'dataset_type': 'PRODUCTION', 'processed_ds_name': u'Summer09-STARTUP31X_V3-v1', 'primary_ds_name': u'TkCosmics38T', 'data_tier_name': 'GEN-SIM-DIGI-RAW', 'global_tag': u'STARTUP31X_V3::All', 'xtcrosssection': 123, 'primary_ds_type': 'test', 'output_configs': [{ 'release_version': u'CMSSW_3_1_2', 'pset_hash': u'4847ed25a7e108a7b1e704a26f345aa8', 'app_name': u'cmsRun', 'output_module_label': u'Merged' }, { 'release_version': u'CMSSW_3_1_2', 'pset_hash': u'NO_PSET_HASH', 'app_name': u'cmsRun', 'output_module_label': u'Merged' }, { 'release_version': u'CMSSW_3_1_2', 'pset_hash': u'4847ed25a7e108a7b1e704a26f345aa8', 'app_name': u'cmsRun', 'output_module_label': u'output' }], 'creation_date': 1234, 'create_by': 'anzar', "last_modification_date": 1234, "last_modified_by": "anzar", } bo.insertDataset(binput)