jobs

package
v2.8.1-0...-89a7925 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Counter sync.Map

调度计数器

Functions

func AddJob

func AddJob(spec string, job *Job) bool

func AllAdminInfo

func AllAdminInfo(adminIds string) []*adminInfo

func GetCounter

func GetCounter(key string) int

func GetEntries

func GetEntries(size int) []*cron.Entry

func GetEntryById

func GetEntryById(jobKey int) *cron.Entry

func InitJobs

func InitJobs()

func PollServer

func PollServer(j *Job) bool

func RemoveJob

func RemoveJob(jobKey int)

func SetCounter

func SetCounter(key string)

func TestServer

func TestServer(server *models.TaskServer) error

Types

type Job

type Job struct {
	JobKey     int                            // jobId = id*10000+serverId
	Id         int                            // taskID
	LogId      int64                          // 日志记录ID
	ServerId   int                            // 执行器信息
	ServerName string                         // 执行器名称
	ServerType int                            // 执行器类型,2-agent 1-telnet 0-ssh
	Name       string                         // 任务名称
	Task       *models.Task                   // 任务对象
	RunFunc    func(time.Duration) *JobResult // 执行函数
	Status     int                            // 任务状态,大于0表示正在执行中
	Concurrent bool                           // 同一个任务是否允许并行执行
}

func NewCommandJob

func NewCommandJob(id int, serverId int, name string, command string) *Job

func NewJobFromTask

func NewJobFromTask(task *models.Task) ([]*Job, error)

func RemoteCommandJob

func RemoteCommandJob(id int, serverId int, name string, command string, servers *models.TaskServer) *Job

远程执行任务 密钥验证

func RemoteCommandJobByAgentPassword

func RemoteCommandJobByAgentPassword(id int, serverId int, name string, command string, servers *models.TaskServer) *Job

func RemoteCommandJobByPassword

func RemoteCommandJobByPassword(id int, serverId int, name string, command string, servers *models.TaskServer) *Job

func RemoteCommandJobByTelnetPassword

func RemoteCommandJobByTelnetPassword(id int, serverId int, name string, command string, servers *models.TaskServer) *Job

func (*Job) GetId

func (j *Job) GetId() int

func (*Job) GetLogId

func (j *Job) GetLogId() int64

func (*Job) GetName

func (j *Job) GetName() string

func (*Job) GetStatus

func (j *Job) GetStatus() int

func (*Job) Run

func (j *Job) Run()

type JobResult

type JobResult struct {
	OutMsg    string
	ErrMsg    string
	IsOk      bool
	IsTimeout bool
}

type RpcResult

type RpcResult struct {
	Status  int
	Message string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL