Skip to content

Commit

Permalink
Fix UTs.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaihui committed Jan 12, 2024
1 parent 5128c54 commit f049725
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
10 changes: 9 additions & 1 deletion fed/tests/multi-jobs/test_ignore_other_job_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import grpc
import pytest
import ray
import multiprocessing

import fed._private.compatible_utils as compatible_utils
import fed.utils as fed_utils
Expand All @@ -33,7 +34,7 @@
from fed.grpc.pb3 import fed_pb2_grpc as fed_pb2_grpc


def test_ignore_other_job_msg():
def run():
# GIVEN
ray.init(address='local', include_dashboard=False)
address = '127.0.0.1:15111'
Expand Down Expand Up @@ -68,6 +69,13 @@ def test_ignore_other_job_msg():
ray.shutdown()


def test_ignore_other_job_msg():
p_alice = multiprocessing.Process(target=run)
p_alice.start()
p_alice.join()
assert p_alice.exitcode == 0


if __name__ == "__main__":
import sys

Expand Down
26 changes: 12 additions & 14 deletions fed/tests/multi-jobs/test_multi_proxy_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.


import multiprocessing
import pytest
import ray

import fed
from fed.proxy.barriers import receiver_proxy_actor_name, sender_proxy_actor_name
from fed.proxy.grpc.grpc_proxy import GrpcSenderProxy

addresses = {
'job1': {
'alice': '127.0.0.1:11012',
},
'job2': {
'alice': '127.0.0.1:12012',
},
}


def run(party, job_name):
def run():
job_name = 'job_test'
ray.init(address='local', include_dashboard=False)
fed.init(
addresses=addresses[job_name],
party=party,
addresses={
'alice': '127.0.0.1:11012',
},
party='alice',
job_name=job_name,
sender_proxy_cls=GrpcSenderProxy,
config={
Expand All @@ -53,8 +49,10 @@ def run(party, job_name):


def test_multi_proxy_actor():
run('alice', 'job1')
run('alice', 'job2')
p_alice = multiprocessing.Process(target=run)
p_alice.start()
p_alice.join()
assert p_alice.exitcode == 0


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def pass_arg(d):


def run(party):
compatible_utils.init_ray(address='local')
compatible_utils.init_ray(address='local', include_dashboard=False)
addresses = {
'alice': '127.0.0.1:11012',
'bob': '127.0.0.1:11011',
'alice': '127.0.0.1:11355',
'bob': '127.0.0.1:11356',
}
allowed_list = {
"numpy.core.numeric": ["*"],
Expand Down

0 comments on commit f049725

Please sign in to comment.