job

package
v0.0.7-0...-445e50d Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2015 License: Apache-2.0 Imports: 4 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
	TargetState     JobState
	TargetMachineID string
	Unit            unit.UnitFile
}

Job is a legacy construct encapsulating a scheduled unit in fleet

func NewJob

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

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

func (*Job) Conflicts

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

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

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

func (j *Job) RequiredTargetMetadata() map[string]pkg.Set

RequiredTargetMetadata return all machine-related metadata from a Job's requirements. Valid metadata fields are strings of the form `key=value`, where both key and value are not the empty string.

func (*Job) Scheduled

func (j *Job) Scheduled() bool

func (*Job) ValidateRequirements

func (j *Job) ValidateRequirements() error

ValidateRequirements ensures that all options in the [X-Fleet] section of the job's associated unit file are known keys. If not, an error is returned.

type JobState

type JobState string

func ParseJobState

func ParseJobState(s string) (JobState, error)

type ScheduledUnit

type ScheduledUnit struct {
	Name            string
	State           *JobState
	TargetMachineID string
}

ScheduledUnit represents a Unit known by fleet and encapsulates its current scheduling state. This does not include Global units.

type Unit

type Unit struct {
	Name        string
	Unit        unit.UnitFile
	TargetState JobState
}

Unit represents a Unit that has been submitted to fleet (list-unit-files)

func (*Unit) Conflicts

func (u *Unit) Conflicts() []string

The following helper functions are to facilitate the transition from Job --> Unit

func (*Unit) IsGlobal

func (u *Unit) IsGlobal() bool

IsGlobal returns whether a Unit is considered a global unit

func (*Unit) Peers

func (u *Unit) Peers() []string

func (*Unit) RequiredTarget

func (u *Unit) RequiredTarget() (string, bool)

func (*Unit) RequiredTargetMetadata

func (u *Unit) RequiredTargetMetadata() map[string]pkg.Set

Jump to

Keyboard shortcuts

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