def testInsertAllSEs2(self): """ _testInsertAllSEs2_ Test to see if we can insert all SEs and Thresholds at once Depending on the WMCore.Services.SiteDB interface """ myResourceControl = ResourceControl() taskList = [{'taskType': 'Processing', 'maxSlots': 100, 'pendingSlots': 80}, {'taskType': 'Merge', 'maxSlots': 50, 'pendingSlots': 30}] myResourceControl.insertAllSEs(siteName='test', pendingSlots=200, runningSlots=400, ceName='glidein-ce.fnal.gov', plugin='CondorPlugin', taskList=taskList) result = myResourceControl.listThresholdsForSubmit() self.assertTrue('test_T1_US_FNAL_Buffer' in result.keys()) self.assertGreaterEqual(len(result), 1) for siteName in result.iterkeys(): self.assertEqual(len(result[siteName]['thresholds']), 2) self.assertEqual(result[siteName]['total_pending_slots'], 200) self.assertEqual(result[siteName]['total_running_slots'], 400) for taskType, thresh in result[siteName]['thresholds'].iteritems(): if taskType == 'Processing': self.assertEqual(thresh['priority'], 0) self.assertEqual(thresh['max_slots'], 100) self.assertEqual(thresh['pending_slots'], 80) else: self.assertEqual(thresh['priority'], 5) self.assertEqual(thresh['max_slots'], 50) self.assertEqual(thresh['pending_slots'], 30) return
def testInsertAllSEs2(self): """ _testInsertAllSEs2_ Test to see if we can insert all SEs and Thresholds at once Depending on the WMCore.Services.SiteDB interface """ myResourceControl = ResourceControl() taskList = [{'taskType': 'Processing', 'maxSlots': 100, 'pendingSlots' : 80}, {'taskType': 'Merge', 'maxSlots': 50, 'pendingSlots' : 30}] myResourceControl.insertAllSEs(siteName = 'test', pendingSlots = 200, runningSlots = 400, ceName = 'glidein-ce.fnal.gov', plugin = 'CondorPlugin', taskList = taskList) result = myResourceControl.listThresholdsForSubmit() self.assertTrue('test_cmssrm.fnal.gov' in result.keys()) self.assertEqual(result['test_cmssrm.fnal.gov']['cms_name'], 'T1_US_FNAL') for x in result.keys(): self.assertEqual(len(result[x]['thresholds']), 2) self.assertEqual(result[x]['total_pending_slots'], 200) self.assertEqual(result[x]['total_running_slots'], 400) for thresh in result[x]['thresholds']: if thresh['task_type'] == 'Processing': self.assertEqual(thresh['priority'], 0) self.assertEqual(thresh['max_slots'], 100) self.assertEqual(thresh['pending_slots'], 80) else: self.assertEqual(thresh['priority'], 5) self.assertEqual(thresh['max_slots'], 50) self.assertEqual(thresh['pending_slots'], 30) return
def testInsertAllSEs2(self): """ _testInsertAllSEs2_ Test to see if we can insert all SEs and Thresholds at once Depending on the WMCore.Services.SiteDB interface """ myResourceControl = ResourceControl() taskList = [ {"taskType": "Processing", "maxSlots": 100, "priority": 1}, {"taskType": "Merge", "maxSlots": 50, "priority": 2}, ] myResourceControl.insertAllSEs( siteName="test", jobSlots=200, ceName="glidein-ce.fnal.gov", plugin="CondorPlugin", taskList=taskList ) result = myResourceControl.listThresholdsForSubmit() self.assertTrue("test_cmssrm.fnal.gov" in result.keys()) self.assertEqual(result["test_cmssrm.fnal.gov"][0]["cms_name"], "T1_US_FNAL") for x in result.keys(): self.assertEqual(len(result[x]), 2) for thresh in result[x]: if thresh["task_type"] == "Processing": self.assertEqual(thresh["priority"], 1) self.assertEqual(thresh["max_slots"], 100) self.assertEqual(thresh["total_slots"], 200) else: self.assertEqual(thresh["priority"], 2) self.assertEqual(thresh["max_slots"], 50) self.assertEqual(thresh["total_slots"], 200) return