def testDependencies(self): '''Check that dependencies work''' pool = BatchJobPool(24) last_id = None for i in range(10): last_id = pool.add(dep_function, [i], {}, deps=[last_id]) pool.join()
def testIOFailure(self): '''Check that IO failures are reported''' pool = BatchJobPool(24) pool.add(ioerror_function, [], {}, deps=[]) raised = False # For some reason assertRaises does not accept this # exception. Maybe because it has been pickled? try: pool.join() except Exception as e: self.assertIn("IOError", str(e)) raised = True self.assertEqual(raised, True)
def testUnpickleableFailure(self): '''Check that unpickleable Exceptions are reported''' pool = BatchJobPool(24) pool.add(unpickleable_error_function, [], {}, deps=[]) raised = False # For some reason assertRaises does not accept this # exception. Maybe because it has been pickled? try: pool.join() except Exception as e: self.assertIn("MyEx", str(e)) raised = True self.assertEqual(raised, True) unlink(TMPFILE)
def testFastFunctions(self): '''Check that fast functions work''' pool = BatchJobPool(24) for i in range(240): pool.add(fast_function, [i], {}, deps="") pool.join()
def testBasicFunctionality(self): '''Check that basic processing works''' pool = BatchJobPool(24) for i in range(10): pool.add(test_function, [i], {}, deps="") pool.join()