Peter Bacsko created YUNIKORN-2245:
--------------------------------------

             Summary: Application sorting: improve pending resource filtering
                 Key: YUNIKORN-2245
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-2245
             Project: Apache YuniKorn
          Issue Type: Sub-task
          Components: core - scheduler
            Reporter: Peter Bacsko


When sorting applications, we do a filtering on pending resources:

{noformat}
func filterOnPendingResources(apps map[string]*Application) []*Application {
        filteredApps := make([]*Application, 0)
        for _, app := range apps {
                // Only look at app when pending-res > 0
                if resources.StrictlyGreaterThanZero(app.GetPendingResource()) {
                        filteredApps = append(filteredApps, app)
                }
        }
        return filteredApps
}
{noformat}

This filtering is expensive. When an application has no pending resource, it's 
immediately transitioning to Completing status:

{noformat}
        if resources.IsZero(sa.pending) && 
resources.IsZero(sa.allocatedResource) && !sa.IsFailing() && !sa.IsCompleting() 
&& !hasPlaceHolderAllocations {
                if err := sa.HandleApplicationEvent(CompleteApplication); err 
!= nil {
                        log.Log(log.SchedApplication).Warn("Application state 
not changed to Completing while updating ask(s)",
                                zap.String("currentState", sa.CurrentState()),
                                zap.Error(err))
                }
        }
{noformat}

Therefore, it makes much more sense to perform filtering based on application 
state.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to