def run(self):
try:
self.prepare()
self.loop.create_task(self.task())
self.loop.create_task(self.finish()) # to finish the event loop when all tasks are done
self.loop.run_forever()
except KeyboardInterrupt:
get_logger().debug("Stopping the event loop by a keyboard interrupt")
self.loop.stop()
except Exception as e:
get_logger().exception(e)
raise
评论列表
文章目录