|
@@ -0,0 +1,88 @@
|
|
|
|
+from typing import List, Optional
|
|
|
|
+
|
|
|
|
+from pydantic import BaseModel
|
|
|
|
+
|
|
|
|
+class JobInfoBase(BaseModel):
|
|
|
|
+ # 任务执行CRON
|
|
|
|
+ job_cron: str
|
|
|
|
+ # 任务描述
|
|
|
|
+ job_desc: str
|
|
|
|
+ # 执行器路由策略
|
|
|
|
+ executor_route_strategy: str
|
|
|
|
+ # 执行器任务handler
|
|
|
|
+ executor_handler: Optional[str]
|
|
|
|
+ # 执行器任务参数
|
|
|
|
+ executor_param: Optional[str]
|
|
|
|
+ # 阻塞处理策略
|
|
|
|
+ executor_block_strategy: str
|
|
|
|
+ # 任务超时时间, 单位分钟
|
|
|
|
+ executor_timeout: int
|
|
|
|
+ # 失败重试次数
|
|
|
|
+ executor_fail_retry_count: int
|
|
|
|
+ # 增量初始时间
|
|
|
|
+ inc_start_time: Optional[int]
|
|
|
|
+ # datax运行脚本
|
|
|
|
+ job_json: str
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class JobInfoCreate(JobInfoBase):
|
|
|
|
+ class Config:
|
|
|
|
+ schema_extra = {
|
|
|
|
+ "example": {
|
|
|
|
+ "job_cron": "0 0/2 * * * ?",
|
|
|
|
+ "job_desc": "mysql-mysql同步",
|
|
|
|
+ "executor_route_strategy": "FIRST",
|
|
|
|
+ "executor_handler": "",
|
|
|
|
+ "executor_param": "",
|
|
|
|
+ "executor_block_strategy": "SERIAL_EXECUTION",
|
|
|
|
+ "executor_timeout": 60,
|
|
|
|
+ "executor_fail_retry_count": 2,
|
|
|
|
+ "inc_start_time": 0,
|
|
|
|
+ "job_json": ""
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+class JobInfoUpdate(JobInfoBase):
|
|
|
|
+ # 调度状态: 0-停止 1-运行
|
|
|
|
+ trigger_status: int
|
|
|
|
+ class Config:
|
|
|
|
+ schema_extra = {
|
|
|
|
+ "example": {
|
|
|
|
+ "job_cron": "0 0/2 * * * ?",
|
|
|
|
+ "job_desc": "mysql-mysql同步",
|
|
|
|
+ "executor_route_strategy": "FIRST",
|
|
|
|
+ "executor_handler": "",
|
|
|
|
+ "executor_param": "",
|
|
|
|
+ "executor_block_strategy": "SERIAL_EXECUTION",
|
|
|
|
+ "executor_timeout": 60,
|
|
|
|
+ "executor_fail_retry_count": 2,
|
|
|
|
+ "inc_start_time": 0,
|
|
|
|
+ "job_json": "",
|
|
|
|
+ "trigger_status": 1,
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class JobInfo(JobInfoBase):
|
|
|
|
+ id: int
|
|
|
|
+ # 创建时间
|
|
|
|
+ create_time: int
|
|
|
|
+ # 更新时间
|
|
|
|
+ update_time: int
|
|
|
|
+ # 创建人
|
|
|
|
+ user_id: int
|
|
|
|
+ # 调度状态: 0-停止 1-运行
|
|
|
|
+ trigger_status: int
|
|
|
|
+ # 上次调度时间
|
|
|
|
+ trigger_last_time: int
|
|
|
|
+ # 下次调度时间
|
|
|
|
+ trigger_next_time: int
|
|
|
|
+ # datax运行脚本
|
|
|
|
+ job_json: str
|
|
|
|
+ # 最近一次执行状态
|
|
|
|
+ last_handle_code: int
|
|
|
|
+
|
|
|
|
+ class Config:
|
|
|
|
+ orm_mode = True
|