Пример #1
0
 def test_iterator_error(self):
     vids = list(range(2))
     rt = Runtime(get_spawned_process_pool_factory())
     gen = rt.get_result_iterator(TestRuntime.query_that_throws_at_0,
                                  vids,
                                  print_error=False)
     result = next(gen)
     self.assertIntervalSetEq(result,
                              TestRuntime.query_that_throws_at_0([1]))
     with self.assertRaises(RekallRuntimeException):
         next(gen)
Пример #2
0
 def test_iterator(self):
     vids = list(range(1000))
     rt = Runtime(get_forked_process_pool_factory(5))
     gen = rt.get_result_iterator(TestRuntime.query, vids, randomize=False)
     for vid, result in zip(vids, gen):
         self.assertCollectionEq(result, TestRuntime.query([vid]))