types

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GtaskGroupNameKey = "GTASK_GROUP_NAME"
	GtaskUserKey      = "GTASK_USER"
	GtaskDirKey       = "GTASK_DIR"
	GtaskIDKey        = "GTASK_ID"
)
View Source
const (
	Pending int = iota
	Succeed
	Failed
	Skipped
)

Variables

This section is empty.

Functions

func PrepareScheduledTasks

func PrepareScheduledTasks(tasks ScheduledTasks, logger *slog.Logger, workingDir string, envVars map[string]string)

func PrepareWorkerTasks

func PrepareWorkerTasks(tasks WorkerTasks, groupName, user, workingDir string, enVars map[string]string)

Types

type ScheduledTask

type ScheduledTask struct {
	Id               string            `mapstructure:"id" validate:"required,excludesall=!@#$ "`
	CronExpr         string            `mapstructure:"expr" validate:"required,cron-expr"`
	Command          string            `mapstructure:"command" validate:"required"`
	Expression       string            `mapstructure:"if"`
	Directory        string            `mapstructure:"directory" validate:"omitempty,required,dirpath"`
	Envs             map[string]string `mapstructure:"environments"`
	LatestTaskResult *TaskResult

	Logger *slog.Logger
}

func (*ScheduledTask) Execute

func (s *ScheduledTask) Execute() *TaskResult

type ScheduledTasks

type ScheduledTasks = []*ScheduledTask

type TaskResult

type TaskResult struct {
	Status   int
	Error    error
	Output   bytes.Buffer
	Task     *ScheduledTask
	StartAt  time.Time
	FinishAt time.Time
}

func (*TaskResult) StatusString

func (t *TaskResult) StatusString() string

type WorkerTask

type WorkerTask struct {
	Id         string `mapstructure:"id" validate:"required,excludesall=!@#$ "`
	Command    string `mapstructure:"command" validate:"required"`
	GroupName  string
	Expression string            `mapstructure:"if"`
	User       string            `mapstructure:"user" validate:"omitempty,required,alphanum"`
	Directory  string            `mapstructure:"directory" validate:"omitempty,required,dirpath"`
	Envs       map[string]string `mapstructure:"environments"`
}

func (*WorkerTask) PrefixedName added in v0.2.2

func (w *WorkerTask) PrefixedName() string

type WorkerTasks

type WorkerTasks = []*WorkerTask

Jump to

Keyboard shortcuts

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