func()

in pkg/scheduler/objects/queue.go [323:381]


func (sq *Queue) applyConf(conf configs.QueueConfig, silence bool) error {
	// Set the ACLs
	var err error
	sq.submitACL, err = security.NewACL(conf.SubmitACL, silence)
	if err != nil {
		log.Log(log.SchedQueue).Error("parsing submit ACL failed this should not happen",
			zap.Error(err))
		return err
	}
	sq.adminACL, err = security.NewACL(conf.AdminACL, silence)
	if err != nil {
		log.Log(log.SchedQueue).Error("parsing admin ACL failed this should not happen",
			zap.Error(err))
		return err
	}
	// Change from unmanaged to managed
	if !sq.isManaged {
		log.Log(log.SchedQueue).Info("changed dynamic queue to managed",
			zap.String("queue", sq.QueuePath))
		sq.isManaged = true
	}

	// if the queue is marked for removal reverse that state
	if !sq.IsRunning() {
		err = sq.handleQueueEvent(Start)
		if err != nil {
			log.Log(log.SchedQueue).Info("managed queue state change failed",
				zap.String("queue", sq.QueuePath))
		}
	}
	prevLeaf := sq.isLeaf
	sq.isLeaf = !conf.Parent
	// Make sure the parent flag is set correctly: config might expect auto parent type creation
	if len(conf.Queues) > 0 {
		sq.isLeaf = false
	}

	if prevLeaf != sq.isLeaf && sq.queueEvents != nil {
		sq.queueEvents.SendTypeChangedEvent(sq.QueuePath, sq.isLeaf)
	}

	if !sq.isLeaf {
		if err = sq.setTemplate(conf.ChildTemplate); err != nil {
			return err
		}
	}

	// Load the max & guaranteed resources and maxApps for all but the root queue
	if sq.Name != configs.RootQueue {
		if err = sq.setResourcesFromConf(conf.Resources); err != nil {
			return err
		}
		sq.maxRunningApps = conf.MaxApplications
		sq.updateMaxRunningAppsMetrics()
	}

	sq.properties = conf.Properties
	return nil
}