RLlib: Fix bug: WorkerSet.stop() will raise error if self._local_worker is None (e.g. in evaluation worker sets). (#25332)

This commit is contained in:
kourosh hakhamaneshi 2022-06-02 00:41:43 -07:00 committed by GitHub
parent 6fe8f7e16b
commit 87c9fdd0f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -342,7 +342,8 @@ class WorkerSet:
def stop(self) -> None:
"""Calls `stop` on all rollout workers (including the local one)."""
try:
self.local_worker().stop()
if self.local_worker():
self.local_worker().stop()
tids = [w.stop.remote() for w in self.remote_workers()]
ray.get(tids)
except Exception: