volcano icon indicating copy to clipboard operation
volcano copied to clipboard

remove useless job valid check

Open lx1036 opened this issue 6 months ago • 3 comments

because ssn.Tiers is not initiated and plugins has not OnSessionOpen() to register callback to jobValidFns

in openSession() function, ssn.Tiers is not initiated, it's nil, and the plugins has not OnSessionOpen() to register callback to jobValidFns, tier.jobValidFns map is empty. so it's no need to check job valid at session initiation stage.

func (ssn *Session) JobValid(obj interface{}) *api.ValidateResult {
	for _, tier := range ssn.Tiers {
		for _, plugin := range tier.Plugins {
			jrf, found := ssn.jobValidFns[plugin.Name]
			if !found {
				continue
			}

			if vr := jrf(obj); vr != nil && !vr.Pass {
				return vr
			}
		}
	}

	return nil
}

lx1036 avatar Aug 05 '24 13:08 lx1036