def test_WriteJobMetaInfo(self):
     xmlRoot = etree.Element("root")
     simT = 10.7
     jmInfo = JobMetaInfo(simtime=simT)
     jmInfo.writeInfoXML(xmlRoot)
     childEls = xmlRoot.getchildren()
     self.assertEqual(len(childEls), 1)
     jmEl = childEls[0]
     self.assertEqual(jmEl.tag, JobMetaInfo.XML_INFO_TAG)
     self.assertEqual(jmEl.text, None)
     jmChildren = jmEl.getchildren()
     self.assertEqual(len(jmChildren), 5)
     elI = 0
     self.assertEqual(jmChildren[elI].tag, "runType")
     self.assertEqual(jmChildren[elI].text, str(None))
     elI += 1
     self.assertEqual(jmChildren[elI].tag, "simtime")
     self.assertEqual(jmChildren[elI].text, str(simT))
     elI += 1
     self.assertEqual(jmChildren[elI].tag, "submitTime")
     self.assertEqual(jmChildren[elI].text, str(None))
     elI += 1
     self.assertEqual(jmChildren[elI].tag, "platformInfo")
     elI += 1
     self.assertEqual(jmChildren[elI].tag, "performanceInfo")
Ejemplo n.º 2
0
 def test_WriteJobMetaInfo(self):
     xmlRoot = etree.Element("root")
     simT = 10.7
     jmInfo = JobMetaInfo(simtime=simT)
     jmInfo.writeInfoXML(xmlRoot)
     childEls = xmlRoot.getchildren()
     self.assertEqual(len(childEls), 1)
     jmEl = childEls[0]
     self.assertEqual(jmEl.tag, JobMetaInfo.XML_INFO_TAG)
     self.assertEqual(jmEl.text, None)
     jmChildren = jmEl.getchildren()
     self.assertEqual(len(jmChildren), 5)
     elI = 0
     self.assertEqual(jmChildren[elI].tag, 'runType')
     self.assertEqual(jmChildren[elI].text, str(None))
     elI += 1
     self.assertEqual(jmChildren[elI].tag, 'simtime')
     self.assertEqual(jmChildren[elI].text, str(simT))
     elI += 1
     self.assertEqual(jmChildren[elI].tag, 'submitTime')
     self.assertEqual(jmChildren[elI].text, str(None))
     elI += 1
     self.assertEqual(jmChildren[elI].tag, 'platformInfo')
     elI += 1
     self.assertEqual(jmChildren[elI].tag, 'performanceInfo')
 def submitRun(self, modelRun, prefixStr=None, extraCmdLineOpts=None, dryRun=False, maxRunTime=None):
     if dryRun is True:
         print "Called to submit modelRun %s in dryRun mode" % (modelRun.name)
         runOptsDict = {
             "prefixStr": prefixStr,
             "extraCmdLineOpts": extraCmdLineOpts,
             "dryRun": dryRun,
             "maxRunTime": maxRunTime,
         }
         return None
     else:
         print "Called to submit modelRun %s" % (modelRun.name)
         jobMetaInfo = JobMetaInfo(0)
         jobMetaInfo.modelName = modelRun.name
         return jobMetaInfo
Ejemplo n.º 4
0
 def submitRun(self, modelRun, prefixStr=None,
         extraCmdLineOpts=None, dryRun=False, maxRunTime=None):
     if dryRun is True:
         print("Called to submit modelRun %s in dryRun mode" \
             % (modelRun.name))
         runOptsDict = {
             'prefixStr':prefixStr,
             'extraCmdLineOpts':extraCmdLineOpts,
             'dryRun':dryRun,
             'maxRunTime':maxRunTime}
         return None
     else:
         print("Called to submit modelRun %s" % (modelRun.name))
         jobMetaInfo = JobMetaInfo(0)
         jobMetaInfo.modelName = modelRun.name
         return jobMetaInfo
Ejemplo n.º 5
0
 def test_attachPlatformInfo(self):
     res = None
     jobMI = JobMetaInfo(None)
     self.jobRunner.attachPlatformInfo(jobMI)
     self.assertEqual(jobMI.platform['system'], platform.system())
     self.assertEqual(jobMI.platform['version'], platform.version())
     self.assertEqual(jobMI.platform['release'], platform.release())
     self.assertEqual(jobMI.platform['machine'], platform.machine())
     self.assertEqual(jobMI.platform['node'], platform.node())
Ejemplo n.º 6
0
 def test_blockSuite(self):
     # Set up some fake jobMetaInfos
     jobMetaInfos = [JobMetaInfo(0) for run in self.skelMSuite.runs]
     for jmInfo, run in zip(jobMetaInfos, self.skelMSuite.runs):
         jmInfo.modelName = run.name
     # Now test
     results = self.jobRunner.blockSuite(self.skelMSuite, jobMetaInfos)
     self.assertEqual(len(results), len(self.skelMSuite.runs))
     for runI, res in enumerate(results):
         self.assertTrue(isinstance(res, ModelResult))
         self.assertEqual(res.modelName, self.skelMSuite.runs[runI].name)