api

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueueSortPolicies = make(Registry)

QueueSortPolicies global queue sort policies

Functions

This section is empty.

Types

type Arguments

type Arguments map[string]string

Arguments map

type ClusterID

type ClusterID string

type JobQueue added in v0.14.3

type JobQueue struct {
	sync.RWMutex
	StopCh chan struct{}
	Queue  *QueueInfo

	Jobs *PriorityQueue
	// contains filtered or unexported fields
}

func NewJobQueue added in v0.14.3

func NewJobQueue(q *QueueInfo) *JobQueue

func (*JobQueue) DeleteMark added in v0.14.3

func (qj *JobQueue) DeleteMark(jobID string)

func (*JobQueue) GetJob added in v0.14.3

func (qj *JobQueue) GetJob() (*PFJob, bool)

func (*JobQueue) GetName added in v0.14.3

func (qj *JobQueue) GetName() string

func (*JobQueue) Insert added in v0.14.3

func (qj *JobQueue) Insert(job *PFJob)

type JobQueues added in v0.14.3

type JobQueues struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

JobQueues the collect of JobQueue

func NewJobQueues added in v0.14.3

func NewJobQueues() JobQueues

func (*JobQueues) Delete added in v0.14.3

func (jq *JobQueues) Delete(id QueueID)

func (*JobQueues) Get added in v0.14.3

func (jq *JobQueues) Get(id QueueID) (*JobQueue, bool)

func (*JobQueues) Insert added in v0.14.3

func (jq *JobQueues) Insert(id QueueID, jobQueue *JobQueue)

type LessFn

type LessFn func(interface{}, interface{}) bool

LessFn is the func declaration used by sort or priority queue.

type PFJob

type PFJob struct {
	ID        string
	Name      string
	Namespace string
	UserName  string
	// JobType of job, such as TypeSingle, TypeDistributed, and TypeWorkflow
	JobType   schema.JobType
	Framework schema.Framework
	// TODO: use Framework and Tasks.Role instead of JobMode
	JobMode string
	Status  string
	// compute resource request resource for job
	// ClusterID and QueueID of job
	ClusterID    ClusterID
	QueueID      QueueID
	Resource     *resources.Resource
	Priority     int32
	MinAvailable int32
	// PriorityClassName defines job info on cluster
	PriorityClassName string
	// storage resource for job
	FSID string
	// Tasks for TypeDistributed job
	Tasks []models.Member
	// ExtRuntimeConf define extra runtime conf
	ExtRuntimeConf []byte
	// ExtensionTemplate records the extension template of job
	ExtensionTemplate string
	// Conf for job
	Conf schema.Conf

	// Labels for job to update
	Labels      map[string]string
	Annotations map[string]string

	// extend field
	Tags   []string
	LogUrl string

	WaitingTime *time.Duration
	CreateTime  time.Time
	StartTime   time.Time
	EndTIme     time.Time
}

PFJob will have all info of a Job

func NewJobInfo

func NewJobInfo(job *models.Job) (*PFJob, error)

func (*PFJob) UpdateAnnotations

func (pfj *PFJob) UpdateAnnotations(annotations map[string]string)

func (*PFJob) UpdateJobPriority added in v0.14.3

func (pfj *PFJob) UpdateJobPriority(priorityClassName string)

func (*PFJob) UpdateLabels

func (pfj *PFJob) UpdateLabels(labels map[string]string)

type PFJobInterface

type PFJobInterface interface {
	CreateJob() (string, error)
	StopJobByID(string) error
	UpdateJob([]byte) error
	GetID() string
}

type PolicyFactory

type PolicyFactory = func(configuration Arguments) (SortPolicy, error)

PolicyFactory is a function that builds a sort policy.

type PriorityQueue

type PriorityQueue struct {
	// contains filtered or unexported fields
}

PriorityQueue implements a scheduling queue.

func NewPriorityQueue

func NewPriorityQueue(lessFn LessFn) *PriorityQueue

NewPriorityQueue returns a PriorityQueue

func (*PriorityQueue) Empty

func (q *PriorityQueue) Empty() bool

Empty check if queue is empty

func (*PriorityQueue) Len

func (q *PriorityQueue) Len() int

Len returns Len of the priority queue

func (*PriorityQueue) Pop

func (q *PriorityQueue) Pop() interface{}

Pop pops element in the priority Queue

func (*PriorityQueue) Push

func (q *PriorityQueue) Push(it interface{})

Push pushes element in the priority Queue

type QueueID

type QueueID string

QueueID is UID type, serves as unique ID for each queue

type QueueInfo

type QueueInfo struct {
	UID       QueueID
	Name      string
	Namespace string
	// ClusterID for queue
	ClusterID ClusterID
	Type      string
	Status    string

	// Priority for queue
	Priority int32
	Weight   int32

	// SortPolicy for queue job
	SortPolicyNames []string
	SortPolicies    []SortPolicy

	// SchedulerName for queue job
	SchedulerName string

	//
	Permissions []string

	// Resource range of queue
	Max  *resources.Resource
	Min  *resources.Resource
	Used *resources.Resource
}

QueueInfo will have all details about queue

func NewQueueInfo

func NewQueueInfo(q models.Queue) *QueueInfo

func (*QueueInfo) JobOrderFn

func (q *QueueInfo) JobOrderFn(l, r interface{}) bool

type Registry

type Registry map[string]PolicyFactory

Registry is a collection of all available sort polices.

func (Registry) Register

func (r Registry) Register(name string, factory PolicyFactory) error

Register adds a new sort policy to the registry. If a sort policy with the same name exists, it returns an error.

func (Registry) Unregister

func (r Registry) Unregister(name string) error

Unregister removes an existing sort policy from the registry. If no sort policy with the provided name exists, it returns an error.

type SortPolicy

type SortPolicy interface {
	Name() string
	OrderFn(interface{}, interface{}) int
}

func NewRegistry

func NewRegistry(policyNames []string) []SortPolicy

NewRegistry registry sort policy for queue

Jump to

Keyboard shortcuts

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