コード例 #1
0
ファイル: JobState_t.py プロジェクト: giffels/PRODAGENT
    def testB(self):
        """change state test"""
        try:
         JobState.register("jobClassID2","Processing",2,1,"myWorkflowID")
         JobState.create("jobClassID2","cacheDir/location/2somewhere")
         JobState.inProgress("jobClassID2")

         # retries=racers=0
         self.assertEqual(JobState.general("jobClassID2"), {'Retries': 0, 'CacheDirLocation': 'cacheDir/location/2somewhere', 'MaxRacers': 1, 'Racers': 0, 'State': 'inProgress', 'MaxRetries': 2, 'JobType': 'Processing'})

         JobState.submit("jobClassID2")

         # retries0,=racers=1
         self.assertEqual(JobState.general("jobClassID2"),{'Retries': 0, 'CacheDirLocation': 'cacheDir/location/2somewhere', 'MaxRacers': 1, 'Racers': 1, 'State': 'inProgress', 'MaxRetries': 2, 'JobType': 'Processing'})

         JobState.runFailure("jobClassID2","jobInstanceID2.1",
              "some.location2.1","job/Report/Location2.1.xml")

         # retries= 1, racers=0
         self.assertEqual(JobState.general("jobClassID2"),
              {'CacheDirLocation': 'cacheDir/location/2somewhere', 
               'MaxRacers': 1, 'Racers': 0, 'State': 'inProgress', 
               'MaxRetries': 2, 'Retries': 1, 'JobType': 'Processing'})

         JobState.submit("jobClassID2")

         # retries= 1, racers=1
         self.assertEqual(JobState.general("jobClassID2"),{'Retries': 1L, 'CacheDirLocation': 'cacheDir/location/2somewhere', 'MaxRacers': 1L, 'Racers': 1L, 'State': 'inProgress', 'MaxRetries': 2L, 'JobType': 'Processing'})

        except StandardError, ex:
            msg = "Failed State Change TestB:\n"
            msg += str(ex)
            self.fail(msg)
コード例 #2
0
ファイル: JobState_t.py プロジェクト: giffels/PRODAGENT
    def testI(self):
         JobState.register("jobClassID10","Processing",8,2,"myWorkflowID")
         #retries=racer=0
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 0, 'CacheDirLocation': None, 'MaxRacers': 2, 'Racers': 0, 'State': 'register', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.createFailure("jobClassID10")
         #retries=1, racer=0
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 1, 'CacheDirLocation': None, 'MaxRacers': 2, 'Racers': 0, 'State': 'register', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.createFailure("jobClassID10")
         #retries=2, racer=0
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 2, 'CacheDirLocation': None, 'MaxRacers': 2, 'Racers': 0, 'State': 'register', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.create("jobClassID10","cacheDir/location/10somewhere")
         #retries=2, racer=0
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 2, 'CacheDirLocation': 'cacheDir/location/10somewhere', 'MaxRacers': 2, 'Racers': 0, 'State': 'create', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.inProgress("jobClassID10")
         #retries=2, racer=0
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 2, 'CacheDirLocation': 'cacheDir/location/10somewhere', 'MaxRacers': 2, 'Racers': 0, 'State': 'inProgress', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.submitFailure("jobClassID10")
         #retries=3, racer=0
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 3, 'CacheDirLocation': 'cacheDir/location/10somewhere', 'MaxRacers': 2, 'Racers': 0, 'State': 'inProgress', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.submit("jobClassID10")
         #retries=3, racer=1
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 3, 'CacheDirLocation': 'cacheDir/location/10somewhere', 'MaxRacers': 2, 'Racers': 1, 'State': 'inProgress', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.submitFailure("jobClassID10")
         #retries=4, racer=1
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 4, 'CacheDirLocation': 'cacheDir/location/10somewhere', 'MaxRacers': 2, 'Racers': 1, 'State': 'inProgress', 'MaxRetries': 8, 'JobType': 'Processing'})
         JobState.submit("jobClassID10")
         #retries=4, racer=2
         self.assertEqual(JobState.general("jobClassID10"),{'Retries': 4, 'CacheDirLocation': 'cacheDir/location/10somewhere', 'MaxRacers': 2, 'Racers': 2, 'State': 'inProgress', 'MaxRetries': 8, 'JobType': 'Processing'})

         # on purpose we introduce an error:
         try:
             JobState.submit("jobClassID10")
         except ProdException, ex:
             print('>>>Test succeeded for exception 1/1 in testH of JobState_t.py\n')
コード例 #3
0
ファイル: JobState_t.py プロジェクト: giffels/PRODAGENT
    def testD(self):
        """change state test"""
        try:
         JobState.register("jobClassID4","Processing",6,2,"myWorkflowID")
         JobState.create("jobClassID4","cacheDir/location/4somewhere")
         JobState.inProgress("jobClassID4")

         # retries=racers=0
         self.assertEqual(JobState.general("jobClassID4"),{'Retries': 0L, 'CacheDirLocation': 'cacheDir/location/4somewhere', 'MaxRacers': 2L, 'Racers': 0L, 'State': 'inProgress', 'MaxRetries': 6L, 'JobType': 'Processing'})
コード例 #4
0
 def testF(self):
     print("""\nSet the job cache (used for failure job cleanup)""")
     try:
         Session.set_database(dbConfig)
         Session.connect()
         Session.start_transaction()
         for i in xrange(0,self.failureJobSpecs):
             JobState.register("failureJobSpec"+str(i),"Processing",2,2)
             JobState.create("failureJobSpec"+str(i),self.location+"/failureJobSpecDir_"+str(i))
         Session.commit_all()
         Session.close_all()
     except StandardError, ex:
         msg = "Failed testB:\n"
         msg += str(ex)
         self.fail(msg)
コード例 #5
0
ファイル: JobState_t.py プロジェクト: giffels/PRODAGENT
    def testE(self):
        try:
         JobState.register("jobClassID5","Processing",2,2,"myWorkflowID")
         JobState.create("jobClassID5","cacheDir/location/5somewhere")
         JobState.inProgress("jobClassID5")
         JobState.submit("jobClassID5")

        # now introduce some failures until we have more failures
        # then retries (this raises an error)

         JobState.runFailure("jobClassID5","jobInstanceID5.1",
              "some.location5.1","job/Report/Location5.1.xml")
         try:
              JobState.runFailure("jobClassID5","jobInstanceID5.2",
                   "some.location5.1","job/Report/Location5.1.xml")
         except ProdException, ex:
              print('>>>Test succeeded for exception 1/1 in testE of JobState_t.py\n')
         JobState.finished("jobClassID5")
コード例 #6
0
ファイル: JobState_t.py プロジェクト: giffels/PRODAGENT
    def testC(self):
        """change state test"""
        try:
         JobState.register("jobClassID3","Merge",5,1,"myWorkflowID")
         JobState.create("jobClassID3","cacheDir/location/3somewhere")
         JobState.inProgress("jobClassID3")
         JobState.submit("jobClassID3")

         # try an illegal state transition:
         try:
              JobState.create("jobClassID3","cacheDir/location3somewhere")
         except ProdException, ex:
              print('>>>Test succeeded for  exception 1/3 in testC of JobState_t.py\n')
        # try to submit another job while the first one has not finished (we only are allowed one racer)
         try:
              JobState.submit("jobClassID3")
         except ProdException, ex:
              print('>>>Test succeeded for  exception 2/3 in testC of JobState_t.py\n')
コード例 #7
0
ファイル: JobState_t.py プロジェクト: giffels/PRODAGENT
    def testA(self):
        """change state test"""
        Session.set_database(dbConfig)
        Session.connect()
        Session.start_transaction()
        try:
         # illegal state transitions:
         try:
            JobState.create("jobClassID1","cacheDir/location/1somewhere")
         except ProdException, ex:
            print('>>>Test succeeded for exception 1/3 in testA of JobState_t.py\n')
         self.assertEqual(JobState.isRegistered("jobClassID1"),False)
         JobState.register("jobClassID1","Processing",3,1,"myWorkflowID")
         self.assertEqual(JobState.isRegistered("jobClassID1"),True)

         # register again (illegal):
         try:
             JobState.register("jobClassID1","Processing",3,1,"myWorkflowID")
             print('>>>Test ERROR \n')
         except ProdException, ex:
             print('>>>Test succeeded for exception 2/3 in testA of JobState_t.py\n')
コード例 #8
0
ファイル: JobState_t.py プロジェクト: giffels/PRODAGENT
         self.assertEqual(JobState.isRegistered("jobClassID1"),False)
         JobState.register("jobClassID1","Processing",3,1,"myWorkflowID")
         self.assertEqual(JobState.isRegistered("jobClassID1"),True)

         # register again (illegal):
         try:
             JobState.register("jobClassID1","Processing",3,1,"myWorkflowID")
             print('>>>Test ERROR \n')
         except ProdException, ex:
             print('>>>Test succeeded for exception 2/3 in testA of JobState_t.py\n')
         try:
         # illegal state transitions:
            JobState.inProgress("jobClassID1")
         except ProdException, ex:
            print('>>>Test succeeded for exception 3/3 in testA of JobState_t.py\n')
         JobState.create("jobClassID1","cacheDir/location/1somewhere")
         JobState.inProgress("jobClassID1")
         # retries=racers=0;
         self.assertEqual(JobState.general("jobClassID1"), {'Retries': 0, 'CacheDirLocation': 'cacheDir/location/1somewhere', 'MaxRacers': 1, 'Racers': 0, 'State': 'inProgress', 'MaxRetries': 3, 'JobType': 'Processing'}
)


         JobState.submit("jobClassID1")

         # retries=0, racers=1;
         self.assertEqual(JobState.general("jobClassID1"), {'Retries': 0L, 'CacheDirLocation': 'cacheDir/location/1somewhere', 'MaxRacers': 1L, 'Racers': 1L, 'State': 'inProgress', 'MaxRetries': 3L, 'JobType': 'Processing'})

         JobState.runFailure("jobClassID1","jobInstanceID1.1",
              "some.location1.1","job/Report/Location1.1.xml")
         JobState.submit("jobClassID1")
        except StandardError, ex: