Documentation
¶
Index ¶
- Constants
- Variables
- func AssembleCmd(cron *gocron.TaskRequest) string
- func GetLogFile(Jobid int64, Taskid int64) string
- func SendNotification(jobModel model.VCron, taskResult model.TaskResult)
- type CronClient
- type CronResponse
- type MyServer
- type ResponseWrapper
- type RpcServiceCurl
- func (h *RpcServiceCurl) ExecCurl(ctx context.Context, command string) CronResponse
- func (h *RpcServiceCurl) Get(url string, timeout int) ResponseWrapper
- func (h *RpcServiceCurl) PostParams(url string, params string, timeout int) ResponseWrapper
- func (h *RpcServiceCurl) Request(req *http.Request, timeout int) ResponseWrapper
- type RpcServiceShell
Constants ¶
View Source
const HttpExecTimeout = 300
http任务执行时间不超过300秒
Variables ¶
View Source
var (
EtcdAddr = flag.String("EtcdAddr", "127.0.0.1:2379", "register etcd address")
)
View Source
var (
ServiceName = flag.String("ServiceName", "task", "service name")
)
Functions ¶
func SendNotification ¶
func SendNotification(jobModel model.VCron, taskResult model.TaskResult)
发送任务结果通知
Types ¶
type CronClient ¶
type CronClient struct{}
RPC调用执行任务
func (*CronClient) Run ¶
func (c *CronClient) Run(Job model.VCron, TaskId int64, ExpireTime int64) model.TaskResult
type MyServer ¶
type MyServer struct{}
func (*MyServer) AfterExecJob ¶
func (s *MyServer) AfterExecJob(queryResult CronResponse, req *gocron.TaskRequest)
执行完后更新日志
func (*MyServer) Run ¶
func (s *MyServer) Run(ctx context.Context, req *gocron.TaskRequest) (*gocron.TaskResponse, error)
服务入口
type ResponseWrapper ¶
type RpcServiceCurl ¶
func (*RpcServiceCurl) ExecCurl ¶
func (h *RpcServiceCurl) ExecCurl(ctx context.Context, command string) CronResponse
func (*RpcServiceCurl) Get ¶
func (h *RpcServiceCurl) Get(url string, timeout int) ResponseWrapper
func (*RpcServiceCurl) PostParams ¶
func (h *RpcServiceCurl) PostParams(url string, params string, timeout int) ResponseWrapper
func (*RpcServiceCurl) Request ¶
func (h *RpcServiceCurl) Request(req *http.Request, timeout int) ResponseWrapper
type RpcServiceShell ¶
func (*RpcServiceShell) ExecShell ¶
func (c *RpcServiceShell) ExecShell(ctx context.Context, command string, taskid int64) CronResponse
执行shell命令,可设置执行超时时间
Click to show internal directories.
Click to hide internal directories.