Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jovany-wang committed Jul 7, 2023
1 parent 2ac04af commit 0839274
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 44 deletions.
43 changes: 22 additions & 21 deletions tests/test_listen_addr.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,29 @@ def get_value(self):
return self._value


def test_listen_addr():
def run(party, is_inner_party):
compatible_utils.init_ray(address='local')
cluster = {
'alice': {'address': '127.0.0.1:11012', 'listen_addr': '0.0.0.0:11012'},
'bob': {'address': '127.0.0.1:11011', 'listen_addr': '0.0.0.0:11011'},
}
fed.init(cluster=cluster, party=party)

o = f.party("alice").remote()
actor_location = "alice" if is_inner_party else "bob"
my = My.party(actor_location).remote(o)
val = my.get_value.remote()
result = fed.get(val)
assert result == 100
assert fed.get(o) == 100
import time

time.sleep(5)
fed.shutdown()
ray.shutdown()
def run(party, is_inner_party):
compatible_utils.init_ray(address='local')
cluster = {
'alice': {'address': '127.0.0.1:11012', 'listen_addr': '0.0.0.0:11012'},
'bob': {'address': '127.0.0.1:11011', 'listen_addr': '0.0.0.0:11011'},
}
fed.init(cluster=cluster, party=party)

o = f.party("alice").remote()
actor_location = "alice" if is_inner_party else "bob"
my = My.party(actor_location).remote(o)
val = my.get_value.remote()
result = fed.get(val)
assert result == 100
assert fed.get(o) == 100
import time

time.sleep(5)
fed.shutdown()
ray.shutdown()


def test_listen_addr():
p_alice = multiprocessing.Process(target=run, args=('alice', True))
p_bob = multiprocessing.Process(target=run, args=('bob', True))
p_alice.start()
Expand Down
47 changes: 24 additions & 23 deletions tests/test_setup_proxy_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,33 @@
import ray


def test_setup_proxy_success():
def run(party):
compatible_utils.init_ray(address='local', resources={"127.0.0.1": 2})
cluster = {
'alice': {'address': '127.0.0.1:11010'},
'bob': {'address': '127.0.0.1:11011'},
}
send_proxy_resources = {
"127.0.0.1": 1
}
recv_proxy_resources = {
"127.0.0.1": 1
}
fed.init(
cluster=cluster,
party=party,
cross_silo_send_resource_label=send_proxy_resources,
cross_silo_recv_resource_label=recv_proxy_resources,
)
def run(party):
compatible_utils.init_ray(address='local', resources={"127.0.0.1": 2})
cluster = {
'alice': {'address': '127.0.0.1:11010'},
'bob': {'address': '127.0.0.1:11011'},
}
send_proxy_resources = {
"127.0.0.1": 1
}
recv_proxy_resources = {
"127.0.0.1": 1
}
fed.init(
cluster=cluster,
party=party,
cross_silo_send_resource_label=send_proxy_resources,
cross_silo_recv_resource_label=recv_proxy_resources,
)

assert ray.get_actor("SendProxyActor") is not None
assert ray.get_actor(f"RecverProxyActor-{party}") is not None
assert ray.get_actor("SendProxyActor") is not None
assert ray.get_actor(f"RecverProxyActor-{party}") is not None

fed.shutdown()
ray.shutdown()

fed.shutdown()
ray.shutdown()

def test_setup_proxy_success():
p_alice = multiprocessing.Process(target=run, args=('alice',))
p_bob = multiprocessing.Process(target=run, args=('bob',))
p_alice.start()
Expand Down

0 comments on commit 0839274

Please sign in to comment.