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


##########
pkg/webservice/handlers.go:
##########
@@ -60,6 +60,12 @@ const (
        NodeDoesNotExists        = "Node not found"
 )
 
+var allowedAppStates = map[string]bool{

Review Comment:
   Pardon me, why only partial states are allowed?



##########
pkg/webservice/dao/application_info.go:
##########
@@ -56,3 +56,7 @@ type PlaceholderDAOInfo struct {
        Replaced      int64            `json:"replaced,omitempty"`
        TimedOut      int64            `json:"timedout,omitempty"`
 }
+
+type ApplicationIDsDAOInfo struct {
+       AppIDs []string

Review Comment:
   Does it need json tag?



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

Review Comment:
   It seems to me listing the allowed states is more meaningful to users.



##########
pkg/scheduler/partition.go:
##########
@@ -425,6 +425,10 @@ func (pc *PartitionContext) removeAppInternal(appID 
string) *objects.Application
        return app
 }
 
+func (pc *PartitionContext) GetApplication(appID string) *objects.Application {

Review Comment:
   this exposed method should get lock (`pc.RLock()`/`defer pc.RUnlock()`), and 
the internal method should be unlocked version.



##########
pkg/webservice/dao/application_info.go:
##########
@@ -56,3 +56,7 @@ type PlaceholderDAOInfo struct {
        Replaced      int64            `json:"replaced,omitempty"`
        TimedOut      int64            `json:"timedout,omitempty"`
 }
+
+type ApplicationIDsDAOInfo struct {
+       AppIDs []string

Review Comment:
   For another, other responses name the id-related field "applicationId". 
Should we keep the consistency?



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