Spaces:
Sleeping
Sleeping
File size: 1,080 Bytes
dbaa71b |
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 29 30 31 32 33 34 35 36 37 38 39 |
from typing import Any, Dict, Optional
from uuid import uuid4
from pydantic import BaseModel, Field
from obsei.analyzer.base_analyzer import BaseAnalyzerConfig
from obsei.sink.base_sink import BaseSinkConfig
from obsei.source.base_source import BaseSourceConfig
class WorkflowConfig(BaseModel):
source_config: Optional[BaseSourceConfig] = None
sink_config: Optional[BaseSinkConfig] = None
analyzer_config: Optional[BaseAnalyzerConfig] = None
time_in_seconds: Optional[int] = None
class Config:
arbitrary_types_allowed = True
class WorkflowState(BaseModel):
source_state: Optional[Dict[str, Any]] = None
sink_state: Optional[Dict[str, Any]] = None
analyzer_state: Optional[Dict[str, Any]] = None
class Config:
arbitrary_types_allowed = True
response_model_exclude_unset = True
class Workflow(BaseModel):
id: str = str(uuid4())
config: WorkflowConfig
states: WorkflowState = Field(WorkflowState())
class Config:
arbitrary_types_allowed = True
response_model_exclude_unset = True
|