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 2022/03/17 06:35:50 UTC

[GitHub] [incubator-yunikorn-web] akhilpb001 commented on a change in pull request #70: [YUNIKORN-955] Move the web UI calls to the new REST API endpoints

akhilpb001 commented on a change in pull request #70:
URL: https://github.com/apache/incubator-yunikorn-web/pull/70#discussion_r828794601



##########
File path: src/app/services/scheduler/scheduler.service.ts
##########
@@ -167,68 +174,66 @@ export class SchedulerService {
     );
   }
 
-  public fetchNodeList(): Observable<NodeInfo[]> {
-    const nodesUrl = `${this.envConfig.getSchedulerWebAddress()}/ws/v1/nodes`;
+  fetchNodeList(partitionName: string): Observable<NodeInfo[]> {
+    const nodesUrl = `${this.envConfig.getSchedulerWebAddress()}/ws/v1/partition/${partitionName}/nodes`;
 
     return this.httpClient.get(nodesUrl).pipe(
       map((data: any) => {
         const result = [];
 
         if (data && data.length > 0) {
-          for (const info of data) {
-            const nodesInfoData = info.nodesInfo || [];
-
-            nodesInfoData.forEach(node => {
-              const nodeInfo = new NodeInfo(
-                node['nodeID'],
-                node['hostName'],
-                node['rackName'],
-                info['partitionName'],
-                this.formatCapacity(this.splitCapacity(node['capacity'], NOT_AVAILABLE)),
-                this.formatCapacity(this.splitCapacity(node['allocated'], NOT_AVAILABLE)),
-                this.formatCapacity(this.splitCapacity(node['occupied'], NOT_AVAILABLE)),
-                this.formatCapacity(this.splitCapacity(node['available'], NOT_AVAILABLE)),
-                []
-              );
-
-              const allocations = node['allocations'];
-              if (allocations && allocations.length > 0) {
-                const appAllocations = [];
-
-                allocations.forEach(alloc => {
-                  if (
-                    alloc.allocationTags &&
-                    alloc.allocationTags['kubernetes.io/meta/namespace'] &&
-                    alloc.allocationTags['kubernetes.io/meta/podName']
-                  ) {
-                    alloc[
-                      'displayName'
-                    ] = `${alloc.allocationTags['kubernetes.io/meta/namespace']}/${alloc.allocationTags['kubernetes.io/meta/podName']}`;
-                  } else {
-                    alloc['displayName'] = '<nil>';
-                  }
-                  appAllocations.push(
-                    new AllocationInfo(
-                      alloc['displayName'],
-                      alloc['allocationKey'],
-                      alloc['allocationTags'],
-                      alloc['uuid'],
-                      this.formatCapacity(this.splitCapacity(alloc['resource'], NOT_AVAILABLE)),
-                      alloc['priority'],
-                      alloc['queueName'],
-                      alloc['nodeId'],
-                      alloc['applicationId'],
-                      alloc['partition']
-                    )
-                  );
-                });
-
-                nodeInfo.setAllocations(appAllocations);
-              }
-
-              result.push(nodeInfo);
-            });
-          }
+          data.forEach(node => {
+            const nodeInfo = new NodeInfo(
+              node['nodeID'],
+              node['hostName'],
+              node['rackName'],
+              node['partition'] || NOT_AVAILABLE,

Review comment:
       This is the new nodes API response I got from Wilfred.
   ```
    {
         "nodeID": "node-1",
         "hostName": "",
         "rackName": "",
         "capacity": "[memory:1000 vcore:1000]",
         "allocated": "[memory:500 vcore:300]",
         "occupied": "[]",
         "available": "[memory:500 vcore:700]",
         "utilized": "[memory:50 vcore:30]",
         "allocations": [
           {
             "allocationKey": "alloc-1",
             "allocationTags": null,
             "uuid": "alloc-1-uuid",
             "resource": "[memory:500 vcore:300]",
             "priority": "0",
             "queueName": "root.default",
             "nodeId": "node-1",
             "applicationId": "app1",
             "partition": ""
           }
         ],
         "schedulable": true
       }
   ```




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