queue

package
v0.15.10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueuesToAPI

func QueuesToAPI(queues []Queue) []*api.Queue

Types

type CancelAPI added in v0.15.4

type CancelAPI func(string, []string, []api.JobState) error

func Cancel added in v0.15.4

func Cancel(getConnectionDetails client.ConnectionDetails) CancelAPI

type CordonAPI added in v0.9.8

type CordonAPI func(string) error

func Cordon added in v0.9.8

func Cordon(getConnectionDetails client.ConnectionDetails) CordonAPI

type CreateAPI

type CreateAPI func(Queue) error

func Create

func Create(getConnectionDetails client.ConnectionDetails) CreateAPI

type DeleteAPI

type DeleteAPI func(string) error

func Delete

func Delete(getConnectionDetails client.ConnectionDetails) DeleteAPI

type GetAPI added in v0.3.100

type GetAPI func(string) (*api.Queue, error)

func Get added in v0.3.100

func Get(getConnectionDetails client.ConnectionDetails) GetAPI

type GetAllAPI added in v0.9.8

type GetAllAPI func() ([]*api.Queue, error)

func GetAll added in v0.9.8

func GetAll(getConnectionDetails client.ConnectionDetails) GetAllAPI

type PermissionSubject

type PermissionSubject struct {
	Kind PermissionSubjectKind `json:"kind"`
	Name string                `json:"name"`
}

type PermissionSubjectKind

type PermissionSubjectKind string
const (
	PermissionSubjectKindGroup PermissionSubjectKind = "Group"
	PermissionSubjectKindUser  PermissionSubjectKind = "User"
)

func NewPermissionSubjectKind

func NewPermissionSubjectKind(in string) (PermissionSubjectKind, error)

NewPermissionSubjectKind returns PermissionSubjectKind from input string. If input string doesn't match one of the allowed kind values ["Group", "User"] error is returned.

func (PermissionSubjectKind) Generate

func (kind PermissionSubjectKind) Generate(rand *rand.Rand, size int) reflect.Value

Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package.

TODO: Unused.

func (*PermissionSubjectKind) UnmarshalJSON

func (kind *PermissionSubjectKind) UnmarshalJSON(data []byte) error

UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.

TODO: Unused.

type PermissionSubjects

type PermissionSubjects []PermissionSubject

func NewPermissionSubjects

func NewPermissionSubjects(subjects []*api.Queue_Permissions_Subject) (PermissionSubjects, error)

NewPermissionSibjects returns PermissionSubjects using the subjects values. If any of the subjects has an invalid subject kind an error is returned.

func NewPermissionSubjectsFromOwners

func NewPermissionSubjectsFromOwners(users, groups []string) PermissionSubjects

NewPermissionSubjectsFromOwners creates Subjects from user and group owners. Subjects will have User subjects that contains all users specified in users parameter and Group subjects that contains all groups specified in groups parameter. This function is used for backward compatibility when permission subjects didn't exist and only user and group owners could be associated with the queues.

type PermissionVerb

type PermissionVerb string
const (
	PermissionVerbSubmit       PermissionVerb = "submit"
	PermissionVerbCancel       PermissionVerb = "cancel"
	PermissionVerbPreempt      PermissionVerb = "preempt"
	PermissionVerbReprioritize PermissionVerb = "reprioritize"
	PermissionVerbWatch        PermissionVerb = "watch"
)

func NewPermissionVerb

func NewPermissionVerb(in string) (PermissionVerb, error)

NewPermissionVerb returns PermissionVerb from input string. If input string doesn't match one of allowed verb values ["submit", "cancel", "preempt", "reprioritize", "watch"], and error is returned.

func (PermissionVerb) Generate

func (verb PermissionVerb) Generate(rand *rand.Rand, size int) reflect.Value

Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package

func (*PermissionVerb) UnmarshalJSON

func (verb *PermissionVerb) UnmarshalJSON(data []byte) error

UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.

type PermissionVerbs

type PermissionVerbs []PermissionVerb

func AllPermissionVerbs

func AllPermissionVerbs() PermissionVerbs

AllPermissionVerbs returns PermissionsVerbs containing all PermissionVerb values

func NewPermissionVerbs

func NewPermissionVerbs(verbs []string) (PermissionVerbs, error)

NewPermissionVerbs returns PermissionVerbs from string slice. Every string from slice is transformed into PermissionVerb. Error is returned if a string cannot be transformed to PermissionVerb.

type Permissions

type Permissions struct {
	Subjects PermissionSubjects `json:"subjects"`
	Verbs    PermissionVerbs    `json:"verbs"`
}

Permissions specifies the list of subjects that are allowed to perform queue operations specified by the list of verbs.

func NewPermissions

func NewPermissions(perm *api.Queue_Permissions) (Permissions, error)

NewPermissions returns Permissions from *api.Queue_Permissions. An error is returned if subjects/verbs can't be generated from *api.Queue_Permissions.Subjects/*api.Queue_Permissions.Verbs

func NewPermissionsFromOwners

func NewPermissionsFromOwners(users, groups []string) Permissions

NewPermissionsFromOwners creates Permissions from user and group owners. Permissions will have User subjects that contains all users specified in users parameter and Group subjects that contains all groups specified in groups parameter. Permissions will also include all currently supported verbs (effectively emulating old user's and group's owner permissions). This function is used for backward compatibility when permissions didn't exist and only user and group owners could perform queue operations.

func (Permissions) ToAPI

func (p Permissions) ToAPI() *api.Queue_Permissions

ToAPI converts Permissions to *api.Queue_Permissions.

type PreemptAPI added in v0.15.4

type PreemptAPI func(string, []string) error

func Preempt added in v0.15.4

func Preempt(getConnectionDetails client.ConnectionDetails) PreemptAPI

type PriorityFactor

type PriorityFactor float64

func NewPriorityFactor

func NewPriorityFactor(in float64) (PriorityFactor, error)

NewPriorityFactor return PriorityFactor using the value of in. If in value is lower than 1.0 an error is returned.

func (PriorityFactor) Generate

func (f PriorityFactor) Generate(rand *rand.Rand, size int) reflect.Value

Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package

func (*PriorityFactor) UnmarshalJSON

func (f *PriorityFactor) UnmarshalJSON(data []byte) error

UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.

type Queue

type Queue struct {
	Name                              string         `json:"name"`
	Permissions                       []Permissions  `json:"permissions"`
	PriorityFactor                    PriorityFactor `json:"priorityFactor"`
	ResourceLimitsByPriorityClassName map[string]api.PriorityClassResourceLimits
	Cordoned                          bool              `json:"cordoned"`
	Labels                            map[string]string `json:"labels"`
}

func NewQueue

func NewQueue(in *api.Queue) (Queue, error)

NewQueue returns new Queue using the in parameter. Error is returned if any of the queue fields has corresponding value that is invalid.

func (Queue) HasPermission

func (q Queue) HasPermission(inputSubject PermissionSubject, inputVerb PermissionVerb) bool

HasPermission returns true if the inputSubject is allowed to peform a queue operation specified by inputVerb parameter, otherwise returns false

func (Queue) ToAPI

func (q Queue) ToAPI() *api.Queue

ToAPI transforms Queue to *api.Queue structure

type ResourceLimit

type ResourceLimit float64

func NewResourceLimit

func NewResourceLimit(in float64) (ResourceLimit, error)

NewResourceLimit return ResourceLimit using the value of in. If in value is not in [0, 1] range an error is returned.

func (ResourceLimit) Generate

func (ResourceLimit) Generate(rand *rand.Rand, size int) reflect.Value

Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package

func (*ResourceLimit) UnmarshalJSON

func (rl *ResourceLimit) UnmarshalJSON(data []byte) error

UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.

type ResourceLimits

type ResourceLimits map[ResourceName]ResourceLimit

func NewResourceLimits

func NewResourceLimits(in map[string]float64) (ResourceLimits, error)

NewResourceLimits return ResourceLimits using the value of in. If any of the map values is not successfully converted to ResourceLimit an error is returned.

type ResourceName

type ResourceName string
const (
	ResourceNameCPU    ResourceName = "cpu"
	ResourceNameMemory ResourceName = "memory"
)

func NewResourceName

func NewResourceName(in string) (ResourceName, error)

NewResourceName return ResourceName using the value of in. If in value is not one of: "cpu", "memory" an error is returned.

func (ResourceName) Generate

func (ResourceName) Generate(rand *rand.Rand, size int) reflect.Value

Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package

func (*ResourceName) UnmarshalJSON

func (rn *ResourceName) UnmarshalJSON(data []byte) error

UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.

type UncordonAPI added in v0.9.8

type UncordonAPI func(string) error

func Uncordon added in v0.9.8

func Uncordon(getConnectionDetails client.ConnectionDetails) UncordonAPI

type UpdateAPI

type UpdateAPI func(queue Queue) error

func Update

func Update(getConnectionDetails client.ConnectionDetails) UpdateAPI

Jump to

Keyboard shortcuts

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