Skip to content

[Serve] Implement Default DAGDriver - #23301

Merged
simon-mo merged 12 commits into
ray-project:masterfrom
simon-mo:serve/ingress-driver
Mar 19, 2022
Merged

simon-mo merged 12 commits into
ray-project:masterfrom
simon-mo:serve/ingress-driver

Conversation

@simon-mo

Copy link
Copy Markdown
Contributor

Why are these changes needed?

This PR implements the DAGDriver class that takes input schema conversation from http. This part is reusing functionality from model wrapper. So I also moved the shared functionality into a base class SimpleSchemaIngress to avoid duplication and also the component unit testable.

Related issue number

Closes #23237

Checks

@jiaodong jiaodong left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm for making progress before branch cut, some high level questions only, only extension of existing test suggested.

Comment thread python/ray/serve/driver.py Resolved
handle = serve.run(Driver.bind(serve_dag))
assert ray.get(handle.remote(2)) == 6 # 2 + 2*2
handle = serve.run(DAGDriver.bind(serve_dag))
assert ray.get(handle.predict.remote(2)) == 6 # 2 + 2*2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for each test case that we're calling the python app handle, can we also make a http call ?

Comment thread python/ray/serve/driver.py Resolved
@simon-mo
simon-mo requested review from edoakes and jiaodong March 18, 2022 20:18

def _load_input_schema(
input_schema: Optional[Union[str, InputSchemaFn]]
) -> InputSchemaFn:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this type signature is wrong, right? It can return Any (e.g., starlette req)

Comment thread python/ray/serve/driver.py Outdated
Comment on lines +74 to +75
async def predict(self, inp):
"""Performing inference directly without HTTP."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async def predict(self, inp):
"""Performing inference directly without HTTP."""
async def predict(self, inp):
"""Perform inference directly without HTTP."""

Comment on lines +36 to +40
input_schema(str, InputSchemaFn, None): The FastAPI input conversion
function. By default, Serve will use the `NdArray` schema and convert to
numpy array. You can pass in any FastAPI dependency resolver that returns
an array. When you pass in a string, Serve will import it.
Please refer to Serve HTTP adatper documentation to learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this starlette by default?

@@ -0,0 +1,76 @@
import inspect

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be called drivers if we expect it to be imported by users to match ray.serve.http_adapters

@jiaodong jiaodong left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http test on test_pipeline_dag.py looks good to me, feel free to proceed after addressing ed's comments.

@simon-mo
simon-mo requested a review from edoakes March 18, 2022 20:52
@simon-mo
simon-mo merged commit 91a1c34 into ray-project:master Mar 19, 2022
stephanie-wang added a commit to stephanie-wang/ray that referenced this pull request Mar 19, 2022
@mattip

mattip commented Mar 19, 2022

Copy link
Copy Markdown
Contributor

The new test_loading_check test is failing on windows. The last part fails CI.

assert (
        load_input_schema("ray.serve.tests.test_pipeline_driver.my_resolver")
        == my_resolver

@edoakes

edoakes commented Mar 21, 2022

Copy link
Copy Markdown
Collaborator

Thanks @mattip tracking it here: #23372

edoakes pushed a commit that referenced this pull request Mar 21, 2022
edoakes added a commit to edoakes/ray that referenced this pull request Mar 21, 2022
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.

[Serve] [Pipeline] Implement PipelineDriver and add tests

4 participants