Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDir(dirName string) bool
- func Int64ToStr(i int64) string
- func IsDir(fileAddr string) bool
- type DefaultLogger
- func (l *DefaultLogger) Error(format string, a ...interface{})
- func (l *DefaultLogger) ErrorJob(jobId int64, format string, a ...interface{})
- func (l *DefaultLogger) Info(format string, a ...interface{})
- func (l *DefaultLogger) InfoJob(jobId int64, format string, a ...interface{})
- func (l *DefaultLogger) Init()
- func (l *DefaultLogger) ReadLog(req *LogReq) *LogRes
- type ExecuteResult
- type Executor
- type LogFunc
- type LogHandler
- type LogReq
- type LogRes
- type LogResContent
- type Logger
- type Option
- type Options
- type Registry
- type RunReq
- type ShellTask
- type Task
- type TaskFunc
Constants ¶
View Source
const ( DefaultLogPath = "./runtime/log" // 默认日志目录 DefaultRunPath = "./runtime/run" // 默认运行目录 TimestampFormatter = "2006-01-02 15:04:05" TaskLogStart = "--------------------------------[Start]--------------------------------" TaskLogEnd = "--------------------------------[End]--------------------------------" DefaultLogPageSize = 10000 )
Variables ¶
View Source
var ( DefaultExecutorPort = "9999" DefaultRegistryKey = "golang-jobs" )
Functions ¶
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
Path string // 日志路径
}
func NewDefaultLogger ¶
func NewDefaultLogger() *DefaultLogger
func NewDefaultLoggerByArgs ¶
func NewDefaultLoggerByArgs(logPath string) *DefaultLogger
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(format string, a ...interface{})
func (*DefaultLogger) ErrorJob ¶
func (l *DefaultLogger) ErrorJob(jobId int64, format string, a ...interface{})
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(format string, a ...interface{})
func (*DefaultLogger) InfoJob ¶
func (l *DefaultLogger) InfoJob(jobId int64, format string, a ...interface{})
func (*DefaultLogger) Init ¶
func (l *DefaultLogger) Init()
func (*DefaultLogger) ReadLog ¶
func (l *DefaultLogger) ReadLog(req *LogReq) *LogRes
type ExecuteResult ¶
type ExecuteResult struct { Code int64 `json:"code"` Msg interface{} `json:"msg"` }
ExecuteResult 任务执行结果 200 表示任务执行正常,500表示失败
type Executor ¶
type Executor interface { // Init 初始化 Init(...Option) // LogHandler 日志查询 LogHandler(handler LogHandler) // RegTask 注册任务 RegTask(pattern string, task TaskFunc) // RunTask 运行任务 RunTask(writer http.ResponseWriter, request *http.Request) // KillTask 杀死任务 KillTask(writer http.ResponseWriter, request *http.Request) // TaskLog 任务日志 TaskLog(writer http.ResponseWriter, request *http.Request) // Run 运行服务 Run() error // Stop 停止服务 Stop() }
Executor 执行器
type LogHandler ¶
type LogReq ¶
type LogReq struct { LogDateTim int64 `json:"logDateTim"` // 本次调度日志时间 LogID int64 `json:"logId"` // 本次调度日志ID FromLineNum int `json:"fromLineNum"` // 日志开始行号,滚动加载日志 }
LogReq 日志请求
type LogRes ¶
type LogRes struct { Code int64 `json:"code"` // 200 表示正常、其他失败 Msg string `json:"msg"` // 错误提示消息 Content LogResContent `json:"content"` // 日志响应内容 }
LogRes 日志响应
type LogResContent ¶
type LogResContent struct { FromLineNum int `json:"fromLineNum"` // 本次请求,日志开始行数 ToLineNum int `json:"toLineNum"` // 本次请求,日志结束行号 LogContent string `json:"logContent"` // 本次请求日志内容 IsEnd bool `json:"isEnd"` // 日志是否全部加载完 }
LogResContent 日志响应内容
type Logger ¶
type Logger interface { Info(format string, a ...interface{}) InfoJob(jobId int64, format string, a ...interface{}) Error(format string, a ...interface{}) ErrorJob(jobId int64, format string, a ...interface{}) ReadLog(req *LogReq) *LogRes }
Logger 系统日志
type Options ¶
type Options struct { ServerAddr string `json:"server_addr"` //调度中心地址 AccessToken string `json:"access_token"` //请求令牌 Timeout time.Duration `json:"timeout"` //接口超时时间 ExecutorIp string `json:"executor_ip"` //本地(执行器)IP(可自行获取) ExecutorPort string `json:"executor_port"` //本地(执行器)端口 RegistryKey string `json:"registry_key"` //执行器名称 LogDir string `json:"log_dir"` //日志目录 // contains filtered or unexported fields }
type Registry ¶
type Registry struct { RegistryGroup string `json:"registryGroup"` RegistryKey string `json:"registryKey"` RegistryValue string `json:"registryValue"` }
Registry 注册参数
type RunReq ¶
type RunReq struct { JobID int64 `json:"jobId"` // 任务ID ExecutorHandler string `json:"executorHandler"` // 任务标识 ExecutorParams string `json:"executorParams"` // 任务参数 ExecutorBlockStrategy string `json:"executorBlockStrategy"` // 任务阻塞策略 ExecutorTimeout int64 `json:"executorTimeout"` // 任务超时时间,单位秒,大于零时生效 LogID int64 `json:"logId"` // 本次调度日志ID LogDateTime int64 `json:"logDateTime"` // 本次调度日志时间 GlueType string `json:"glueType"` // 任务模式,可选值参考 com.xxl.job.core.glue.GlueTypeEnum GlueSource string `json:"glueSource"` // GLUE脚本代码 GlueUpdatetime int64 `json:"glueUpdatetime"` // GLUE脚本更新时间,用于判定脚本是否变更以及是否需要刷新 BroadcastIndex int64 `json:"broadcastIndex"` // 分片参数:当前分片 BroadcastTotal int64 `json:"broadcastTotal"` // 分片参数:总分片 }
RunReq 触发任务请求参数
Source Files ¶
Click to show internal directories.
Click to hide internal directories.