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

[V2 Pipeline] SImple Asyncio pipeline test #1478

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def _parse_requirements_file(file_path):
"flask>=1.0.0",
"flask-cors>=3.0.0",
"Pillow>=8.3.2",
"pytest-asyncio==0.23.2",
]
_docs_deps = [
"m2r2~=0.2.7",
Expand Down
15 changes: 15 additions & 0 deletions tests/deepsparse/pipelines/test_basic_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

from pydantic import BaseModel

import pytest
from deepsparse import Pipeline
from deepsparse.operators import Operator
from deepsparse.routers import LinearRouter
from deepsparse.schedulers import OperatorScheduler
from deepsparse.utils import InferenceState


class IntSchema(BaseModel):
Expand Down Expand Up @@ -58,3 +60,16 @@ def test_run_simple_pipeline():
pipeline_output = AddThreePipeline(pipeline_input)

assert pipeline_output.value == 8


@pytest.mark.asyncio
async def test_run_async_simple_pipeline():
inference_state = InferenceState()
inference_state.create_state({})
pipeline_input = IntSchema(value=5)

pipeline_output = await AddThreePipeline.run_async(
pipeline_input, inference_state=inference_state
)

assert pipeline_output.value == 8