Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] remove unnecessary updating of _worker_names #19

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if adding assert self._is_init_with_detached_workers between L190-191 would be better?

Your modification will not cause errors in current usage but it may be better to add this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!


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