wilfred-s commented on a change in pull request #328:
URL:
https://github.com/apache/incubator-yunikorn-core/pull/328#discussion_r817957792
##########
File path: pkg/scheduler/objects/application.go
##########
@@ -1193,6 +1202,19 @@ func (sa *Application) UnSetQueue() {
sa.Lock()
defer sa.Unlock()
sa.queue = nil
+ now := time.Now()
+ sa.finishedTime = &now
+}
+
+// FinishedTimeInUnixNano return the finished time if this application is
terminated. Otherwise, it returns null
+func (sa *Application) FinishedTimeInUnixNano() *int64 {
Review comment:
We might want to support this for other time values also.
Can we generalise this into a utility function? Bases on a time object and
use time.IsZero():
```
func ZeroTimeInUnixNano(t time.Time) *int64 {
if t.IsZero() {
return nil
}
tInt := t.UnixNano()
return &tInt
}
```
##########
File path: pkg/scheduler/objects/application.go
##########
@@ -1193,6 +1202,19 @@ func (sa *Application) UnSetQueue() {
sa.Lock()
defer sa.Unlock()
sa.queue = nil
+ now := time.Now()
+ sa.finishedTime = &now
Review comment:
we should leverage IsZero() for unset time.
--
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]