Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YUNIKORN-2713] Use queue specific REST API directly #878

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/e2e/framework/configmanager/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
// REST endpoints of YuniKorn
PartitionsPath = "ws/v1/partitions"
QueuesPath = "ws/v1/partition/%s/queues"
QueuePath = "ws/v1/partition/%s/queue/%s"
AppsPath = "ws/v1/partition/%s/queue/%s/applications"
AppPath = "ws/v1/partition/%s/queue/%s/application/%s"
PartitionAppPath = "ws/v1/partition/%s/application/%s"
Expand Down
26 changes: 15 additions & 11 deletions test/e2e/framework/helpers/yunikorn/rest_api_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,30 +419,34 @@ func GetFailedHealthChecks() (string, error) {
return failCheck, nil
}

func (c *RClient) GetQueue(partition string, queueName string) (*dao.PartitionQueueDAOInfo, error) {
queues, err := c.GetQueues(partition)
func (c *RClient) GetQueue(partition string, queueName string, withChildren bool) (*dao.PartitionQueueDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.QueuePath, partition, queueName), nil)
if err != nil {
return nil, err
}
if queueName == "root" {
return queues, nil
if withChildren {
q := req.URL.Query()
q.Add("subtree", "true")
req.URL.RawQuery = q.Encode()
}

var allSubQueues = queues.Children
for _, subQ := range allSubQueues {
if subQ.QueueName == queueName {
return &subQ, nil
}
var queue *dao.PartitionQueueDAOInfo
_, err = c.do(req, &queue)
if err != nil {
return nil, err
}
if queue == nil {
return nil, fmt.Errorf("QueueInfo not found: %s", queueName)
}
return nil, fmt.Errorf("QueueInfo not found: %s", queueName)
return queue, nil
}

// ConditionFunc returns true if queue timestamp property equals ts
// Expects queuePath to use periods as delimiters. ie "root.queueA.child"
func compareQueueTS(queuePathStr string, ts string) wait.ConditionFunc {
return func() (bool, error) {
restClient := RClient{}
qInfo, err := restClient.GetQueue(DefaultPartition, queuePathStr)
qInfo, err := restClient.GetQueue(DefaultPartition, queuePathStr, false)
if err != nil {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gang_scheduling/gang_scheduling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ var _ = Describe("", func() {
}

// Verify queue resources = 0
qInfo, qErr := restClient.GetQueue(configmanager.DefaultPartition, nsQueue)
qInfo, qErr := restClient.GetQueue(configmanager.DefaultPartition, nsQueue, false)
Ω(qErr).NotTo(HaveOccurred())
var usedResource yunikorn.ResourceUsage
var usedPercentageResource yunikorn.ResourceUsage
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/queue_quota_mgmt/queue_quota_mgmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ var _ = Describe("", func() {
Ω(kClient.WaitForPodRunning(sleepRespPod.Namespace, sleepRespPod.Name, time.Duration(60)*time.Second)).NotTo(HaveOccurred())

// Verify that the resources requested by above sleep pod is accounted for in the queues response
queueInfo, err = restClient.GetQueue("default", "root."+ns)
queueInfo, err = restClient.GetQueue("default", "root."+ns, false)
Ω(err).NotTo(HaveOccurred())
Ω(queueInfo).NotTo(BeNil())
Ω(queueInfo.QueueName).Should(Equal("root." + ns))
Expand Down