server: add BroadcastProcessor tests

This commit is contained in:
2023-08-31 11:16:27 +02:00
committed by Mathieu Virbel
parent 9ed26030a5
commit 600f2ca370
2 changed files with 52 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
import asyncio
from concurrent.futures import ThreadPoolExecutor
from typing import Any
from typing import Any, Union
from uuid import uuid4
from pydantic import BaseModel
@@ -211,12 +211,16 @@ class BroadcastProcessor(Processor):
This processor does not guarantee that the output is in order.
This processor connect all the output of the processors to the input of
the next processor.
the next processor; so the next processor must be able to accept different
types of input.
"""
def __init__(self, processors: Processor):
super().__init__()
self.processors = processors
self.INPUT_TYPE = processors[0].INPUT_TYPE
output_types = set([processor.OUTPUT_TYPE for processor in processors])
self.OUTPUT_TYPE = Union[tuple(output_types)]
def set_pipeline(self, pipeline: "Pipeline"):
super().set_pipeline(pipeline)