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


##########
pkg/webservice/handlers.go:
##########
@@ -619,6 +625,57 @@ func getQueueApplications(w http.ResponseWriter, r 
*http.Request) {
        }
 }
 
+func getPartitionApplicationIDsByState(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("partition")
+       appState := vars.ByName("state")
+
+       partitionContext := 
schedulerContext.GetPartitionWithoutClusterID(partition)
+       if partitionContext == nil {
+               buildJSONErrorResponse(w, PartitionDoesNotExists, 
http.StatusNotFound)
+               return
+       }
+       if !allowedAppStates[appState] {
+               buildJSONErrorResponse(w, "Application state is not allowed: 
"+appState, http.StatusBadRequest)
+               return
+       }
+       appIDs := partitionContext.GetAppIDsByState(appState)

Review Comment:
   Yes that's the idea, something like that. Just avoid the double filtering 
which is error prone. Make a decision at one place and the right place is here, 
the handler method.



-- 
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