job

package
v0.0.0-...-4342eab Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JobPriorityValue = map[JobPriority]float64{
	"LOW":    0.5,
	"NORMAL": 1.0,
	"HIGH":   2.0,
}

Functions

This section is empty.

Types

type Job

type Job struct {
	Id string `json:"id"`

	Image   string          `json:"image,omitempty"` // pass into CommandInfo.CommandInfo_ContainerInfo.Image
	Volumes []*mesos.Volume `json:"volumes,omitempty"`
	Shell   bool            `json:"shell,omitempty"`
	// command is "value" in mesos.CommandInfo
	// if shell == false, command is the binary, arguments are args
	Command *string `json:"command,omitempty"`
	// arguments are only read if shell == false
	Arguments   []string          `json:"arguments,omitempty"`
	Environment map[string]string `json:"environment,omitempty"`

	CpuResources float64 `json:"cpus"`
	MemResources float64 `json:"mem"`
	// contains filtered or unexported fields
}

func New

func New(image string, command string, arguments []string, shell bool, env map[string]string, cronspec string) (*Job, error)

func (*Job) ComputePriority

func (j *Job) ComputePriority() float64

recompute job priority based on last run, time, etc

func (*Job) CreateCommandInfo

func (j *Job) CreateCommandInfo() mesos.CommandInfo

used when scheduler creates a new TaskInfo for this job. TODO should task creation be in this package?

func (*Job) NextScheduledRun

func (j *Job) NextScheduledRun() time.Time

func (*Job) String

func (j *Job) String() string

type JobPriority

type JobPriority string
const (
	LowPriority    JobPriority = "LOW"
	NormalPriority JobPriority = "NORMAL"
	HighPriority   JobPriority = "HIGH"
)

type JobQueue

type JobQueue []*Job

A JobQueue implements heap.Interface and holds Jobs.

func (JobQueue) Len

func (pq JobQueue) Len() int

func (JobQueue) Less

func (pq JobQueue) Less(i, j int) bool

func (*JobQueue) Peek

func (pq *JobQueue) Peek() interface{}

func (*JobQueue) Pop

func (pq *JobQueue) Pop() interface{}

func (*JobQueue) Push

func (pq *JobQueue) Push(x interface{})

func (JobQueue) Swap

func (pq JobQueue) Swap(i, j int)

func (*JobQueue) Update

func (pq *JobQueue) Update(j *Job)

update recomputes the priority of a Job in the queue and fixes the PQ up.

Jump to

Keyboard shortcuts

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