jobmon

package
v0.0.0-...-e06cd52 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeverityAlert   = "alert"
	SeverityWarning = "warning"
	SeverityNone    = "none"
)

Variables

View Source
var ErrJobAlreadyRunning = errors.New("A job with same ID is already running")

Functions

func IsValidJobMonitoringSeverity

func IsValidJobMonitoringSeverity(s Severity) bool

Types

type JobRun

type JobRun struct {
	ID        string            `json:"id"`
	Command   string            `json:"command"`
	StartedAt common.Timestamp  `json:"job_started"`
	EndedAt   *common.Timestamp `json:"job_ended"`
	Duration  *uint64           `json:"job_duration_s"`
	User      string            `json:"job_user"`
	ExitCode  *int              `json:"exit_code"`
	Severity  Severity          `json:"severity"`
	NextRunIn *int              `json:"next_run_in"`
	StdOut    *string           `json:"stdout"`
	StdErr    *string           `json:"stderr"`
	Errors    []string          `json:"errors,omitempty"`
}

func (*JobRun) AddError

func (r *JobRun) AddError(msg string)

type JobRunConfig

type JobRunConfig struct {
	JobID            string
	Severity         Severity
	NextRunInterval  *time.Duration
	MaxExecutionTime *time.Duration
	RecordStdErr     bool
	RecordStdOut     bool
	Command          []string
}

type Runner

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

func NewRunner

func NewRunner(spoolDirPath string, runConfig *JobRunConfig, logger *logrus.Logger) *Runner

func (*Runner) RunJob

func (r *Runner) RunJob(interruptionSignalsChan chan os.Signal, forceRun bool) error

type Severity

type Severity string

type SpoolManager

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

func NewSpoolManager

func NewSpoolManager(dirPath string, logger *logrus.Logger) *SpoolManager

NewSpoolManager creates a new object to manage jobmon spool dirPath must be absolute path

func (*SpoolManager) FinishJob

func (s *SpoolManager) FinishJob(uniqID string, r *JobRun) error

func (*SpoolManager) GetFinishedJobs

func (s *SpoolManager) GetFinishedJobs() ([]string, []*JobRun, error)

func (*SpoolManager) NewJob

func (s *SpoolManager) NewJob(r *JobRun, forcedRun bool) (string, error)

func (*SpoolManager) RemoveJobs

func (s *SpoolManager) RemoveJobs(ids []string) error

Jump to

Keyboard shortcuts

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