common

package
v1.0.0-2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareQueueMap

func CompareQueueMap(a map[string]interface{}, b map[string]interface{}) (bool, error)

Takes 2 restClient responses with queue information, and checks if they are the same by

  1. Validates queue name is same
  2. Validates qA and qB have same number of sub-queues 3a. If same queue name and 0 sub-queues, return true 3b. Otherwise, call CompareQueueMap on each child pairing of qA and qB

func CreateLogFile

func CreateLogFile(filename string, data []byte) error

CreateLogFile creates the ReportDirectory if it is not present, writes the given testdata to the given filename.

func CreateReportDirectory

func CreateReportDirectory() (string, error)

CreateReportDirectory creates and returns the directory path If the directory cannot be created it'll return an error

func GetAbsPath

func GetAbsPath(p string) (string, error)

func GetFileContents

func GetFileContents(filename string) ([]byte, error)

func GetSubQueues

func GetSubQueues(q map[string]interface{}) ([]map[string]interface{}, error)

Returns a list of the children Q's of input. If no children, returns nil

func GetTestName

func GetTestName() string

GetTestName returns the test Name in a single string without spaces or /

func GetUUID

func GetUUID() string

func InitSleepPod

func InitSleepPod(conf SleepPodConfig) *v1.Pod

TestPodConfig template for sleepPods

func InitTestPod

func InitTestPod(conf TestPodConfig) *v1.Pod

func RandSeq

func RandSeq(n int) string

func ReportDirectoryPath

func ReportDirectoryPath() string

ReportDirectoryPath determines the directory path.

func SliceExists

func SliceExists(slice interface{}, item interface{}) (bool, error)

func Y2Map

func Y2Map(yamlPath string) (map[interface{}]interface{}, error)

func Yaml2Obj

func Yaml2Obj(yamlPath string) (runtime.Object, error)

Types

type LimitsConfigType

type LimitsConfigType struct {
	Limit           string         `yaml:",omitempty"`
	Users           []string       `yaml:",omitempty"`
	Groups          []string       `yaml:",omitempty"`
	MaxApplications int            `yaml:",omitempty"`
	MaxResources    map[string]int `yaml:",omitempty"`
}

type PartitionConfigType

type PartitionConfigType struct {
	Name   string
	Queues []*QueueConfigType `yaml:",omitempty"`

	//Optional args
	PlacementRules []*PlacementRuleConfigType `yaml:",omitempty"`
	Limits         LimitsConfigType           `yaml:",omitempty"`
	Preemption     bool                       `yaml:",omitempty"`
}

type PartitionsWrapper

type PartitionsWrapper struct {
	Partitions []*PartitionConfigType
}

Holds all partitions

func CreateBasicConfigMap

func CreateBasicConfigMap() *PartitionsWrapper

func (*PartitionsWrapper) AddQueue

func (pw *PartitionsWrapper) AddQueue(partition string, parentPathStr string, newQ *QueueConfigType) error

func (*PartitionsWrapper) SetSchedulingPolicy

func (pw *PartitionsWrapper) SetSchedulingPolicy(partition string, queuePathStr string, policy string) error

Expects queuePath to use periods as delimiters. ie "root.queueA.child"

func (*PartitionsWrapper) ToYAML

func (pw *PartitionsWrapper) ToYAML() (string, error)

Converts partitionsWrapper to YAML string

type PlacementRuleConfigType

type PlacementRuleConfigType struct {
	Name   string
	Create bool   `yaml:",omitempty"`
	Value  string `yaml:",omitempty"`

	// Add structs
	Parent string `yaml:",omitempty"`
	Filter string `yaml:",omitempty"`
}

type QueueConfigType

type QueueConfigType struct {
	Name       string
	Parent     bool               `yaml:",omitempty"`
	Queues     []*QueueConfigType `yaml:",omitempty"`
	Properties map[string]string  `yaml:",omitempty"`
	AdminACL   string             `yaml:",omitempty"`
	SubmitACL  string             `yaml:",omitempty"`
	Limits     *LimitsConfigType  `yaml:",omitempty"`

	// Add structs
	Resources string `yaml:",omitempty"`
}

type SleepPodConfig

type SleepPodConfig struct {
	Name  string
	NS    string
	AppID string
	Time  int
	CPU   int64
	Mem   int64
}

type TestPodConfig

type TestPodConfig struct {
	Name                              string
	Namespace                         string
	Affinity                          *v1.Affinity
	Annotations, Labels, NodeSelector map[string]string
	Resources                         *v1.ResourceRequirements
	RuntimeClassHandler               *string
	Tolerations                       []v1.Toleration
	NodeName                          string
	Ports                             []v1.ContainerPort
	OwnerReferences                   []metav1.OwnerReference
	PriorityClassName                 string
	DeletionGracePeriodSeconds        *int64
	TopologySpreadConstraints         []v1.TopologySpreadConstraint
	Image                             string
	RestartPolicy                     v1.RestartPolicy
	Command                           []string
}

Jump to

Keyboard shortcuts

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