Skip to content

Commit

Permalink
refactor: remove legacy code
Browse files Browse the repository at this point in the history
The legacy code that has no effect creates confusion. Hence, it is now
purged.
  • Loading branch information
myungjin committed Apr 5, 2023
1 parent dde88d1 commit d757486
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 734 deletions.
22 changes: 2 additions & 20 deletions lib/python/flame/channel_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@

from flame.backends import backend_provider
from flame.channel import Channel
from flame.common.constants import DEFAULT_RUN_ASYNC_WAIT_TIME, BackendEvent
from flame.common.constants import BackendEvent
from flame.common.util import background_thread_loop, run_async
from flame.config import Config
from flame.discovery_clients import discovery_client_provider
from flame.selectors import selector_provider

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -67,7 +66,6 @@ class ChannelManager(object):

_backend = None # default backend in case there is no per-channel backend
_backends = dict() # backend per channel
_discovery_client = None

def __new__(cls):
"""Create a singleton instance."""
Expand All @@ -85,13 +83,8 @@ def __call__(self, config: Config):

self._channels = {}

with background_thread_loop() as loop:
self._loop = loop

self._setup_backends()

self._discovery_client = discovery_client_provider.get(self._config.task)

atexit.register(self.cleanup)

def _setup_backends(self):
Expand Down Expand Up @@ -178,18 +171,7 @@ def leave(self, name):
"""Leave a channel."""
if not self.is_joined(name):
return

# TODO: reset_channel isn't implemented; the whole discovery module
# needs to be revisited.
coro = self._discovery_client.reset_channel(
self._job_id, name, self._role, self._backend.uid()
)

_, status = run_async(coro, self._loop, DEFAULT_RUN_ASYNC_WAIT_TIME)
if status:
del self._channels[name]

return status
# TODO: reset_channel isn't implemented yet

def get_by_tag(self, tag: str) -> Optional[Channel]:
"""Return a channel object that matches a given function tag."""
Expand Down
17 changes: 0 additions & 17 deletions lib/python/flame/discovery/__init__.py

This file was deleted.

124 changes: 0 additions & 124 deletions lib/python/flame/discovery/local_client.py

This file was deleted.

138 changes: 0 additions & 138 deletions lib/python/flame/discovery/local_server.py

This file was deleted.

33 changes: 0 additions & 33 deletions lib/python/flame/discovery_clients.py

This file was deleted.

2 changes: 0 additions & 2 deletions lib/python/flame/proto/protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#
# SPDX-License-Identifier: Apache-2.0


protoc -I=./ --python_out=./ ./registry_msg.proto
# To run the following command, grpcio-tools is needed.
# if it's not installed, run "pip install grpcio-tools"
python -m grpc_tools.protoc -I=./ --python_out=./ --grpc_python_out=./ ./backend_msg.proto
Loading

0 comments on commit d757486

Please sign in to comment.