-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add spread strategy and make it the default #458
Conversation
@jhamrick & @aluzzardi can you please take a look ? |
assert.NoError(t, err) | ||
assert.NoError(t, AddContainer(node3, createContainer("c3", config))) | ||
|
||
// check that it ends up on the same node as the 3G |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment should be "same node as the 2G", otherwise it doesn't match the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I updated.
👍 thanks, this looks awesome! |
@vieux is |
return nil, err | ||
} | ||
|
||
// sort by highest weight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment seems contradicting (sort.Sort(sort.Reverse(foo))
sorts in reverse order, which would be by lowest weight)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the same comment as in your PR https://github.com/docker/swarm/pull/398/files
If it's not clear, even for you, we have an issue :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. sort.Sort sorts low to high... sorry, forgot my daily dose of ☕ this morning.
👍 considering that this scheduling strategy has been proposed at least 3 times now it sounds like users want this feature :) |
Signed-off-by: Victor Vieux <[email protected]>
@@ -28,3 +31,39 @@ func (n weightedNodeList) Less(i, j int) bool { | |||
|
|||
return ip.Weight < jp.Weight | |||
} | |||
|
|||
func weighNodes(config *dockerclient.ContainerConfig, nodes []cluster.Node) (weightedNodeList, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: weightNodes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #458 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D
LGTM |
Add spread strategy and make it the default
Signed-off-by: Victor Vieux [email protected]