Async Future Throws RayError as well (#12419)

This commit is contained in:
Simon Mo
2020-12-01 13:07:43 -08:00
committed by GitHub
parent bdf8ad3b5a
commit ef1b0c13c3
3 changed files with 25 additions and 9 deletions
+18 -9
View File
@@ -63,15 +63,24 @@ class LongPollerAsyncClient:
async def _do_long_poll(self):
while True:
updates: Dict[str, UpdatedObject] = await self._poll_once()
self._update(updates)
logger.debug(f"LongPollerClient received updates: {updates}")
for key, updated_object in updates.items():
# NOTE(simon): This blocks the loop from doing another poll.
# Consider use loop.create_task here or poll first then call
# the callbacks.
callback = self.key_listeners[key]
await callback(updated_object.object_snapshot)
try:
updates: Dict[str, UpdatedObject] = await self._poll_once()
self._update(updates)
logger.debug(f"LongPollerClient received udpates: {updates}")
for key, updated_object in updates.items():
# NOTE(simon):
# This blocks the loop from doing another poll. Consider
# use loop.create_task here or poll first then call the
# callbacks.
callback = self.key_listeners[key]
await callback(updated_object.object_snapshot)
except ray.exceptions.RayActorError:
# This can happen during shutdown where the controller is
# intentionally killed, the client should just gracefully
# exit.
logger.debug("LongPollerClient failed to connect to host. "
"Shutting down.")
break
class LongPollerHost: