Skip to content

Commit

Permalink
[chore] remove unnecessary updating of _worker_names (#19)
Browse files Browse the repository at this point in the history
* Update base.py

* Update base.py

* update

Signed-off-by: Kai-Hsun Chen <[email protected]>

---------

Signed-off-by: Kai-Hsun Chen <[email protected]>
  • Loading branch information
kevin85421 authored Nov 25, 2024
1 parent 16b9e49 commit 5ff6a63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion single_controller/ray/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ def __init__(self,
self.ray_cls_with_init = ray_cls_with_init
self.name_prefix = get_random_string(length=6) if name_prefix is None else name_prefix

if worker_names is not None:
assert self._is_init_with_detached_workers
self._worker_names = worker_names

if self._is_init_with_detached_workers:
self._init_with_detached_workers(worker_names=worker_names)
else:
Expand All @@ -205,7 +209,6 @@ def _is_worker_alive(self, worker: ray.actor.ActorHandle):
def _init_with_detached_workers(self, worker_names):
workers = [ray.get_actor(name=name) for name in worker_names]
self._workers = workers
self._worker_names = worker_names
self._world_size = len(worker_names)

def _init_with_resource_pool(self, resource_pool, ray_cls_with_init, bin_pack, detached):
Expand Down

0 comments on commit 5ff6a63

Please sign in to comment.