123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- from typing import List, Optional
- from pydantic import BaseModel
- from app.schemas.cron_expression import CronExpression
- class JobInfoBase(BaseModel):
- # 任务描述
- 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
- # 增量时间
- replace_param: Optional[str]
- # 分区字段
- partition_info: Optional[str]
- # 分区时间格式
- partition_time: Optional[str]
- # 分区时间倒退天数
- partition_num: Optional[int]
- # jvm参数
- jvm_param: Optional[str]
- # 上次时间字段
- last_time: Optional[str]
- # 当前时间字段
- current_time: Optional[str]
- class JobInfoCreate(JobInfoBase):
- # 周期表达式
- cron_expression: CronExpression
- class Config:
- schema_extra = {
- "example": {
- "cron_expression": {
- "cron_select_type": 3,
- "cron_expression": "",
- "minute": 0,
- "hour": 0,
- "day": 1,
- "week": 3,
- "month": 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": "",
- "replace_param": "-DlastTime='%s' -DcurrentTime='%s'",
- "partition_info": "txn_date",
- "partition_time": "yyyy-MM-dd",
- "partition_num": 0,
- "jvm_param": "",
- "last_time": "lastTime",
- "current_time": "currentTime",
- }
- }
- class JobInfoUpdate(JobInfoBase):
- # 周期表达式
- cron_expression: CronExpression
- # 调度状态: 0-停止 1-运行
- trigger_status: int
- class Config:
- schema_extra = {
- "example": {
- "cron_expression": {
- "cron_select_type": 3,
- "cron_expression": "",
- "minute": 0,
- "hour": 0,
- "day": 1,
- "week": 3,
- "month": 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,
- "replace_param": "-DlastTime='%s' -DcurrentTime='%s'",
- "partition_info": "txn_date",
- "partition_time": "yyyy-MM-dd",
- "partition_num": 0,
- "jvm_param": "",
- "last_time": "lastTime",
- "current_time": "currentTime",
- }
- }
- class JobInfo(JobInfoBase):
- id: int
- user_id: str
- # 创建时间
- create_time: int
- # 更新时间
- update_time: int
- # 调度状态: 0-停止 1-运行
- trigger_status: int
- # 上次调度时间
- trigger_last_time: int
- # 下次调度时间
- trigger_next_time: int
- # datax运行脚本
- job_json: str
- # 最近一次执行状态
- last_handle_code: int
- # 运行周期
- job_cron: str
- class Config:
- orm_mode = True
- class JobInfoTriggerStatus(BaseModel):
- # 任务id
- id: int
- # 调度状态: 0-停止 1-运行
- trigger_status: int
- class Config:
- schema_extra = {
- "example": {
- "id": 1,
- "trigger_status": 0,
- }
- }
|