deepsparse icon indicating copy to clipboard operation
deepsparse copied to clipboard

[V2 Pipeline] SImple Asyncio pipeline test

Open horheynm opened this issue 1 year ago • 0 comments

Description

Adds tests for Pipeline.run_async()

Problem

Testing run_async() currently requires some hacking in tests/server. Isolate Pipeline func's test.

Solution

Simple pipeline running run_async

Usage

    inference_state = InferenceState()
    inference_state.create_state({})
    pipeline_input = IntSchema(value=5)

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

Note

using asyncio-pytest works fine locally, but when Pipelines are registered during pytest collection, it has conflicts Ex.

INTERNALERROR> RuntimeError: Attempting to register name image_classification as <class 'src.deepsparse.image_classification.pipeline.ImageClassificationPipeline'> however image_classification has already been registered as <class 'deepsparse.image_classification.pipeline.ImageClassificationPipeline'>

So created homemade solution to run asyncio

horheynm avatar Dec 14 '23 19:12 horheynm