scheduler

package
v8.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 7 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxPriority = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type BacklogStatus

type BacklogStatus struct {
	Priority int    `json:"priority"`
	Position int    `json:"position"`
	TaskUUID string `json:"task_uuid"`
}

type Chore

type Chore struct {
	ID         string
	TaskUUID   string
	Encryption string

	Do func(chore Chore)

	Stdout chan string
	Stderr chan string
	Exit   chan int
	Cancel chan bool
}

func NewChore

func NewChore(id string, do func(Chore)) Chore

func (Chore) Errorf

func (chore Chore) Errorf(msg string, args ...interface{})

func (Chore) Infof

func (chore Chore) Infof(msg string, args ...interface{})

func (Chore) String

func (chore Chore) String() string

func (Chore) UnixExit

func (chore Chore) UnixExit(rc int)

type Scheduler

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

func New

func New(workers int, db *db.DB) *Scheduler

func (*Scheduler) Elevate

func (s *Scheduler) Elevate()

func (*Scheduler) Elevator

func (s *Scheduler) Elevator(deadline int)

func (*Scheduler) Run

func (s *Scheduler) Run()

func (*Scheduler) Schedule

func (s *Scheduler) Schedule(priority int, chore Chore) error

func (*Scheduler) Status

func (s *Scheduler) Status() Status

type Status

type Status struct {
	Backlog []BacklogStatus `json:"backlog"`
	Workers []WorkerStatus  `json:"workers"`
}

type Worker

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

func NewWorker

func NewWorker(db *db.DB) *Worker

func (Worker) Available

func (t Worker) Available() bool

func (*Worker) Execute

func (w *Worker) Execute(chore Chore)

func (*Worker) Release

func (t *Worker) Release()

func (*Worker) Reserve

func (t *Worker) Reserve(task string)

func (Worker) String

func (t Worker) String() string

type WorkerStatus

type WorkerStatus struct {
	ID       int    `json:"id"`
	Idle     bool   `json:"idle"`
	TaskUUID string `json:"task_uuid"`
	LastSeen int    `json:"last_seen"`
}

Jump to

Keyboard shortcuts

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