示例#1
0
    def test_checkAllJob(self):
        """test for DataRecoveryAgent checkAllJobs ....................................................."""
        from DIRAC.TransformationSystem.Utilities.JobInfo import JobInfo

        # test with additional task dicts
        from DIRAC.TransformationSystem.Utilities.TransformationInfo import TransformationInfo

        tInfoMock = Mock(name="tInfoMock", spec=TransformationInfo)
        mockJobs = dict([(i, self.getTestMock()) for i in range(11)])
        mockJobs[2].pendingRequest = True
        mockJobs[3].getJobInformation = Mock(
            side_effect=(RuntimeError("ARGJob1"), None))
        mockJobs[4].getTaskInfo = Mock(side_effect=(TaskInfoException("ARG1"),
                                                    None))
        taskDict = True
        lfnTaskDict = True
        self.dra.checkAllJobs(mockJobs, tInfoMock, taskDict, lfnTaskDict)
        self.dra.log.error.assert_any_call(MatchStringWith("+++++ Exception"),
                                           "ARGJob1")
        self.dra.log.error.assert_any_call(
            MatchStringWith("Skip Task, due to TaskInfoException: ARG1"))
        self.dra.log.reset_mock()

        # test inputFile None
        mockJobs = dict([(i, self.getTestMock(nameID=i)) for i in range(5)])
        mockJobs[1].inputFiles = []
        mockJobs[1].getTaskInfo = Mock(
            side_effect=(TaskInfoException("NoInputFile"), None))
        mockJobs[1].tType = "MCSimulation"
        tInfoMock.reset_mock()
        self.dra.checkAllJobs(mockJobs, tInfoMock, taskDict, lfnTaskDict=True)
        self.dra.log.notice.assert_any_call(
            MatchStringWith("Failing job hard"))
示例#2
0
 def test_checkAllJob_2(self):
   """Test where failJobHard fails (via cleanOutputs)."""
   from DIRAC.TransformationSystem.Utilities.TransformationInfo import TransformationInfo
   tInfoMock = Mock(name='tInfoMock', spec=TransformationInfo)
   mockJobs = dict([(i, self.getTestMock()) for i in xrange(5)])
   mockJobs[2].pendingRequest = True
   mockJobs[3].getTaskInfo = Mock(side_effect=(TaskInfoException('ARGJob3'), None))
   mockJobs[3].inputFiles = []
   mockJobs[3].tType = 'MCReconstruction'
   self.dra._DataRecoveryAgent__failJobHard = Mock(side_effect=(RuntimeError('ARGJob4'), None), name='FJH')
   self.dra.checkAllJobs(mockJobs, tInfoMock, tasksDict=True, lfnTaskDict=True)
   mockJobs[3].getTaskInfo.assert_called()
   self.dra._DataRecoveryAgent__failJobHard.assert_called()
   self.dra.log.error.assert_any_call(MatchStringWith('+++++ Exception'), 'ARGJob4')
   self.dra.log.reset_mock()
示例#3
0
 def test_TaskInfoException(self):
     """Transformation.Utilities.JobInfo.TaskInfoException........................................"""
     tie = TaskInfoException("notTasked")
     self.assertIsInstance(tie, Exception)
     self.assertIn("notTasked", str(tie))