This is an automated email from the ASF dual-hosted git repository.

ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-web.git


The following commit(s) were added to refs/heads/master by this push:
     new 07f6cff  [YUNIKORN-1924] Last time app changed is always n/a (#133)
07f6cff is described below

commit 07f6cff131837a1c8b97c1c51d8e12fb636d2b58
Author: wusamzong <[email protected]>
AuthorDate: Thu Aug 24 13:55:52 2023 -0500

    [YUNIKORN-1924] Last time app changed is always n/a (#133)
    
    Closes: #133
    
    Signed-off-by: Craig Condit <[email protected]>
---
 .../components/apps-view/apps-view.component.html  |  4 ++++
 src/app/models/app-info.model.ts                   | 26 ++++++++++++++++++++++
 src/app/services/scheduler/scheduler.service.ts    |  3 +++
 3 files changed, 33 insertions(+)

diff --git a/src/app/components/apps-view/apps-view.component.html 
b/src/app/components/apps-view/apps-view.component.html
index 8b34045..631634e 100644
--- a/src/app/components/apps-view/apps-view.component.html
+++ b/src/app/components/apps-view/apps-view.component.html
@@ -70,6 +70,10 @@
           <mat-cell *matCellDef="let element">{{ 
element['formattedSubmissionTime'] }}</mat-cell>
         </ng-container>
 
+        <ng-container *ngIf="columnDef.colId === 'lastStateChangeTime'; else 
renderNext_1">
+          <mat-cell *matCellDef="let element">{{ 
element['formattedlastStateChangeTime'] }}</mat-cell>
+        </ng-container>
+
         <ng-template #renderNext_1>
           <ng-container *ngIf="columnDef.colId === 'usedResource'; else 
renderNext_1">
             <mat-cell *matCellDef="let element">
diff --git a/src/app/models/app-info.model.ts b/src/app/models/app-info.model.ts
index 4c56fa6..9f47e9b 100644
--- a/src/app/models/app-info.model.ts
+++ b/src/app/models/app-info.model.ts
@@ -31,6 +31,7 @@ export class AppInfo {
     public queueName: string,
     public submissionTime: number,
     public finishedTime: null | number,
+    public stateLog: Array<StateLog>,
     public lastStateChangeTime: null | number,
     public applicationState: string,
     public allocations: AllocationInfo[] | null
@@ -41,6 +42,14 @@ export class AppInfo {
     return moment(millisecs).format('YYYY/MM/DD HH:mm:ss');
   }
 
+  get formattedlastStateChangeTime() {
+    if(this.lastStateChangeTime==null){
+      return 'n/a'
+    }
+    const millisecs = Math.round(this.lastStateChangeTime! / (1000 * 1000));
+    return moment(millisecs).format('YYYY/MM/DD HH:mm:ss');
+  }
+
   get formattedFinishedTime() {
     if (this.finishedTime) {
       const millisecs = Math.round(this.finishedTime / (1000 * 1000));
@@ -53,4 +62,21 @@ export class AppInfo {
   setAllocations(allocs: AllocationInfo[]) {
     this.allocations = allocs;
   }
+
+  setLastStateChangeTime() {
+    let time=0
+    this.stateLog.forEach(log => {
+      if (log.time>time){
+        time=log.time
+      }
+    });
+    this.lastStateChangeTime=time
+  }
+}
+
+export class StateLog{
+  constructor(
+    public time: number,
+    public applicationState: string
+  ) {}
 }
diff --git a/src/app/services/scheduler/scheduler.service.ts 
b/src/app/services/scheduler/scheduler.service.ts
index 25c81be..edd6759 100644
--- a/src/app/services/scheduler/scheduler.service.ts
+++ b/src/app/services/scheduler/scheduler.service.ts
@@ -96,10 +96,13 @@ export class SchedulerService {
               app['queueName'],
               app['submissionTime'],
               app['lastStateChangeTime'],
+              app['stateLog'],
               app['finishedTime'],
               app['applicationState'],
               []
             );
+            appInfo.setLastStateChangeTime()
+            
             const allocations = app['allocations'];
             if (allocations && allocations.length > 0) {
               const appAllocations: AllocationInfo[] = [];


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to