updater

package
v0.0.0-...-e139c8d Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PSERVER      PodType = "pserver"
	TRAINER      PodType = "trainer"
	MASTER       PodType = "master"
	TrainerLabel         = "paddle-job"
	PserverLabel         = "paddle-job-pserver"
	MasterLabel          = "paddle-job-master"
)

Variables

View Source
var (
	// ErrorUnkownResourceType not supported resource
	ErrorUnkownResourceType = errors.New("UnknownResourceType")
)

Functions

This section is empty.

Types

type DefaultJobParser

type DefaultJobParser struct {
}

DefaultJobParser implement a basic JobParser.

func (*DefaultJobParser) GetExtraEnv

func (p *DefaultJobParser) GetExtraEnv(job *paddlev1.TrainingJob, kube kubernetes.Interface) ([]corev1.EnvVar, error)

func (*DefaultJobParser) NewTrainingJob

func (p *DefaultJobParser) NewTrainingJob(job *paddlev1.TrainingJob) (*paddlev1.TrainingJob, error)

NewTrainingJob generates a whole structure of TrainingJob

func (*DefaultJobParser) ParseToTrainingJob

func (p *DefaultJobParser) ParseToTrainingJob(job *paddlev1.TrainingJob,
	extraEnv []corev1.EnvVar) *paddlev1.TrainingJob

func (*DefaultJobParser) Validate

func (p *DefaultJobParser) Validate(job *paddlev1.TrainingJob) error

Validate updates default values for the added job and validates the fields.

type JobUpdater

type JobUpdater struct {
	Job *paddlev1.TrainingJob

	Additional int32
	// contains filtered or unexported fields
}

JobUpdater controls the life circle of one TrainingJob instance

func NewJobUpdater

func NewJobUpdater(job *paddlev1.TrainingJob, kubeCli kubernetes.Interface, jobCli trainingJobClient.Interface,
	auto bool, restartLimit int, outter bool) *JobUpdater

NewJobUpdater returns JobUpdater instance

func (*JobUpdater) Delete

func (j *JobUpdater) Delete() error

Delete deletes trainingjob instance

func (*JobUpdater) FullName

func (j *JobUpdater) FullName() string

FullName returns job's namespace and name

func (*JobUpdater) GetJob

func (j *JobUpdater) GetJob() *paddlev1.TrainingJob

GetJob returns trainingjob instance

func (*JobUpdater) GetStatus

func (j *JobUpdater) GetStatus() (paddlev1.TrainingJobPhase, string, error)

GetStatus get current status phase and reasion of job

func (*JobUpdater) IsReleased

func (j *JobUpdater) IsReleased() bool

IsReleased returns if tj has released resource

func (*JobUpdater) Reconcile

func (j *JobUpdater) Reconcile() error

Reconcile tries to get the job into the desired state

func (*JobUpdater) SetReleased

func (j *JobUpdater) SetReleased(release bool)

SetReleased set resource of job released

func (*JobUpdater) UID

func (j *JobUpdater) UID() types.UID

UID return uid of a job instance

func (*JobUpdater) Update

func (j *JobUpdater) Update(job *paddlev1.TrainingJob)

Update updates jobupdater's job instance

type Labels

type Labels map[string]string

Labels represents labels of k8s resources

func (Labels) HasLabel

func (l Labels) HasLabel(labname string) (bool, string)

HasLabel check if has the label

func (Labels) LabelsParser

func (l Labels) LabelsParser() (string, error)

LabelsParser parse labels to selector

type PodType

type PodType string

Jump to

Keyboard shortcuts

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