Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitExecutor ¶
func InitExecutor()
func InitTaskManager ¶
func InitTaskManager()
Types ¶
type Scheduler ¶
type Scheduler struct { TaskTable map[string]*TaskSchedulePlan // 任务调度表,key为Id+_+name TaskExecTable map[string]*TaskExecuteInfo // 任务执行表 TaskStopChan chan *Task // 任务停止队列 TaskDelChan chan *Task // 任务删除队列 TaskKillChan chan *Task // 任务强杀队列 //TaskExecManualChan chan *Task // 任务手动执队列 TaskResultChan chan *TaskExecuteResult // 任务结果队列 }
任务调度
var G_scheduler *Scheduler
func (*Scheduler) PushTaskResult ¶
func (scheduler *Scheduler) PushTaskResult(task_result *TaskExecuteResult)
任务执行结果写入到结果队列中
type Task ¶
type Task struct { Id int64 `json:"id"` Name string `json:"name"` CreateTime time.Time `json:"create_time"` StartTime time.Time `json:"start_time"` ConsumeTime float64 `json:"consume_time"` Overtime int `json:"overtime"` LastExecType int `json:"last_exec_type"` TaskType int `json:"task_type"` Rely int `json:"rely"` SubtasksId string `json:"subtasks_id"` Cron string `json:"cron"` TaskExecType string `json:"task_exec_type"` ExecTaskNodeType int `json:"exec_task_node_type"` ExecTaskNodeId string `json:"exec_task_node_id"` Cmd string `json:"cmd"` HttpType string `json:"http_type"` TaskFailNum int `json:"task_fail_num"` TaskFailRetryTime int `json:"task_fail_retry_time"` TaskNotice int `json:"task_notice"` NoticeType int `json:"notice_type"` KeywordNotice string `json:"keyword_notice"` // 提醒关键字 Remake string `json:"remake"` // 备注 Status int `json:"status"` // 状态 NextExecTime time.Time `json:"next_exec_time"` // 下次执行时间 SubtasksData []Task `json:"subtasks_data"` // 子任务数据 ExecTaskNodeData []TaskNode `json:"exec_task_node_data"` // 执行节点数据 }
任务
type TaskExecuteInfo ¶
type TaskExecuteInfo struct { Task *Task TheoryTime time.Time // 理论调度时间 ActualTime time.Time // 实际调度时间 CancelCtx context.Context CancelFunc context.CancelFunc // 用于取消执行的cancel函数 }
任务执行状态
type TaskExecuteResult ¶
type TaskExecuteResult struct { ExecuteInfo *TaskExecuteInfo Output []byte // 输出 Err error // 错误信息 StartTime time.Time // 开始时间 EndTime time.Time // 结束时间 }
任务执行结果
type TaskLock ¶
type TaskLock struct {
// contains filtered or unexported fields
}
任务锁
func InitTaskLock ¶
初始化一把锁
type TaskLog ¶
type TaskLog struct { TaskId int64 `json:"task_id"` // 任务ID TaskName string `json:"task_name"` // 任务名 Cmd string `json:"cmd"` // 执行命令 Output string `json:"output"` // 执行输出信息 CreateTime time.Time `json:"create_time"` // 创建时间,也就是开始执行时间 EndTime time.Time `json:"end_time"` // 执行结束时间 Err string `json:"err"` // 错误信息 ConsumeTime float32 `json:"consume_time"` // 执行消耗时间,s为单位 TaskExecType int `json:"task_exec_type"` // 执行状态,1成功,0失败 NodeIp string `json:"node_ip"` // 节点IP }
任务执行日志
type TaskLogSink ¶
type TaskLogSink struct {
// contains filtered or unexported fields
}
任务执行日志
var G_task_log_sink *TaskLogSink
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
任务管理
var G_task_manager *TaskManager
type TaskNode ¶
type TaskNode struct { Id int64 `json:"id"` Ip string `json:"ip"` CreateTime time.Time `json:"create_time"` Remake string `json:"remake"` IsDelete int `json:"is_delete"` // 0删除,1正常 }
节点
type TaskSchedulePlan ¶
type TaskSchedulePlan struct { Task *Task Expr *cronexpr.Expression // cron对象 NextTime time.Time // 下次执行时间 TaskLock *TaskLock }
任务调度
Click to show internal directories.
Click to hide internal directories.