wilfred-s commented on a change in pull request #296:
URL:
https://github.com/apache/incubator-yunikorn-core/pull/296#discussion_r688209830
##########
File path: pkg/scheduler/objects/queue.go
##########
@@ -142,15 +144,26 @@ func NewDynamicQueue(name string, leaf bool, parent
*Queue) (*Queue, error) {
if err != nil {
return nil, fmt.Errorf("dynamic queue creation failed: %s", err)
}
- // pull the properties from the parent that should be set on the child
- sq.setTemplateProperties(parent.getProperties())
+
+ sq.applyTemplate(lookupTemplate(parent))
Review comment:
At that point we go through `addChildQueue()` we know all about the
type: parent or leaf, managed or dynamic.
Until we get back from the `addChildQueue()` call the child is unreachable
and we do not need a lock on it. As soon as we're back we *should*. We
currently do not do that as setting the template properties as it is now was
supposed to be a real short term solution...
The parent queue is locked in `addChildQueue()` and we can handle all cases
in one go:
* if parent queue: inherit the template from parent to parent.
* if leaf and dynamic: set the properties as needed
The inheritance should be as simple as this inside the `addChildQueue()`
before we add the child to the map as the last action:
```
if child.isLeaf {
if !child.isManaged {
child.applyTemplate(sq.template)
}
} else {
child.template = sq.template
}
```
--
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]