CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
edmModuleAllocMonitorAnalyze.TestModuleCommand Class Reference
Inheritance diagram for edmModuleAllocMonitorAnalyze.TestModuleCommand:

Public Member Functions

def setUp (self)
 
def testContainers (self)
 
def testFullVisualization (self)
 
def testJson (self)
 
def testJsonTemporal (self)
 
def testModuleCentricVisualization (self)
 
def testSortBy (self)
 
def testSyncValues (self)
 

Public Attributes

 tracerFile
 

Detailed Description

Definition at line 1308 of file edmModuleAllocMonitorAnalyze.py.

Member Function Documentation

◆ setUp()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.setUp (   self)

Definition at line 1309 of file edmModuleAllocMonitorAnalyze.py.

1309  def setUp(self):
1310  self.tracerFile = DummyFile()
1311  t = [0]
1312  def incr(t):
1313  t[0] += 1
1314  return t[0]
1315 
1316  self.tracerFile.extend([
1317  '#R 1 Record',
1318  '#M 1 Module',
1319  '#N 1 ESModule',
1320  f'F {Phase.startTracing} 0 0 0 0 {incr(t)}',
1321  f'S {Phase.construction} 0 {incr(t)}',
1322  f's {Phase.construction} 0 {incr(t)} 1 1 10 0 10 10',
1323  f'M {Phase.construction} 0 1 0 {incr(t)}',
1324  f'm {Phase.construction} 0 1 0 {incr(t)} 3 2 20 0 50 25',
1325  f'F {Phase.beginJob} 0 0 0 0 {incr(t)}',
1326  f'M {Phase.beginJob} 0 1 0 {incr(t)}',
1327  f'm {Phase.beginJob} 0 1 0 {incr(t)} 3 2 20 0 50 25',
1328  f'f {Phase.beginJob} 0 0 0 0 {incr(t)}',
1329  f'F {Phase.beginProcessBlock} 0 0 0 0 {incr(t)}',
1330  f'f {Phase.beginProcessBlock} 0 0 0 0 {incr(t)}',
1331  f'S {Phase.getNextTransition} {incr(t)}',
1332  f's {Phase.getNextTransition} {incr(t)} 1 1 10 0 10 10',
1333  f'S {Phase.globalBeginRun} 0 {incr(t)}',
1334  f's {Phase.globalBeginRun} 0 {incr(t)} 1 1 10 0 10 10',
1335  f'S {Phase.getNextTransition} {incr(t)}',
1336  f's {Phase.getNextTransition} {incr(t)} 1 1 10 0 10 10',
1337  f'F {Phase.globalBeginRun} 0 1 0 0 {incr(t)}',
1338  f'M {Phase.globalBeginRun} 0 1 0 {incr(t)}',
1339  f'm {Phase.globalBeginRun} 0 1 0 {incr(t)} 3 2 20 0 50 25',
1340  f'f {Phase.globalBeginRun} 0 1 0 0 {incr(t)}',
1341  f'S {Phase.getNextTransition} {incr(t)}',
1342  f's {Phase.getNextTransition} {incr(t)} 1 1 10 0 10 10',
1343  f'F {Phase.streamBeginRun} 0 1 0 0 {incr(t)}',
1344  f'M {Phase.streamBeginRun} 0 1 0 {incr(t)}',
1345  f'm {Phase.streamBeginRun} 0 1 0 {incr(t)} 3 2 20 0 50 25',
1346  f'f {Phase.streamBeginRun} 0 1 0 0 {incr(t)}',
1347  f'F {Phase.streamBeginRun} 1 1 0 0 {incr(t)}',
1348  f'M {Phase.streamBeginRun} 1 1 0 {incr(t)}',
1349  f'm {Phase.streamBeginRun} 1 1 0 {incr(t)} 3 2 20 0 50 25',
1350  f'f {Phase.streamBeginRun} 1 1 0 0 {incr(t)}',
1351  f'S {Phase.globalBeginLumi} 0 {incr(t)}',
1352  f's {Phase.globalBeginLumi} 0 {incr(t)} 1 1 10 0 10 10',
1353  f'S {Phase.getNextTransition} {incr(t)}',
1354  f's {Phase.getNextTransition} {incr(t)} 1 1 10 0 10 10',
1355  f'F {Phase.globalBeginLumi} 0 1 1 0 {incr(t)}',
1356  f'M {Phase.globalBeginLumi} 0 1 0 {incr(t)}',
1357  f'm {Phase.globalBeginLumi} 0 1 0 {incr(t)} 3 2 20 0 50 25',
1358  f'f {Phase.globalBeginLumi} 0 1 1 0 {incr(t)}',
1359  f'F {Phase.streamBeginLumi} 0 1 1 0 {incr(t)}',
1360  f'f {Phase.streamBeginLumi} 0 1 1 0 {incr(t)}',
1361  f'F {Phase.streamBeginLumi} 1 1 1 0 {incr(t)}',
1362  f'f {Phase.streamBeginLumi} 1 1 1 0 {incr(t)}',
1363  f'S {Phase.Event} 0 {incr(t)}',
1364  f's {Phase.Event} 0 {incr(t)} 1 1 10 0 10 10',
1365  f'S {Phase.getNextTransition} {incr(t)}',
1366  f's {Phase.getNextTransition} {incr(t)} 1 1 10 0 10 10',
1367  f'F {Phase.Event} 0 1 1 1 {incr(t)}',
1368  f'S {Phase.Event} 1 {incr(t)}',
1369  f's {Phase.Event} 1 {incr(t)} 1 1 10 0 10 10',
1370  f'F {Phase.Event} 1 1 1 2 {incr(t)}',
1371  f'N {Phase.Event} 0 1 1 0 {incr(t)}',
1372  f'n {Phase.Event} 0 1 1 0 {incr(t)} 6 5 30 0 100 80',
1373  f'M {Phase.Event} 0 1 0 {incr(t)}',
1374  f'M {Phase.Event} 1 1 0 {incr(t)}',
1375  f'm {Phase.Event} 1 1 0 {incr(t)} 3 2 20 0 50 25',
1376  f'm {Phase.Event} 0 1 0 {incr(t)} 3 2 20 0 50 25',
1377  f'f {Phase.Event} 0 1 1 1 {incr(t)}',
1378  f'f {Phase.Event} 1 1 1 2 {incr(t)}'])
1379 
1380  None

◆ testContainers()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.testContainers (   self)

Definition at line 1389 of file edmModuleAllocMonitorAnalyze.py.

1389  def testContainers(self):
1390  c = VisualizationContainers()
1391  c.indexedGlobal(2)
1392  self.assertEqual(len(c.allGlobals()), 3)
1393  c.indexedStream(2)
1394  self.assertEqual(len(c.allStreams()), 3)
1395  slot = c.findOpenSlotInModGlobals(2, 1)
1396  self.assertEqual(len(c._modGlobals),3)
1397  self.assertEqual(len(slot),0)
1398  slot.append({"start":1, "finish":0, "id":1})
1399  def testFind(item):
1400  return item["id"]==1
1401  item,s = c.findLastInModGlobals(2, 1, testFind)
1402  self.assertEqual(item["id"],1)
1403  self.assertEqual(slot,s)
1404  slot = c.findOpenSlotInModStreams(2, 1)
1405  self.assertEqual(len(c._modStreams),3)
1406  self.assertEqual(len(slot),0)
1407  slot.append({"start":1, "finish":0, "id":1})
1408  item,s = c.findLastInModStreams(2, 1, testFind)
1409  self.assertEqual(item["id"],1)
1410  self.assertEqual(slot,s)

◆ testFullVisualization()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.testFullVisualization (   self)

Definition at line 1430 of file edmModuleAllocMonitorAnalyze.py.

References edmModuleAllocMonitorAnalyze.jsonVisualizationInfo(), edmTracerCompactLogViewer.TestModuleCommand.tracerFile, and edmModuleAllocMonitorAnalyze.TestModuleCommand.tracerFile.

1430  def testFullVisualization(self):
1431  parser = ModuleAllocCompactFileParser(self.tracerFile, False)
1432  j = jsonVisualizationInfo(parser)
1433  #print(j)
1434  self.assertEqual(len(j["modules"]), 2)
1435  self.assertEqual(len(j["esModules"]), 2)
1436  self.assertEqual(len(j['transitions']), 3)
1437  self.assertEqual(j['transitions'][0]['name'], "Global")
1438  self.assertEqual(j['transitions'][1]['name'], "Stream 0")
1439  self.assertEqual(j['transitions'][2]['name'], "Stream 1")
1440  self.assertEqual(len(j["transitions"][0]["slots"]), 2)
1441  self.assertEqual(len(j["transitions"][0]["slots"][0]), 11)
1442  self.assertEqual(len(j["transitions"][0]["slots"][1]), 4)
1443  self.assertEqual(len(j["transitions"][1]["slots"]), 2)
1444  self.assertEqual(len(j["transitions"][1]["slots"][0]), 5)
1445  self.assertEqual(len(j["transitions"][1]["slots"][1]), 3)
1446  self.assertEqual(len(j["transitions"][2]["slots"]), 2)
1447  self.assertEqual(len(j["transitions"][2]["slots"][0]), 5)
1448  self.assertEqual(len(j["transitions"][2]["slots"][1]), 2)

◆ testJson()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.testJson (   self)

Definition at line 1411 of file edmModuleAllocMonitorAnalyze.py.

References edmModuleAllocMonitorAnalyze.jsonInfo(), edmTracerCompactLogViewer.TestModuleCommand.tracerFile, and edmModuleAllocMonitorAnalyze.TestModuleCommand.tracerFile.

1411  def testJson(self):
1412  parser = ModuleAllocCompactFileParser(self.tracerFile, False)
1413  j = jsonInfo(parser, False)
1414  self.assertEqual(len(j.data()),3)
1415  self.assertEqual(len(j.data()["source"]), 10)
1416  self.assertEqual(len(j.data()["Module"]), 8)
1417  self.assertEqual(len(j.data()["ESModule"]), 1)

◆ testJsonTemporal()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.testJsonTemporal (   self)

Definition at line 1418 of file edmModuleAllocMonitorAnalyze.py.

References edmModuleAllocMonitorAnalyze.jsonInfo(), edmTracerCompactLogViewer.TestModuleCommand.tracerFile, and edmModuleAllocMonitorAnalyze.TestModuleCommand.tracerFile.

1418  def testJsonTemporal(self):
1419  parser = ModuleAllocCompactFileParser(self.tracerFile, True)
1420  j = jsonInfo(parser, True)
1421  self.assertEqual(len(j.data()),19)

◆ testModuleCentricVisualization()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.testModuleCentricVisualization (   self)

Definition at line 1449 of file edmModuleAllocMonitorAnalyze.py.

References edmModuleAllocMonitorAnalyze.jsonVisualizationInfo(), edmTracerCompactLogViewer.TestModuleCommand.tracerFile, and edmModuleAllocMonitorAnalyze.TestModuleCommand.tracerFile.

1449  def testModuleCentricVisualization(self):
1450  parser = ModuleAllocCompactFileParser(self.tracerFile, True)
1451  j = jsonVisualizationInfo(parser)
1452  #print(j)
1453  self.assertEqual(len(j["modules"]), 2)
1454  self.assertEqual(len(j["esModules"]), 2)
1455  self.assertEqual(len(j['transitions']), 6)
1456  self.assertEqual(j['transitions'][0]['name'], "Global")
1457  self.assertEqual(j['transitions'][1]['name'], "Stream 0")
1458  self.assertEqual(j['transitions'][2]['name'], "Stream 1")
1459  self.assertEqual(j['transitions'][3]['name'], "source")
1460  self.assertEqual(j['transitions'][4]['name'], "Module")
1461  self.assertEqual(j['transitions'][5]['name'], "ESModule")
1462  self.assertEqual(len(j["transitions"][0]["slots"]), 1)
1463  self.assertEqual(len(j["transitions"][0]["slots"][0]), 11)
1464  self.assertEqual(len(j["transitions"][1]["slots"]), 1)
1465  self.assertEqual(len(j["transitions"][1]["slots"][0]), 5)
1466  self.assertEqual(len(j["transitions"][2]["slots"]), 1)
1467  self.assertEqual(len(j["transitions"][2]["slots"][0]), 5)
1468  self.assertEqual(len(j["transitions"][4]["slots"]), 2)
1469  self.assertEqual(len(j["transitions"][4]["slots"][0]), 7)
1470  self.assertEqual(len(j["transitions"][4]["slots"][1]), 1)
1471  self.assertTrue(j["transitions"][4]["slots"][1][-1]['finish'] != 0.0)
1472  self.assertEqual(len(j["transitions"][5]["slots"]), 1)
1473  self.assertEqual(len(j["transitions"][5]["slots"][0]), 1)
1474 

◆ testSortBy()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.testSortBy (   self)

Definition at line 1422 of file edmModuleAllocMonitorAnalyze.py.

References edmModuleAllocMonitorAnalyze.sortByAttribute(), edmTracerCompactLogViewer.TestModuleCommand.tracerFile, and edmModuleAllocMonitorAnalyze.TestModuleCommand.tracerFile.

1422  def testSortBy(self):
1423  parser = ModuleAllocCompactFileParser(self.tracerFile, True)
1424  d = sortByAttribute(parser, 'maxTemp')
1425  #print(d)
1426  self.assertEqual(len(d), 3)
1427  self.assertEqual(d[0][0], 'ESModule')
1428  self.assertEqual(d[1][0], 'Module')
1429  self.assertEqual(d[2][0], 'source')

◆ testSyncValues()

def edmModuleAllocMonitorAnalyze.TestModuleCommand.testSyncValues (   self)

Definition at line 1381 of file edmModuleAllocMonitorAnalyze.py.

1381  def testSyncValues(self):
1382  s = SyncValues()
1383  s.setRun(0,1)
1384  self.assertEqual(s.runFor(0), 1)
1385  s.setLumi(0,1, 1)
1386  self.assertEqual(s.lumiFor(0), (1,1))
1387  s.setStream(1, 1,1,3)
1388  self.assertEqual(s.streamFor(1), (1,1,3))

Member Data Documentation

◆ tracerFile

edmModuleAllocMonitorAnalyze.TestModuleCommand.tracerFile