8000 [Serve] Default DAGDriver implementation cannot serve.run() or serve.build() twice · Issue #24122 · ray-project/ray · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Serve] Default DAGDriver implementation cannot serve.run() or serve.build() twice #24122
Open
@jiaodong

Description

@jiaodong

What happened + What you expected to happen

Use the same code snippet in #24116 but ensure to use default implementation of from ray.serve.drivers import DAGDriver

Also, run the test with parameterize, NOTE: running the test with use_build only as True or False will pass, but only fails when we run both.

def maybe_build(node: ClassNode, use_build: bool) -> Union[Application, ClassNode]:
    if use_build:
        return Application.from_dict(build_app(node).to_dict())
    else:
        return node

@pytest.mark.parametrize("use_build", [False, True])
def test_two_dags_shared_instance(serve_instance, use_build):

Observed issue

On the second run, the body of DAGDriver deployment turned to have a path of types.DAGDriver that cannot be initialized.

Workaround

Bringing my own implementation without subclassing anything works however, I suspect the issue is related to subclass of our default DAGDriver.

@serve.deployment
class DAGDriver:
    def __init__(self, dag_handle):
        self.dag_handle = dag_handle

    async def predict(self, inp):
        """Perform inference directly without HTTP."""
        return await self.dag_handle.remote(inp)

    async def __call__(self, request: starlette.requests.Request):
        """HTTP endpoint of the DAG."""
        input_data = await request.json()
        return await self.predict(input_data)

Versions / Dependencies

.

Reproduction script

.

Issue Severity

Medium: It is a significant difficulty but I can work around it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issue, but not time-criticalbugSomething that is supposed to be working; but isn'tpending-cleanupThis issue is pending cleanup. It will be removed in 2 weeks after being assigned.serveRay Serve Related Issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0