Skip to content

Commit

Permalink
Refactor proxy directory. (#137)
Browse files Browse the repository at this point in the history
As barriers.py are mess to read, in this PR, I refactor the directories in:
1. moving stuff to proxy directory.
2. separating sender proxy and receiver proxy in different files.

---------

Signed-off-by: Qing Wang <kingchin1218@gmail.com>
  • Loading branch information
jovany-wang committed Jul 2, 2023
1 parent e98fd36 commit 923035e
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from fed.api import (get, init, kill, remote,
shutdown)
from fed.barriers import recv, send
from fed.proxy.barriers import recv, send
from fed.fed_object import FedObject

__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion fed/_private/fed_call_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
logging.basicConfig(level=logging.INFO)

from fed._private.global_context import get_global_context
from fed.barriers import send
from fed.proxy.barriers import send
from fed.fed_object import FedObject
from fed.utils import resolve_dependencies
from fed.tree_util import tree_flatten
Expand Down
8 changes: 7 additions & 1 deletion fed/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from fed._private.fed_actor import FedActorHandle
from fed._private.fed_call_holder import FedCallHolder
from fed._private.global_context import get_global_context, clear_global_context
from fed.barriers import ping_others, recv, send, start_recv_proxy, start_send_proxy
from fed.proxy.barriers import (
ping_others,
recv,
send,
start_recv_proxy,
start_send_proxy,
)
from fed.cleanup import set_exit_on_failure_sending, wait_sending
from fed.fed_object import FedObject
from fed.utils import is_ray_object_refs, setup_logger
Expand Down
18 changes: 18 additions & 0 deletions fed/proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 The RayFed Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


__all__ = [
"barriers",
]
File renamed without changes.
2 changes: 1 addition & 1 deletion fed/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


def resolve_dependencies(current_party, current_fed_task_id, *args, **kwargs):
from fed.barriers import recv
from fed.proxy.barriers import recv

flattened_args, tree = fed.tree_util.tree_flatten((args, kwargs))
indexes = []
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ping_others.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import fed
import fed._private.compatible_utils as compatible_utils
import ray
from fed.barriers import ping_others
from fed.proxy.barriers import ping_others


cluster = {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_transport_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import fed._private.compatible_utils as compatible_utils
from fed._private import constants
from fed.grpc import fed_pb2, fed_pb2_grpc
from fed.barriers import send, start_recv_proxy, start_send_proxy
from fed.proxy.barriers import send, start_recv_proxy, start_send_proxy
from fed.cleanup import wait_sending


Expand Down
2 changes: 1 addition & 1 deletion tests/test_transport_proxy_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import fed._private.compatible_utils as compatible_utils
from fed._private import constants
from fed.barriers import send, start_recv_proxy, start_send_proxy
from fed.proxy.barriers import send, start_recv_proxy, start_send_proxy
from fed.cleanup import wait_sending


Expand Down

0 comments on commit 923035e

Please sign in to comment.