示例#1
0
文件: __init__.py 项目: swilli/pagmo
 def _perform_evolution(self, algo, pop):
     try:
         from IPython.kernel.client import TaskClient, MapTask
         # Create task client.
         tc = TaskClient()
         # Create the task.
         mt = MapTask(_maptask_target, args=(algo, pop))
         # Run the task.
         task_id = tc.run(mt)
         # Get retval.
         retval = tc.get_task_result(task_id, block=True)
         if isinstance(retval, BaseException):
             raise retval
         return retval
     except BaseException as e:
         print('Exception caught during evolution:')
         print(e)
         raise RuntimeError()