-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Closed
Labels
P2Important issue, but not time-criticalImportant issue, but not time-criticalbugSomething that is supposed to be working; but isn'tSomething that is supposed to be working; but isn'tcommunity-backlogcoreIssues that should be addressed in Ray CoreIssues that should be addressed in Ray Coreusability
Description
What happened + What you expected to happen
I've come across a few issues withe static type checking (specifically using mypy) suggested in the ray documentation.
Firstly, the ray.method decorator doesn't allow for default argument values. It will interpret these functions as having no arguments making it impossible to use any value beyond the default.
Secondly, specifying any options through ray.remote causes an assignment inconsistency with the ActorClass type hint.
Versions / Dependencies
ray version 2.50.1, with "defaults" extra installed.
mypy version 1.18.2
Reproduction script
import ray
from ray.actor import ActorClass, ActorProxy
class Container:
def __init__(self) -> None:
self._values: list[int] = []
@ray.method
def add_value(self, value: int) -> None:
self._values.append(value)
@ray.method
def get_value(self, index: int = 0) -> int:
return self._values[index]
Actor_Container: ActorClass[Container] = ray.remote(num_cpus=1)(Container)
if __name__ == "__main__":
ray.init()
container_actor: ActorProxy[Container] = Actor_Container.remote()
ray.get(container_actor.add_value.remote(5))
ray.get(container_actor.get_value.remote(0))Issue Severity
Low: It annoys or frustrates me.
Metadata
Metadata
Assignees
Labels
P2Important issue, but not time-criticalImportant issue, but not time-criticalbugSomething that is supposed to be working; but isn'tSomething that is supposed to be working; but isn'tcommunity-backlogcoreIssues that should be addressed in Ray CoreIssues that should be addressed in Ray Coreusability