{"action":"created","issue":{"url":"https://api.github.com/repos/docker/swarm/issues/253","labels_url":"https://api.github.com/repos/docker/swarm/issues/253/labels{/name}","comments_url":"https://api.github.com/repos/docker/swarm/issues/253/comments","events_url":"https://api.github.com/repos/docker/swarm/issues/253/events","html_url":"https://github.com/docker/swarm/issues/253","id":54716660,"number":253,"title":"Bugs in binpacking strategy","user":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/swarm/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"aluzzardi","id":179503,"avatar_url":"https://avatars.githubusercontent.com/u/179503?v=3","gravatar_id":"","url":"https://api.github.com/users/aluzzardi","html_url":"https://github.com/aluzzardi","followers_url":"https://api.github.com/users/aluzzardi/followers","following_url":"https://api.github.com/users/aluzzardi/following{/other_user}","gists_url":"https://api.github.com/users/aluzzardi/gists{/gist_id}","starred_url":"https://api.github.com/users/aluzzardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aluzzardi/subscriptions","organizations_url":"https://api.github.com/users/aluzzardi/orgs","repos_url":"https://api.github.com/users/aluzzardi/repos","events_url":"https://api.github.com/users/aluzzardi/events{/privacy}","received_events_url":"https://api.github.com/users/aluzzardi/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/docker/swarm/milestones/1","labels_url":"https://api.github.com/repos/docker/swarm/milestones/1/labels","id":942603,"number":1,"title":"Swarm Beta 0.1.0","description":"","creator":{"login":"vieux","id":1032519,"avatar_url":"https://avatars.githubusercontent.com/u/1032519?v=3","gravatar_id":"","url":"https://api.github.com/users/vieux","html_url":"https://github.com/vieux","followers_url":"https://api.github.com/users/vieux/followers","following_url":"https://api.github.com/users/vieux/following{/other_user}","gists_url":"https://api.github.com/users/vieux/gists{/gist_id}","starred_url":"https://api.github.com/users/vieux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vieux/subscriptions","organizations_url":"https://api.github.com/users/vieux/orgs","repos_url":"https://api.github.com/users/vieux/repos","events_url":"https://api.github.com/users/vieux/events{/privacy}","received_events_url":"https://api.github.com/users/vieux/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":51,"state":"open","created_at":"2015-01-19T21:08:33Z","updated_at":"2015-01-19T23:58:42Z","due_on":"2015-01-30T08:00:00Z","closed_at":null},"comments":7,"created_at":"2015-01-19T00:37:16Z","updated_at":"2015-01-20T00:51:03Z","closed_at":"2015-01-19T23:58:42Z","body":"Is the bin packing strategy supposed to choose the machine that has the most resources free, or the fewest resources free? Currently, it appears that it chooses the machine with the *fewest* free resources, I think due to the implementation of `Less`, which actually tests for greater: https://github.com/docker/swarm/blob/master/scheduler/strategy/binpacking.go#L81\r\n\r\nIf this is intentional, it might be good to add a comment clarifying that, or alternately just select the last element of the sorted list instead of the first (or use `sort.Reverse`).\r\n\r\nAdditionally, it seems that the `total` score is always zero. I think this is because dividing by 200 using integer division will always truncate to zero: https://github.com/docker/swarm/blob/master/scheduler/strategy/binpacking.go#L44 This line is equivalent to just dividing by 2; changing the code to do that seems to fix the problem."},"comment":{"url":"https://api.github.com/repos/docker/swarm/issues/comments/70586885","html_url":"https://github.com/docker/swarm/issues/253#issuecomment-70586885","issue_url":"https://api.github.com/repos/docker/swarm/issues/253","id":70586885,"user":{"login":"vieux","id":1032519,"avatar_url":"https://avatars.githubusercontent.com/u/1032519?v=3","gravatar_id":"","url":"https://api.github.com/users/vieux","html_url":"https://github.com/vieux","followers_url":"https://api.github.com/users/vieux/followers","following_url":"https://api.github.com/users/vieux/following{/other_user}","gists_url":"https://api.github.com/users/vieux/gists{/gist_id}","starred_url":"https://api.github.com/users/vieux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vieux/subscriptions","organizations_url":"https://api.github.com/users/vieux/orgs","repos_url":"https://api.github.com/users/vieux/repos","events_url":"https://api.github.com/users/vieux/events{/privacy}","received_events_url":"https://api.github.com/users/vieux/received_events","type":"User","site_admin":false},"created_at":"2015-01-20T00:51:03Z","updated_at":"2015-01-20T00:51:03Z","body":"@jhamrick feel free to add a test in `scheduler/strategy/binpacking_test.go` and make a PR so we understand what's wrong."}}