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



##########
File path: pkg/webservice/handlers.go
##########
@@ -521,3 +521,39 @@ func updateConfiguration(conf string) (string, error) {
        }
        return "", fmt.Errorf("config plugin not found")
 }
+
+func getPartitions(w http.ResponseWriter, r *http.Request) {
+       writeHeaders(w)
+
+       var partitionsInfo []*dao.PartitionInfo
+       lists := schedulerContext.GetPartitionMapClone()
+       for _, partitionContext := range lists {
+               partitionInfo := &dao.PartitionInfo{}
+               partitionInfo.Name = partitionContext.Name
+               partitionInfo.State = partitionContext.StateMachine.Current()

Review comment:
       Taken care.

##########
File path: pkg/scheduler/partition.go
##########
@@ -54,13 +54,13 @@ type PartitionContext struct {
        allocations            map[string]*objects.Allocation  // allocations
        placementManager       *placement.AppPlacementManager  // placement 
manager for this partition
        partitionManager       *partitionManager               // manager for 
this partition
-       stateMachine           *fsm.FSM                        // the state of 
the partition for scheduling
-       stateTime              time.Time                       // last time the 
state was updated (needed for cleanup)
+       StateMachine           *fsm.FSM                        // the state of 
the partition for scheduling
+       StateTime              time.Time                       // last time the 
state was updated (needed for cleanup)
        isPreemptable          bool                            // can 
allocations be preempted
        rules                  *[]configs.PlacementRule        // placement 
rules to be loaded by the scheduler
        userGroupCache         *security.UserGroupCache        // user cache 
per partition
        totalPartitionResource *resources.Resource             // Total node 
resources
-       nodeSortingPolicy      *policies.NodeSortingPolicy     // Global Node 
Sorting Policies
+       NodeSortingPolicy      *policies.NodeSortingPolicy     // Global Node 
Sorting Policies

Review comment:
       Taken care.

##########
File path: pkg/webservice/dao/partition_info.go
##########
@@ -24,12 +24,29 @@ type PartitionDAOInfo struct {
        Queues        QueueDAOInfo      `json:"queues"`
 }
 
+type PartitionInfo struct {
+       Name                    string            `json:"name"`
+       Capacity                PartitionCapacity `json:"capacity"`
+       NodeSortingPolicy       string            `json:"nodeSortingPolicy"`
+       Applications            Applications      `json:"applications"`
+       State                   string            `json:"state"`
+       LastStateTransitionTime string            
`json:"lastStateTransitionTime"`
+}
+
 type PartitionCapacity struct {
        Capacity     string `json:"capacity"`
-       UsedCapacity string `json:"usedcapacity"`
+       UsedCapacity string `json:"usedCapacity"`
 }
 
 type NodeInfo struct {
        NodeID     string `json:"nodeId"`
        Capability string `json:"capability"`
 }
+
+type Applications struct {
+       Total     int `json:"total"`
+       Running   int `json:"running"`
+       Pending   int `json:"pending"`
+       Completed int `json:"completed"`
+       Failed    int `json:"failed"`

Review comment:
       I was trying to sum up certain states under common state. However, 
showing up each state count is also detailed enough. 

##########
File path: pkg/scheduler/partition.go
##########
@@ -1099,3 +1099,15 @@ func (pc *PartitionContext) removeAllocationAsk(appID 
string, allocationKey stri
                }
        }
 }
+
+func (pc *PartitionContext) GetCurrentState() string {
+       return pc.stateMachine.Current()
+}
+
+func (pc *PartitionContext) GetStateTime() time.Time {
+       return pc.stateTime
+}
+
+func (pc *PartitionContext) GetNodeSortingPolicy() *policies.NodeSortingPolicy 
{
+       return pc.nodeSortingPolicy
+}

Review comment:
       Taken care.




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

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


Reply via email to