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

Fix the return type of client_fn in simulation #1766

Merged
merged 3 commits into from
Mar 30, 2023

Conversation

adam-narozniak
Copy link
Member

Currently, the simulation requires client_fn of type Callable[[str], Client]; however, it works on both Client and NumpyClient (also, the example on the website show function with the return type of NumpyClient).
This PR changes the type to ClientLike, which is Union[Client, NumPyClient].
The problem was mentioned in #1176

Both type work because the simulation uses RayClientProxy that calls this function

def to_client(client_like: ClientLike) -> Client:
"""Take any Client-like object and return it as a Client."""
if isinstance(client_like, NumPyClient):
return _wrap_numpy_client(client=client_like)
return client_like

@tanertopal tanertopal enabled auto-merge (squash) March 30, 2023 18:00
@tanertopal tanertopal merged commit d74e7ba into main Mar 30, 2023
@tanertopal tanertopal deleted the fix-type-client-fn-simulation branch March 30, 2023 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants