Ejemplo n.º 1
0
 def testRAT_max_concurrent_4(self):
     my_profile = ResourceLimitation(4, 0, 0)
     my_worker = Worker(my_profile, self.tasks)
     # -----
     while True:
         if my_worker.pre_process():
             my_worker.process()
             my_worker.post_process()
         else:
             break
     string2debug = my_worker.check_status()
     print string2debug
     self.assertEqual(string2debug,
                      ('15', '22', '',
                       "[('A', 6), ('C', 6), ('B', 8), "
                       "('D', 8), ('E', 15)]"))
Ejemplo n.º 2
0
 def testRAT_nolimitation(self):
     my_profile = ResourceLimitation(0, 0, 0)
     my_worker = Worker(my_profile, self.tasks)
     # -----
     while True:
         if my_worker.pre_process():
             string2debug = my_worker.check_status()
             print "\t", string2debug
             my_worker.process()
             my_worker.post_process()
         else:
             string2debug = my_worker.check_status()
             print "\t", string2debug
             break
     self.assertEqual(string2debug,
                      ('9', '27', '',
                       "[('A', 6), ('C', 6), ('B', 8), ('D', 8), ('E', 9)]"))
Ejemplo n.º 3
0
 def testRAT_max_concurrent_1(self):
     my_profile = ResourceLimitation(1, 0, 0)
     my_worker = Worker(my_profile, self.tasks)
     string2debug = my_worker.check_status()
     self.assertEqual(string2debug, ('0', '0', '', '[]'))
     # -----
     while True:
         if my_worker.pre_process():
             my_worker.process()
             my_worker.post_process()
         else:
             break
     string2debug = my_worker.check_status()
     print string2debug
     self.assertEqual(string2debug,
                      ('37', '9', '',
                       "[('A', 6), ('B', 14), ('C', 20), "
                       "('D', 28), ('E', 37)]"))