Example #1
0
 def test_submit(self):
     # Submit a callable to the transfer coordinator. It should submit it
     # to the executor.
     executor = RecordingExecutor(
         BoundedExecutor(1, 1, {'my-tag': TaskSemaphore(1)}))
     task = ReturnFooTask(self.transfer_coordinator)
     future = self.transfer_coordinator.submit(executor, task, tag='my-tag')
     executor.shutdown()
     # Make sure the future got submit and executed as well by checking its
     # result value which should include the provided future tag.
     self.assertEqual(
         executor.submissions,
         [{'block': True, 'tag': 'my-tag', 'task': task}]
     )
     self.assertEqual(future.result(), 'foo')
Example #2
0
 def test_submit(self):
     # Submit a callable to the transfer coordinator. It should submit it
     # to the executor.
     executor = RecordingExecutor(
         BoundedExecutor(1, 1, {'my-tag': TaskSemaphore(1)}))
     task = ReturnFooTask(self.transfer_coordinator)
     future = self.transfer_coordinator.submit(executor, task, tag='my-tag')
     executor.shutdown()
     # Make sure the future got submit and executed as well by checking its
     # result value which should include the provided future tag.
     self.assertEqual(executor.submissions, [{
         'block': True,
         'tag': 'my-tag',
         'task': task
     }])
     self.assertEqual(future.result(), 'foo')
Example #3
0
 def wrap_executor_in_recorder(self):
     self.executor = RecordingExecutor(self.executor)
     self.submission_main_kwargs['request_executor'] = self.executor