from typing import List, Optional from pydantic import BaseModel class JobLogBase(BaseModel): # 执行器主键ID job_group: int # 任务主键ID job_id: int # 执行器地址,本次执行的地址 executor_address: Optional[str] # 执行器任务handler executor_handler: Optional[str] # 执行器任务参数 executor_param: str # 执行器任务分片参数,格式如1/2 executor_sharding_param: str # 失败重试次数 executor_fail_retry_count: int # 告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败 alarm_status: int class JobLogCreate(JobLogBase): class Config: schema_extra = { "example": { "job_group": 1, "job_id": 1, "executor_address": "FIRST", "executor_handler": "", "executor_param": "", "executor_sharding_param": "1/2", "executor_fail_retry_count": 3, "alarm_status": 0 } } class JobLogTriggerUpdate(): # 调度时间 trigger_time: int # 调度结果 trigger_code: int # 调度日志 trigger_msg: str class Config: schema_extra = { "example": { "trigger_time": 1588888888, "trigger_code": 1, "trigger_msg": "", } } class JobLogHandleUpdate(): # 执行时间 handle_time: int # 执行状态 handle_code: int # 执行日志 handle_msg: str class Config: schema_extra = { "example": { "handle_time": 1588888888, "handle_code": 1, "handle_msg": "", } } class JobLog(JobLogBase): id: int # 上次调度时间 trigger_time: int # 调度状态: 0-停止 1-运行 trigger_code: int # 上次调度时间 trigger_msg: str # 执行时间 handle_time: int # 执行状态 handle_code: int # 执行日志 handle_msg: str # datax 进程ID process_id: str class Config: orm_mode = True