wilfred-s commented on code in PR #463:
URL: https://github.com/apache/yunikorn-core/pull/463#discussion_r1038166217
##########
pkg/scheduler/partition.go:
##########
@@ -1433,6 +1445,13 @@ func (pc *PartitionContext) cleanupExpiredApps() {
delete(pc.rejectedApplications, app.ApplicationID)
pc.Unlock()
}
+ for k, app := range
pc.GetCompletedAppsByState(objects.Expired.String()) {
+ pc.Lock()
+ if app.IsExpired() {
Review Comment:
the list is already filtered no need to check again.
##########
pkg/scheduler/partition.go:
##########
@@ -1433,6 +1445,13 @@ func (pc *PartitionContext) cleanupExpiredApps() {
delete(pc.rejectedApplications, app.ApplicationID)
pc.Unlock()
}
+ for k, app := range
pc.GetCompletedAppsByState(objects.Expired.String()) {
Review Comment:
you are not using app, should be a _
##########
pkg/scheduler/partition_test.go:
##########
@@ -1681,39 +1698,62 @@ func TestCompleteApp(t *testing.T) {
assert.Assert(t, len(partition.applications) == 1, "the partition
should have 1 app")
assert.Assert(t, len(partition.completedApplications) == 0, "the
partition should not have any completed apps")
// complete the application
- err = app.HandleApplicationEvent(objects.CompleteApplication)
- assert.NilError(t, err, "no error expected while transitioning the app
from waiting to completed state")
- err = common.WaitFor(10*time.Millisecond,
time.Duration(1000)*time.Millisecond, func() bool {
- partition.RLock()
- defer partition.RUnlock()
- return len(partition.completedApplications) > 0
- })
+ err = completeApplicationAndWait(app, partition)
assert.NilError(t, err, "the completed application should have been
processed")
assert.Assert(t, len(partition.applications) == 0, "the partition
should have no active app")
assert.Assert(t, len(partition.completedApplications) == 1, "the
partition should have 1 completed app")
}
+func TestCleanupApp(t *testing.T) {
Review Comment:
This should be called `TestCleanupFailedApps()` Those are the only ones that
could be in the applications map with an expired state.
--
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]