mirror of
https://github.com/wassname/ray.git
synced 2026-07-16 11:21:10 +08:00
Make ActorHandles pickleable, also make proper ActorHandle and ActorC… (#2007)
* Make ActorHandles pickleable, also make proper ActorHandle and ActorClass classes. * Fix bug. * Fix actor test bug. * Update __ray_terminate__ usage. * Fix most linting, add documentation, and small cleanups. * Handle forking and pickling differently for actor handles. Fix linting. * Fixes for named actors via pickling. * Generate actor handle IDs deterministically in the pickling case.
This commit is contained in:
committed by
Philipp Moritz
parent
2048b546ff
commit
77c8aa7627
@@ -126,7 +126,7 @@ class A3CAgent(Agent):
|
||||
def _stop(self):
|
||||
# workaround for https://github.com/ray-project/ray/issues/1516
|
||||
for ev in self.remote_evaluators:
|
||||
ev.__ray_terminate__.remote(ev._ray_actor_id.id())
|
||||
ev.__ray_terminate__.remote()
|
||||
|
||||
def _save(self, checkpoint_dir):
|
||||
checkpoint_path = os.path.join(
|
||||
|
||||
@@ -234,7 +234,7 @@ class DDPGAgent(Agent):
|
||||
def _stop(self):
|
||||
# workaround for https://github.com/ray-project/ray/issues/1516
|
||||
for ev in self.remote_evaluators:
|
||||
ev.__ray_terminate__.remote(ev._ray_actor_id.id())
|
||||
ev.__ray_terminate__.remote()
|
||||
|
||||
def _save(self, checkpoint_dir):
|
||||
checkpoint_path = self.saver.save(
|
||||
|
||||
@@ -232,7 +232,7 @@ class DQNAgent(Agent):
|
||||
def _stop(self):
|
||||
# workaround for https://github.com/ray-project/ray/issues/1516
|
||||
for ev in self.remote_evaluators:
|
||||
ev.__ray_terminate__.remote(ev._ray_actor_id.id())
|
||||
ev.__ray_terminate__.remote()
|
||||
|
||||
def _save(self, checkpoint_dir):
|
||||
checkpoint_path = self.saver.save(
|
||||
|
||||
@@ -311,7 +311,7 @@ class ESAgent(agent.Agent):
|
||||
def _stop(self):
|
||||
# workaround for https://github.com/ray-project/ray/issues/1516
|
||||
for w in self.workers:
|
||||
w.__ray_terminate__.remote(w._ray_actor_id.id())
|
||||
w.__ray_terminate__.remote()
|
||||
|
||||
def _save(self, checkpoint_dir):
|
||||
checkpoint_path = os.path.join(
|
||||
|
||||
@@ -269,7 +269,7 @@ class PPOAgent(Agent):
|
||||
def _stop(self):
|
||||
# workaround for https://github.com/ray-project/ray/issues/1516
|
||||
for ev in self.remote_evaluators:
|
||||
ev.__ray_terminate__.remote(ev._ray_actor_id.id())
|
||||
ev.__ray_terminate__.remote()
|
||||
|
||||
def _save(self, checkpoint_dir):
|
||||
checkpoint_path = self.saver.save(
|
||||
|
||||
@@ -30,7 +30,7 @@ class TaskPool(object):
|
||||
def drop_colocated(actors):
|
||||
colocated, non_colocated = split_colocated(actors)
|
||||
for a in colocated:
|
||||
a.__ray_terminate__.remote(a._ray_actor_id.id())
|
||||
a.__ray_terminate__.remote()
|
||||
return non_colocated
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user