You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2021/08/16 04:53:53 UTC

[GitHub] [incubator-yunikorn-core] manirajv06 commented on a change in pull request #303: YUNIKORN-798 the REST APIs of getting queue application returns "Queu…

manirajv06 commented on a change in pull request #303:
URL: https://github.com/apache/incubator-yunikorn-core/pull/303#discussion_r689109388



##########
File path: pkg/webservice/handlers.go
##########
@@ -687,28 +687,25 @@ func getQueueApplications(w http.ResponseWriter, r *http.Request) {
 		buildJSONErrorResponse(w, "Incorrect URL path. Please check the usage documentation", http.StatusBadRequest)
 		return
 	}
-	var appExistsInPartition = false
-	var appExistsInQueue = false
-	var appsDao []*dao.ApplicationDAOInfo
+
 	partitionContext := schedulerContext.GetPartitionWithoutClusterID(partition)
-	if partitionContext != nil {
-		appExistsInPartition = true
-		appList := partitionContext.GetApplications()
-		for _, app := range appList {
-			if strings.EqualFold(queueName, app.GetQueueName()) {
-				appExistsInQueue = true
-				appsDao = append(appsDao, getApplicationJSON(app))
-			}
-		}
-	}
-	if !appExistsInPartition {
+	if partitionContext == nil {
 		buildJSONErrorResponse(w, "Partition not found", http.StatusBadRequest)
 		return
 	}
-	if !appExistsInQueue {
+
+	queue := partitionContext.GetQueue(queueName)
+	if queue == nil {
 		buildJSONErrorResponse(w, "Queue not found", http.StatusBadRequest)
 		return
 	}
+
+	apps := queue.GetCopyOfApps()
+	appsDao := make([]*dao.ApplicationDAOInfo, 0, len(apps))
+	for _, app := range apps {
+		appsDao = append(appsDao, getApplicationJSON(app))
+	}
+

Review comment:
       Earlier, "No application" in queue case has been taken care though with misleading error message. 
   Should we return appropriate json error response something like "No applications.." etc when appsDao is empty? Probably, it can happen with newly created queue. Otherwise, clients has to take care accordingly.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org