Documentation ¶
Index ¶
- Constants
- Variables
- func CheckOptions(opts *Options)
- func Int64ToStr(i int64) string
- func StdNewExecutor(opts ...Option) executor.Executor
- func StrToInt64(str string) int64
- type CallbackFunc
- type ExecuteResult
- type HttpHandler
- type JobExecutor
- type LogResult
- type Option
- type Options
- type Registry
- type Task
- func (t *Task) Cancel()
- func (t *Task) GetContext() context.Context
- func (t *Task) GetId() int64
- func (t *Task) GetName() string
- func (t *Task) GetParam() *executor.RunReq
- func (t *Task) Info() string
- func (t *Task) IsRunning() bool
- func (t *Task) Run(ctx context.Context, cb CallbackFunc)
- func (t *Task) SetTimeout(timeout time.Duration)
- func (t *Task) Trace(step string)
- type TaskFunc
- type TaskResult
- type TaskWithPending
Constants ¶
View Source
const ( SerialExecution = "SERIAL_EXECUTION" //单机串行 DiscardLater = "DISCARD_LATER" //丢弃后续调度 DiscardLaterNoAlarm = "DISCARD_LATER_NO_ALARM" //丢弃后续调度,并不报警 CoverEarly = "COVER_EARLY" //覆盖之前调度 )
阻塞处理策略
View Source
const ( TaskResultTypeDone = iota TaskResultTypeFailed TaskResultTypeCancel TaskResultTypeTimeout TaskResultTypePanic )
Variables ¶
View Source
var ( DefaultExecutorPort = "59000" DefaultAccessToken = "jupiter-task-token" DefaultRegistryKey = "jupiter-demo-app" DefaultRegistryGroup = "EXECUTOR" DefaultSwitch = true DefaultExecuteIp = ipv4.LocalIP() )
View Source
var MaxQueueSize = 1
View Source
var (
OverLimit = "over limit"
)
Functions ¶
func CheckOptions ¶
func CheckOptions(opts *Options)
Types ¶
type CallbackFunc ¶
任务执行完后通知回调函数
type ExecuteResult ¶
type ExecuteResult struct { Error int64 `json:"error"` Msg interface{} `json:"msg"` }
任务执行结果 200 表示任务执行正常,500表示失败
type JobExecutor ¶
type JobExecutor struct {
// contains filtered or unexported fields
}
type LogResult ¶
type LogResult struct { FromLineNum int32 `json:"fromLineNum"` // 本次请求,日志开始行数 ToLineNum int32 `json:"toLineNum"` // 本次请求,日志结束行号 LogContent string `json:"logContent"` // 本次请求日志内容 IsEnd bool `json:"isEnd"` // 日志是否全部加载完 }
日志响应内容
type Options ¶
type Options struct { ServerAddr string `json:"address" toml:"address"` //调度中心地址 AccessToken string `json:"access_token" toml:"access_token"` //请求令牌 Timeout time.Duration `json:"timeout" toml:"timeout"` //接口超时时间 ExecutorIp string `json:"executor_ip" toml:"executor_ip"` //本地(执行器)IP(可自行获取) ExecutorPort string `json:"port" toml:"port"` //本地(执行器)端口 RegistryKey string `json:"appname" toml:"appname"` //执行器名称 RegistryGroup string `json:"registry_group " toml:"registry_group"` //执行器组,默认EXECUTOR LogDir string `json:"log_dir" toml:"log_dir"` //日志目录 Switch bool `json:"switch" toml:"switch"` //开关 Debug bool `json:"debug" toml:"debug"` //开关 }
func DefaultConfig ¶
func DefaultConfig() *Options
func DefaultOptions ¶
func DefaultOptions() *Options
func (*Options) Build ¶
func (options *Options) Build() *JobExecutor
type Registry ¶
type Registry struct { RegistryGroup string `json:"registryGroup"` RegistryKey string `json:"registryKey"` RegistryValue string `json:"registryValue"` }
注册参数
type Task ¶
type Task struct { Id int64 // 任务id Name string // 任务名 Param *executor.RunReq // 参数 StartTime int64 // 开始时间 EndTime int64 // 结束时间 // contains filtered or unexported fields }
任务定义
type TaskResult ¶
type TaskResult struct {
// contains filtered or unexported fields
}
type TaskWithPending ¶
type TaskWithPending struct { *Task // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.