model

package
v0.0.0-...-22e582f Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IDLE denotes not running job which either hasn't been scheduled yet or its last run was successful.
	IDLE State = "Idle"
	// STAGING denotes job which has been scheduled to run in response to offer.
	STAGING = "Staging"
	// STARTING denotes job which has been lanunched by executor.
	STARTING = "Starting"
	// RUNNING denotes job which has been started.
	RUNNING = "Running"
	// FAILED denotes job whose last run failed.
	FAILED = "Failed"
)

Variables

CronParser is a package-level parser for cron syntax.

Functions

This section is empty.

Types

type ContainerType

type ContainerType string

ContainerType defines containerizer genre.

const (
	// Docker denotes Docker containerizer.
	Docker ContainerType = "Docker"
	// Mesos denotes Mesos containerizer.
	// https://mesos.apache.org/documentation/latest/container-image/
	Mesos = "Mesos"
)

type Job

type Job struct {
	JobConf
	JobRuntime
}

Job encompasses fields for job's configuration and runtime.

func (*Job) IsRetryable

func (job *Job) IsRetryable() bool

IsRetryable returns true if job's last run failed and job is eligible for retry.

func (*Job) IsRunnable

func (job *Job) IsRunnable() bool

IsRunnable returns true if job should be launched.

func (*Job) NextRun

func (job *Job) NextRun() time.Time

NextRun returnes time when job should be launched.

type JobConf

type JobConf struct {
	JobID
	Schedule   JobSchedule
	Env        map[string]string
	Secrets    map[string]string
	Container  JobContainer
	CPUs       float64
	Mem        float64
	Disk       float64
	Cmd        string
	User       string
	Shell      bool
	Arguments  []string
	Labels     map[string]string
	MaxRetries int
}

JobConf defines job's configuration fields.

func (*JobConf) FQID

func (j *JobConf) FQID() string

FQID returns globablly unique identifier (acrsoss all groups and projects).

func (*JobConf) Resources

func (j *JobConf) Resources() mesos.Resources

Resources returns resources required by job.

func (*JobConf) String

func (j *JobConf) String() string

type JobContainer

type JobContainer struct {
	Type   ContainerType
	Docker *JobDocker `json:",omitempty"`
	Mesos  *JobMesos  `json:",omitempty"`
}

JobContainer defines containerizer-related fields for job.

type JobDocker

type JobDocker struct {
	Image          string
	ForcePullImage bool
}

JobDocker defines fields for job running inside Docker container.

type JobID

type JobID struct {
	Group   string
	Project string
	ID      string
}

JobID defines job identifier.

func ParseJobID

func ParseJobID(v string) (*JobID, error)

ParseJobID parses serialized job ID returned by String JobID.String method.

func (*JobID) Path

func (jid *JobID) Path() string

Path returns ID formatted as file system path.

func (*JobID) String

func (jid *JobID) String() string

Fully qualified identifier unique across jobs from all groups and projects.

type JobMesos

type JobMesos struct {
	Image string
}

JobMesos defines fields for job running inside Mesos container. https://mesos.apache.org/documentation/latest/mesos-containerizer/

type JobRuntime

type JobRuntime struct {
	State          State
	LastStart      time.Time
	CurrentTaskID  string
	CurrentAgentID string
	Retries        int
}

JobRuntime defines job's runtime fields.

type JobSchedule

type JobSchedule struct {
	Type ScheduleType
	Cron string `json:",omitempty"`
}

JobSchedule defines fields related to job's timetable.

type ScheduleType

type ScheduleType string

ScheduleType defines timetable genre.

const (
	// Cron denotes cron-like timetable.
	Cron ScheduleType = "Cron"
)

type State

type State string

State defines job position.

func (State) String

func (s State) String() string

type Task

type Task struct {
	Start       time.Time
	End         time.Time
	TaskID      string
	ExecutorID  string
	AgentID     string
	FrameworkID string
	ExecutorURL string
	// Set for failed task
	Message string
	Reason  string
	Source  string
}

Task is a single run (failed or successful) of job.

Jump to

Keyboard shortcuts

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