job

package
v0.3.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2014 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobStateInactive = JobState("inactive")
	JobStateLoaded   = JobState("loaded")
	JobStateLaunched = JobState("launched")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Name      string
	State     *JobState
	Unit      unit.Unit
	UnitHash  unit.Hash
	UnitState *unit.UnitState
}

func NewJob

func NewJob(name string, unit unit.Unit) *Job

NewJob creates a new Job based on the given name and Unit. The returned Job has a populated UnitHash and empty JobState and UnitState. nil is returned on failure.

func (*Job) Conflicts added in v0.3.0

func (j *Job) Conflicts() []string

Conflicts returns a list of Job names that cannot be scheduled to the same machine as this Job.

func (*Job) Peers added in v0.3.0

func (j *Job) Peers() []string

Peers returns a list of Job names that must be scheduled to the same machine as this Job.

func (*Job) RequiredTarget added in v0.3.0

func (j *Job) RequiredTarget() (string, bool)

RequiredTarget determines whether or not this Job must be scheduled to a specific machine. If such a requirement exists, the first value returned represents the ID of such a machine, while the second value will be a bool true. If no requirement exists, an empty string along with a bool false will be returned.

func (*Job) RequiredTargetMetadata added in v0.3.0

func (j *Job) RequiredTargetMetadata() map[string][]string

RequiredTargetMetadata return all machine-related metadata from a Job's requirements

func (*Job) Requirements

func (j *Job) Requirements() map[string][]string

Requirements returns all relevant options from the [X-Fleet] section of a unit file. Relevant options are identified with a `X-` prefix in the unit. This prefix is stripped from relevant options before being returned.

func (*Job) Type added in v0.3.0

func (j *Job) Type() (string, error)

Type attempts to determine the Type of systemd unit that this Job contains, based on the suffix of the job name

type JobBid

type JobBid struct {
	JobName   string
	MachineID string
}

func NewBid

func NewBid(jobName string, machID string) *JobBid

type JobOffer

type JobOffer struct {
	Job Job

	// MachineIDs represents a set of machines for which this offer is valid.
	// If nil or len == 0 then all machines. Must be sorted.
	MachineIDs []string
}

func NewOfferFromJob

func NewOfferFromJob(j Job, machineIDs []string) *JobOffer

func (*JobOffer) OfferedTo added in v0.2.0

func (jo *JobOffer) OfferedTo(machineID string) bool

OfferedTo returns true if job is being offered to specified machine.

type JobState

type JobState string

func ParseJobState added in v0.3.0

func ParseJobState(s string) *JobState

Jump to

Keyboard shortcuts

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