入参模块
模型类定义
配置类
class ConfigModel(CoralBaseModel):
"""
节点通用配置类
"""
pipeline_id: str = Field(frozen=True, default="default_pipeline")
node_id: str = Field(frozen=True)
process: ProcessModel = Field(frozen=True, default=ProcessModel())
meta: MetaModel = Field(frozen=True)
generic: GenericParamsModel = Field(frozen=True, default=GenericParamsModel())
params: Dict = Field(frozen=True, default=None)
pipeline_id
: 多个node_id组成的pipeline的IDnode_id
: 节点IDprocess
: 进程配置meta
: 通信元数据配置generic
: 节点通用模式配置params
: 节点入参
配置类的各部分子类
-
系统参数设定
-
业务通用参数
class GenericParamsModel(CoralBaseModel): """ 业务通用参数 """ skip_frame: int = Field(frozen=True, default=0, description="每隔几帧处理一次") enable_metrics: bool = Field(frozen=True, default=True, description="是否开启服务监控") enable_shared_memory: bool = Field(frozen=True, default=False, validate_default=True, description="是否开启共享内存")
-
Sender & Receivers 通信类
class MetaModel(CoralBaseModel): """ sender & receiver 通信类 """ mode: str = Field(frozen=True, default=ProtocalType.PUBSUB) receivers: List[ReceiverModel] = Field(frozen=True, default=[]) sender: SenderModel = Field(frozen=True, default=None)
class PubSubBaseModel(CoralBaseModel): """ 节点通信通用格式 """ node_id: str = Field(frozen=True) raw_type: str = Field(frozen=True, default="RawImage") mware: str = Field(frozen=True, default="zeromq") cls_name: str = Field(frozen=True, default="NoReceiverUse") topic: str = Field(default=None) carrier: str = Field(frozen=True, default="tcp") blocking: bool = Field(frozen=True, default=False) socket_sub_port: int = Field(default=5556) socket_pub_port: int = Field(default=5558) params: Dict[str, Union[str, int, bool, float]] = Field(frozen=True, default={}) class ReceiverModel(PubSubBaseModel): pass class SenderModel(PubSubBaseModel): pass
node_id
: 节点IDraw_type
: 通信的数据类型, 默认RawImage
, 图像类通信数据mware
: 通信的中间件, 默认zeromq
cls_name
: 通信的类名, 默认NoReceiverUse
, 占位符topic
: 通信的topiccarrier
: 通信的协议blocking
: 是否阻塞socket_sub_port
: 订阅端口socket_pub_port
: 发布端口params
: 通信额外的参数, 一般不配置