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

Enhance the value error when missing a reqiured param. #145

Merged
merged 4 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions fed/_private/fed_call_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def options(self, **options):
return self

def internal_remote(self, *args, **kwargs):
if self._node_party is None or len(self._node_party) == 0:
jovany-wang marked this conversation as resolved.
Show resolved Hide resolved
raise ValueError("You should specify a party name on the fed actor.")

# Generate a new fed task id for this call.
fed_task_id = get_global_context().next_seq_id()
if self._party == self._node_party:
Expand Down
18 changes: 18 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ def test_fed_apis():
assert p_alice.exitcode == 0


def test_miss_party_name_on_actor():
compatible_utils.init_ray(address='local')
cluster = {
'alice': {'address': '127.0.0.1:11012'},
}
fed.init(cluster=cluster, party="alice")

@fed.remote
class MyActor:
pass

with pytest.raises(ValueError):
MyActor.remote()

fed.shutdown()
ray.shutdown()


if __name__ == "__main__":
import sys

Expand Down
Loading