Beispiel #1
0
    def testTimeSetting(self):
        """
        _testTimeSetting_

        Can we set the times correctly?
        """
        stepName = "cmsRun1"
        timeDiff = 0.01
        myReport = Report(stepName)
        localTime = time.time()
        myReport.setStepStartTime(stepName)
        myReport.setStepStopTime(stepName)
        repTime = myReport.getTimes(stepName)

        self.assertTrue(repTime["startTime"] - localTime < timeDiff)
        self.assertTrue(repTime["stopTime"] - localTime < timeDiff)

        myReport = Report("cmsRun1")
        myReport.addStep("cmsRun2")
        myReport.addStep("cmsRun3")

        step = myReport.retrieveStep("cmsRun1")
        step.startTime = 1
        step.stopTime = 8
        step = myReport.retrieveStep("cmsRun2")
        step.startTime = 2
        step.stopTime = 9
        step = myReport.retrieveStep("cmsRun3")
        step.startTime = 3
        step.stopTime = 10

        self.assertEqual(myReport.getFirstStartLastStop()['stopTime'], 10)
        self.assertEqual(myReport.getFirstStartLastStop()['startTime'], 1)

        return
Beispiel #2
0
    def testTimeSetting(self):
        """
        _testTimeSetting_

        Can we set the times correctly?
        """
        stepName = "cmsRun1"
        timeDiff = 0.01
        myReport = Report(stepName)
        localTime = time.time()
        myReport.setStepStartTime(stepName)
        myReport.setStepStopTime(stepName)
        repTime = myReport.getTimes(stepName)

        self.assertTrue(repTime["startTime"] - localTime < timeDiff)
        self.assertTrue(repTime["stopTime"] - localTime < timeDiff)

        myReport = Report("cmsRun1")
        myReport.addStep("cmsRun2")
        myReport.addStep("cmsRun3")

        step = myReport.retrieveStep("cmsRun1")
        step.startTime = 1
        step.stopTime = 8
        step = myReport.retrieveStep("cmsRun2")
        step.startTime = 2
        step.stopTime = 9
        step = myReport.retrieveStep("cmsRun3")
        step.startTime = 3
        step.stopTime = 10

        self.assertEqual(myReport.getFirstStartLastStop()['stopTime'], 10)
        self.assertEqual(myReport.getFirstStartLastStop()['startTime'], 1)

        return
Beispiel #3
0
 def makeReport(self, fileName):
     myReport = Report('oneitem')
     myReport.addStep('stageOut1')
     myReport.addOutputModule('module1')
     myReport.addOutputModule('module2')
     myReport.addOutputFile('module1', {'lfn': 'FILE1', 'size': 1, 'events': 1})
     myReport.addOutputFile('module2', {'lfn': 'FILE2', 'size': 1, 'events': 1})
     myReport.addOutputFile('module2', {'lfn': 'FILE3', 'size': 1, 'events': 1})
     myReport.persist(fileName)
Beispiel #4
0
 def makeReport(self, fileName):
     myReport = Report('oneitem')
     myReport.addStep('stageOut1')
     mod1 = myReport.addOutputModule('module1')
     mod2 = myReport.addOutputModule('module2')
     file1 = myReport.addOutputFile('module1', {'lfn': 'FILE1', 'size' : 1, 'events' : 1})
     file2 = myReport.addOutputFile('module2', {'lfn': 'FILE2', 'size' : 1, 'events' : 1})
     file3 = myReport.addOutputFile('module2', {'lfn': 'FILE3', 'size' : 1, 'events' : 1})
     myReport.persist( fileName )
Beispiel #5
0
    def createReport(self):
        """
        Create a test report

        """

        jobReport = Report()
        jobReport.addStep('cmsRun1')

        return jobReport
Beispiel #6
0
    def createReport(self, outcome = 0):
        """
        Create a test report

        """

        jobReport = Report()
        jobReport.addStep('cmsRun1')
        jobReport.setStepStartTime(stepName = 'cmsRun1')
        jobReport.setStepStopTime(stepName = 'cmsRun1')
        if outcome:
            jobReport.addError('cmsRun1', 200, 'FakeError', 'FakeError')

        return jobReport
Beispiel #7
0
    def createReports(self, jobs, retryCount=0):
        """
        _createReports_

        Create some dummy job reports for each job
        """

        report = Report()
        report.addStep('testStep', 0)

        for job in jobs:
            #reportPath = os.path.join(job['cache_dir'], 'Report.%i.pkl' % (retryCount))
            reportPath = job['fwjr_path']
            if os.path.exists(reportPath):
                os.remove(reportPath)
            report.save(reportPath)

        return
Beispiel #8
0
    def createReports(self, jobs, retryCount = 0):
        """
        _createReports_

        Create some dummy job reports for each job
        """


        report = Report()
        report.addStep('testStep', 0)

        for job in jobs:
            #reportPath = os.path.join(job['cache_dir'], 'Report.%i.pkl' % (retryCount))
            reportPath = job['fwjr_path']
            if os.path.exists(reportPath):
                os.remove(reportPath)
            report.save(reportPath)


        return