pbacsko commented on code in PR #750:
URL: https://github.com/apache/yunikorn-core/pull/750#discussion_r1436540250


##########
pkg/webservice/handlers.go:
##########
@@ -629,22 +715,27 @@ func getApplication(w http.ResponseWriter, r 
*http.Request) {
        partition := vars.ByName("partition")
        queueName := vars.ByName("queue")
        application := vars.ByName("application")
-       queueErr := validateQueue(queueName)
-       if queueErr != nil {
-               buildJSONErrorResponse(w, queueErr.Error(), 
http.StatusBadRequest)
-               return
-       }
        partitionContext := 
schedulerContext.GetPartitionWithoutClusterID(partition)
        if partitionContext == nil {
                buildJSONErrorResponse(w, PartitionDoesNotExists, 
http.StatusNotFound)
                return
        }
-       queue := partitionContext.GetQueue(queueName)
-       if queue == nil {
-               buildJSONErrorResponse(w, QueueDoesNotExists, 
http.StatusNotFound)
-               return
+       var app *objects.Application
+       if len(queueName) == 0 {
+               app = partitionContext.GetApplication(application)
+       } else {
+               queueErr := validateQueue(queueName)
+               if queueErr != nil {
+                       buildJSONErrorResponse(w, queueErr.Error(), 
http.StatusBadRequest)
+                       return
+               }

Review Comment:
   Please add coverage to this branch.



##########
pkg/webservice/handlers.go:
##########
@@ -619,6 +654,57 @@ func getQueueApplications(w http.ResponseWriter, r 
*http.Request) {
        }
 }
 
+func getPartitionApplicationsByState(w http.ResponseWriter, r *http.Request) {
+       writeHeaders(w)
+       vars := httprouter.ParamsFromContext(r.Context())
+       if vars == nil {
+               buildJSONErrorResponse(w, MissingParamsName, 
http.StatusBadRequest)
+               return
+       }
+       partition := vars.ByName(strings.ToLower("partition"))
+       appState := vars.ByName(strings.ToLower("state"))

Review Comment:
   Partitions are case-sensitive, so drop that.
   For `appState`, the proper approach is:
   ```
   appState := strings.ToLower(vars.ByName("state"))
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to