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

Unify client types #2390

Merged
merged 25 commits into from
Oct 14, 2023
Merged

Unify client types #2390

merged 25 commits into from
Oct 14, 2023

Conversation

jafermarq
Copy link
Contributor

@jafermarq jafermarq commented Sep 18, 2023

This PR removes ClientLike usage and therefore everywhere a client object of type Client is expected. For this, the idea is that users will call <their_client>.to_client() when returning inside their ClientFn. to_client() is a new method that both Client and NumPyClient have.

For backwards compatibility:

  • the entry point via start_numpy_client when users supply a client object (that should be of type ClientNumPy). In this case, .to_client() is called internally and transparently to the user. However a Deprecation warning is triggered encouraging users to use start_client instead.
  • Similarly in spirit, for simulation, we trigger a warning (once) if the type of client returned in client_fn is not of type Client. Then, the client is converted to Client type.

In addition this PR:

  • The content of numpy_client_wrapper.py has been moved to client.py (where it used to be not long ago)

Part of the content above was done in #2493.

@jafermarq jafermarq added the enhancement New feature or request label Sep 18, 2023
@jafermarq jafermarq marked this pull request as ready for review October 12, 2023 08:36
src/py/flwr/client/app.py Outdated Show resolved Hide resolved
src/py/flwr/client/app.py Outdated Show resolved Hide resolved
src/py/flwr/simulation/ray_transport/ray_actor.py Outdated Show resolved Hide resolved
src/py/flwr/simulation/ray_transport/utils.py Show resolved Hide resolved
@danieljanes danieljanes changed the title Towards unifying client types Unify client types Oct 14, 2023
@danieljanes danieljanes merged commit bfd5656 into main Oct 14, 2023
26 checks passed
@danieljanes danieljanes deleted the client_protocol branch October 14, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants