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

[Core] Static type checking fails for ray.remote when called with options #25657

Closed
birgerbr opened this issue Jun 10, 2022 · 4 comments · Fixed by #25999
Closed

[Core] Static type checking fails for ray.remote when called with options #25657

birgerbr opened this issue Jun 10, 2022 · 4 comments · Fixed by #25999
Assignees
Labels
bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component)

Comments

@birgerbr
Copy link
Contributor

What happened + What you expected to happen

Static type checking with mypy and PyCharm fails when ray.remote is used with options (ray.remote(num_cpus=2)).

Running mypy on this code:

import ray


@ray.remote(num_cpus=2)
def f():
    pass

gives the following error message:

error: No overload variant of "remote" matches argument type "int"
note: Possible overload variants:
note:     def [R] remote(function: Callable[[], R]) -> RemoteFunction[R, None, None, None, None, None, None, None, None, None, None]
note:     def [T0, R] remote(function: Callable[[T0], R]) -> RemoteFunction[R, T0, None, None, None, None, None, None, None, None, None]
note:     def [T0, T1, R] remote(function: Callable[[T0, T1], R]) -> RemoteFunction[R, T0, T1, None, None, None, None, None, None, None, None]
note:     def [T0, T1, T2, R] remote(function: Callable[[T0, T1, T2], R]) -> RemoteFunction[R, T0, T1, T2, None, None, None, None, None, None, None]
note:     def [T0, T1, T2, T3, R] remote(function: Callable[[T0, T1, T2, T3], R]) -> RemoteFunction[R, T0, T1, T2, T3, None, None, None, None, None, None]
note:     def [T0, T1, T2, T3, T4, R] remote(function: Callable[[T0, T1, T2, T3, T4], R]) -> RemoteFunction[R, T0, T1, T2, T3, T4, None, None, None, None, None]
note:     def [T0, T1, T2, T3, T4, T5, R] remote(function: Callable[[T0, T1, T2, T3, T4, T5], R]) -> RemoteFunction[R, T0, T1, T2, T3, T4, T5, None, None, None, None]
note:     def [T0, T1, T2, T3, T4, T5, T6, R] remote(function: Callable[[T0, T1, T2, T3, T4, T5, T6], R]) -> RemoteFunction[R, T0, T1, T2, T3, T4, T5, T6, None, None, None]
note:     def [T0, T1, T2, T3, T4, T5, T6, T7, R] remote(function: Callable[[T0, T1, T2, T3, T4, T5, T6, T7], R]) -> RemoteFunction[R, T0, T1, T2, T3, T4, T5, T6, T7, None, None]
note:     def [T0, T1, T2, T3, T4, T5, T6, T7, T8, R] remote(function: Callable[[T0, T1, T2, T3, T4, T5, T6, T7, T8], R]) -> RemoteFunction[R, T0, T1, T2, T3, T4, T5, T6, T7, T8, None]
note:     def [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R] remote(function: Callable[[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9], R]) -> RemoteFunction[R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
note:     def remote(t: type) -> Any
Found 1 error in 1 file (checked 1 source file)

This was not an issue with the previous ray version we were using (1.10.0).

Versions / Dependencies

Ray: 1.13.0
Python: 3.8.10
OS: Ubuntu 20.04.4 LTS

Reproduction script

test_ray_remote.py:

import ray


@ray.remote(num_cpus=2)
def f():
    pass
mypy test_ray_remote.py`

Issue Severity

High: It blocks me from completing my task.

@birgerbr birgerbr added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Jun 10, 2022
@DmitriGekhtman
Copy link
Contributor

cc @iycheng

@pcmoritz
Copy link
Contributor

@tiangolo Can you have a look at this? :)

@simenandresen
Copy link

@DmitriGekhtman @pcmoritz @tiangolo do you have any idea if we can expect a fix for this soon?

@tiangolo
Copy link
Member

Yep! Here's the PR with the fix 🤓 #25999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants