api

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 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 FinishedJobInfo added in v0.14.5

type FinishedJobInfo struct {
	Namespace        string
	Name             string
	Duration         time.Duration
	FrameworkVersion schema.FrameworkVersion
}

FinishedJobInfo contains gc job info

type GetStatusFunc added in v0.14.5

type GetStatusFunc func(interface{}) (StatusInfo, error)

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 JobSyncInfo added in v0.14.5

type JobSyncInfo struct {
	ID               string
	Namespace        string
	ParentJobID      string
	FrameworkVersion schema.FrameworkVersion
	Status           schema.JobStatus
	RuntimeInfo      interface{}
	RuntimeStatus    interface{}
	Annotations      map[string]string
	Message          string
	Action           schema.ActionType
	RetryTimes       int
}

func (*JobSyncInfo) String added in v0.14.5

func (js *JobSyncInfo) String() string

type LessFn

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

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

type NodeSyncInfo added in v0.14.6

type NodeSyncInfo struct {
	Name       string
	Status     string
	Capacity   map[string]string
	Labels     map[string]string
	Action     schema.ActionType
	RetryTimes int
}

type NodeTaskSyncInfo added in v0.14.6

type NodeTaskSyncInfo struct {
	ID         string
	Name       string
	NodeName   string
	Status     model.TaskAllocateStatus
	Resources  map[string]int64
	Labels     map[string]string
	Action     schema.ActionType
	RetryTimes int
}

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
	QueueName    string
	Resource     *resources.Resource
	Priority     int32
	MinAvailable int32
	// PriorityClassName defines job info on cluster
	PriorityClassName string

	// Tasks for TypeDistributed job
	Tasks []schema.Member
	// ExtRuntimeConf define extra runtime conf
	ExtRuntimeConf []byte
	// ExtensionTemplate records the extension template of job
	ExtensionTemplate []byte
	IsCustomYaml      bool
	// 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 *model.Job) (*PFJob, error)

func (*PFJob) GetID added in v0.14.5

func (pfj *PFJob) GetID() string

func (*PFJob) NamespacedName added in v0.14.5

func (pfj *PFJob) NamespacedName() string

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
	// Location for queue affinity
	Location map[string]string

	// SchedulerName for queue job
	SchedulerName string

	//
	Permissions []string

	// Resource range of queue
	MaxResources  *resources.Resource
	MinResources  *resources.Resource
	UsedResources *resources.Resource
}

QueueInfo will have all details about queue

func NewQueueInfo

func NewQueueInfo(q model.Queue) *QueueInfo

func (*QueueInfo) JobOrderFn

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

type QueueSyncInfo added in v0.14.5

type QueueSyncInfo struct {
	Name        string
	Namespace   string
	Labels      map[string]string
	Status      string
	QuotaType   string
	MaxResource *resources.Resource
	MinResource *resources.Resource
	Action      schema.ActionType
	Message     string
	RetryTimes  int
}

QueueSyncInfo contains queue sync info

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

type StatusInfo added in v0.14.5

type StatusInfo struct {
	OriginStatus string
	Status       schema.JobStatus
	Message      string
}

type TaskSyncInfo added in v0.14.5

type TaskSyncInfo struct {
	ID         string
	Name       string
	Namespace  string
	JobID      string
	NodeName   string
	MemberRole schema.MemberRole
	Status     schema.TaskStatus
	Message    string
	PodStatus  interface{}
	Action     schema.ActionType
	RetryTimes int
}

Jump to

Keyboard shortcuts

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