-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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-backlogpythonPull requests that update Python codePull requests that update Python codeserveRay Serve Related IssueRay Serve Related Issueusability
Description
What happened + What you expected to happen
Attribute "result" is unknown Pylance[reportAttributeAccessIssue]
If DeploymentHandle we generic in the return type of remote it could return the right type.
Versions / Dependencies
ray 2.44.1
Reproduction script
# File name: chain.py
from ray import serve
from ray.serve.handle import DeploymentHandle, DeploymentResponse
@serve.deployment
class Adder:
def __init__(self, increment: int):
self._increment = increment
def __call__(self, val: int) -> int:
return val + self._increment
@serve.deployment
class Multiplier:
def __init__(self, multiple: int):
self._multiple = multiple
def __call__(self, val: int) -> int:
return val * self._multiple
@serve.deployment
class Ingress:
def __init__(self, adder: DeploymentHandle, multiplier: DeploymentHandle):
self._adder = adder
self._multiplier = multiplier
async def __call__(self, input: int) -> int:
adder_response: DeploymentResponse = self._adder.remote(input)
# Pass the adder response directly into the multiplier (no `await` needed).
multiplier_response: DeploymentResponse = self._multiplier.remote(adder_response)
# `await` the final chained response.
return await multiplier_response
# pyright: reportFunctionMemberAccess=false
# see https://github.com/ray-project/ray/issues/52483
app = Ingress.bind(
Adder.bind(increment=1),
Multiplier.bind(multiple=2),
)
handle: DeploymentHandle = serve.run(app)
response = handle.remote(5)
assert response.result() == 12, "(5 + 1) * 2 = 12" # Cannot access attribute "result" for class "DeploymentResponseGenerator"Issue Severity
Low: It annoys or frustrates me.
Reactions are currently unavailable
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-backlogpythonPull requests that update Python codePull requests that update Python codeserveRay Serve Related IssueRay Serve Related Issueusability
