cron

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CRONLock = make(chan bool, 1)
View Source
var InternalProcessTracker = NewProcessTracker()
View Source
var RunningLock = make(chan bool, 1)

Functions

func AddJobConfig

func AddJobConfig(job utils.CRONConfig)

func CancelJob

func CancelJob(scheduler string, jobName string) error

func DeleteJobRoute

func DeleteJobRoute(w http.ResponseWriter, req *http.Request)

func DeregisterJob

func DeregisterJob(scheduler string, name string)

func GetJobRoute

func GetJobRoute(w http.ResponseWriter, req *http.Request)

func GetJobsList

func GetJobsList() map[string]map[string]ConfigJob

func GetRunningJobsRoute added in v0.18.0

func GetRunningJobsRoute(w http.ResponseWriter, req *http.Request)

func Init

func Init()

func InitJobs

func InitJobs()

func InitScheduler

func InitScheduler()

func JobFromCommand

func JobFromCommand(command string, args ...string) func(OnLog func(string), OnFail func(error), OnSuccess func(), ctx context.Context, cancel context.CancelFunc)

func JobFromCommandWithEnv added in v0.18.0

func JobFromCommandWithEnv(env []string, command string, args ...string) func(OnLog func(string), OnFail func(error), OnSuccess func(), ctx context.Context, cancel context.CancelFunc)

func JobFromContainerCommand

func JobFromContainerCommand(containerID string, command string, args ...string) func(OnLog func(string), OnFail func(error), OnSuccess func(), ctx context.Context, cancel context.CancelFunc)

func ListJobs

func ListJobs(w http.ResponseWriter, req *http.Request)

func ManualRunJob

func ManualRunJob(scheduler string, name string) error

func RegisterJob

func RegisterJob(job ConfigJob)

func RemoveJobConfig

func RemoveJobConfig(name string)

func ResetScheduler

func ResetScheduler(scheduler string)

func RunJobRoute

func RunJobRoute(w http.ResponseWriter, req *http.Request)

func RunOneTimeJob

func RunOneTimeJob(job ConfigJob)

func RunningJobs added in v0.18.0

func RunningJobs() []string

func StopJobRoute

func StopJobRoute(w http.ResponseWriter, req *http.Request)

func WaitForAllJobs added in v0.18.0

func WaitForAllJobs()

Types

type ConfigJob

type ConfigJob struct {
	Disabled       bool
	Scheduler      string
	Name           string
	Cancellable    bool
	Job            func(OnLog func(string), OnFail func(error), OnSuccess func(), ctx context.Context, cancel context.CancelFunc) `json:"-"`
	Crontab        string
	Running        bool
	LastStarted    time.Time
	LastRun        time.Time
	LastRunSuccess bool
	Logs           []string
	Ctx            context.Context    `json:"-"`
	CancelFunc     context.CancelFunc `json:"-"`
	Container      string
	Timeout        time.Duration
	MaxLogs        int
	Resource       string
}

type ExecuterFn added in v0.18.0

type ExecuterFn func(OnLog func(string), OnFail func(error), OnSuccess func(), ctx context.Context, cancel context.CancelFunc)

type JobRequestJSON

type JobRequestJSON struct {
	Scheduler string `validate:"required,min=3,max=32,alphanum"`
	Name      string `validate:"required,min=3,max=32,alphanum"`
}

type ProcessTracker added in v0.18.0

type ProcessTracker struct {
	// contains filtered or unexported fields
}

func NewProcessTracker added in v0.18.0

func NewProcessTracker() *ProcessTracker

func (*ProcessTracker) EndProcess added in v0.18.0

func (pt *ProcessTracker) EndProcess()

func (*ProcessTracker) StartProcess added in v0.18.0

func (pt *ProcessTracker) StartProcess()

func (*ProcessTracker) WaitForZero added in v0.18.0

func (pt *ProcessTracker) WaitForZero()

Jump to

Keyboard shortcuts

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