-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path__init__.py
More file actions
28 lines (21 loc) · 785 Bytes
/
__init__.py
File metadata and controls
28 lines (21 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Package with default pipeline steps."""
from logging import getLogger
from typing import Any, Dict
from taskiq_pipelines.abc import AbstractStep
from taskiq_pipelines.steps.filter import FilterStep
from taskiq_pipelines.steps.group import GroupStep
from taskiq_pipelines.steps.mapper import MapperStep
from taskiq_pipelines.steps.sequential import SequentialStep
logger = getLogger(__name__)
def parse_step(step_type: str, step_data: Dict[str, Any]) -> AbstractStep:
step_cls = AbstractStep._known_steps.get(step_type)
if step_cls is None:
logger.warning(f"Unknown step type: {step_type}")
raise ValueError("Unknown step type.")
return step_cls(**step_data)
__all__ = [
"FilterStep",
"GroupStep",
"MapperStep",
"SequentialStep",
]