Beispiel #1
0
 def test__str__(self,
                 asserts,
                 assertNots,
                 trID=1234,
                 taID=5678,
                 otherTasks=False,
                 pendingRequest=False):
     jbi = JobInfo(jobID=123,
                   status="Failed",
                   tID=trID,
                   tType="MCReconstruction")
     jbi.pendingRequest = pendingRequest
     jbi.otherTasks = otherTasks
     gLogger.notice("otherTasks: ", jbi.otherTasks)
     jbi.taskID = taID
     jbi.inputFiles = ["inputFile"]
     jbi.inputFilesExist = [True]
     jbi.transFileStatus = ["Assigned"]
     jbi.outputFiles = ["outputFile"]
     jbi.errorCounts = [0]
     info = str(jbi)
     for assertStr in asserts:
         self.assertIn(assertStr, info)
     for assertStr in assertNots:
         self.assertNotIn(assertStr, info)
Beispiel #2
0
 def test_checkJob_others_(self, counter, infoCalls, jID=1234567, jStat='Done', others=False,
                           inFiles=['/my/inputfile.lfn'], outFiles=['/my/stupid/file.lfn'],
                           ifStat=[], ofStat=['Exists'], ifProcessed=[],
                           tFiStat=['Processed'], errorCount=[]):
   from DIRAC.TransformationSystem.Utilities.TransformationInfo import TransformationInfo
   from DIRAC.TransformationSystem.Utilities.JobInfo import JobInfo
   tInfoMock = Mock(name="tInfoMock", spec=TransformationInfo)
   testJob = JobInfo(jobID=jID, status=jStat, tID=123, tType="MCSimulation")
   testJob.outputFiles = outFiles
   testJob.outputFileStatus = ofStat
   testJob.otherTasks = others
   testJob.inputFiles = inFiles
   testJob.inputFileStatus = ifStat
   testJob.transFileStatus = tFiStat
   testJob.errorCounts = errorCount
   self.dra.inputFilesProcessed = set(ifProcessed)
   self.dra.checkJob(testJob, tInfoMock)
   gLogger.notice('Testing counter', counter)
   gLogger.notice('Expecting calls', infoCalls)
   gLogger.notice('Called', tInfoMock.method_calls)
   assert len(infoCalls) == len(tInfoMock.method_calls)
   for index, infoCall in enumerate(infoCalls):
     self.assertIn(infoCall, tInfoMock.method_calls[index])
   for count in range(15):
     gLogger.notice('Checking Counter:', count)
     if count == counter:
       self.assertEqual(self.dra.todo['InputFiles'][count]['Counter'], 1)
     else:
       self.assertEqual(self.dra.todo['InputFiles'][count]['Counter'], 0)
   if 0 <= counter <= 2:
     assert set(testJob.inputFiles).issubset(self.dra.inputFilesProcessed)