{"action":"created","issue":{"url":"https://api.github.com/repos/buildbot/buildbot/issues/1723","labels_url":"https://api.github.com/repos/buildbot/buildbot/issues/1723/labels{/name}","comments_url":"https://api.github.com/repos/buildbot/buildbot/issues/1723/comments","events_url":"https://api.github.com/repos/buildbot/buildbot/issues/1723/events","html_url":"https://github.com/buildbot/buildbot/pull/1723","id":88426856,"number":1723,"title":"nextSlave can choose slave according to ``build request``","user":{"login":"nam4dev","id":7503440,"avatar_url":"https://avatars.githubusercontent.com/u/7503440?v=3","gravatar_id":"","url":"https://api.github.com/users/nam4dev","html_url":"https://github.com/nam4dev","followers_url":"https://api.github.com/users/nam4dev/followers","following_url":"https://api.github.com/users/nam4dev/following{/other_user}","gists_url":"https://api.github.com/users/nam4dev/gists{/gist_id}","starred_url":"https://api.github.com/users/nam4dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nam4dev/subscriptions","organizations_url":"https://api.github.com/users/nam4dev/orgs","repos_url":"https://api.github.com/users/nam4dev/repos","events_url":"https://api.github.com/users/nam4dev/events{/privacy}","received_events_url":"https://api.github.com/users/nam4dev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/buildbot/buildbot/labels/needs%20more%20review","name":"needs more review","color":"bfe5bf"},{"url":"https://api.github.com/repos/buildbot/buildbot/labels/needs%20work","name":"needs work","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-15T13:26:25Z","updated_at":"2015-06-15T16:43:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/buildbot/buildbot/pulls/1723","html_url":"https://github.com/buildbot/buildbot/pull/1723","diff_url":"https://github.com/buildbot/buildbot/pull/1723.diff","patch_url":"https://github.com/buildbot/buildbot/pull/1723.patch"},"body":"**Tracked on**: http://trac.buildbot.net/ticket/3275 \r\n\r\nFor now, I use ``canStartBuild`` method, which is called for **each slave**.\r\n\r\nWhat I need is to be able to select slaves according ``Build Request`` instance in the ``nextSlave`` method **to filter at once all candidates**.\r\n\r\nIt seems to me a better and cleaner solution than using ``canStartBuild``, as for a large amount of slaves it may impact performances.\r\n\r\n*I committed on my branch, a proposal, maybe not the best way to implement it*. \r\n*I stay opened to your suggestions...*\r\n\r\nSeen with @jaredgrubb: \" **functors** (as currently used) might not be a good solution...\""},"comment":{"url":"https://api.github.com/repos/buildbot/buildbot/issues/comments/112131868","html_url":"https://github.com/buildbot/buildbot/pull/1723#issuecomment-112131868","issue_url":"https://api.github.com/repos/buildbot/buildbot/issues/1723","id":112131868,"user":{"login":"sa2ajj","id":447092,"avatar_url":"https://avatars.githubusercontent.com/u/447092?v=3","gravatar_id":"","url":"https://api.github.com/users/sa2ajj","html_url":"https://github.com/sa2ajj","followers_url":"https://api.github.com/users/sa2ajj/followers","following_url":"https://api.github.com/users/sa2ajj/following{/other_user}","gists_url":"https://api.github.com/users/sa2ajj/gists{/gist_id}","starred_url":"https://api.github.com/users/sa2ajj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sa2ajj/subscriptions","organizations_url":"https://api.github.com/users/sa2ajj/orgs","repos_url":"https://api.github.com/users/sa2ajj/repos","events_url":"https://api.github.com/users/sa2ajj/events{/privacy}","received_events_url":"https://api.github.com/users/sa2ajj/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T16:43:13Z","updated_at":"2015-06-15T16:43:13Z","body":"Looks like some work is required:\r\n\r\n```\r\n[FAIL]\r\nTraceback (most recent call last):\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/internet/defer.py\", line 1039, in _inlineCallbacks\r\n    result = g.send(result)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 411, in do_test_maybeStartBuildsOnBuilder\r\n    self.assertBuildsStarted(exp_builds)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 400, in assertBuildsStarted\r\n    self.assertEqual(builds_started, exp)\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/trial/unittest.py\", line 270, in assertEqual\r\n    % (msg, pformat(first), pformat(second)))\r\ntwisted.trial.unittest.FailTest: not equal:\r\na = []\r\nb = [('test-slave2', [10]), ('test-slave1', [11])]\r\n\r\n\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_bldr_maybeStartBuild_fails_always\r\n===============================================================================\r\n[FAIL]\r\nTraceback (most recent call last):\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/internet/defer.py\", line 1039, in _inlineCallbacks\r\n    result = g.send(result)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 673, in test_bldr_maybeStartBuild_fails_once\r\n    self.assertMyClaims([11])  # reclaimed so none taken!\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 152, in assertMyClaims\r\n    set(brids))\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/trial/unittest.py\", line 270, in assertEqual\r\n    % (msg, pformat(first), pformat(second)))\r\ntwisted.trial.unittest.FailTest: not equal:\r\na = set()\r\nb = set([11])\r\n\r\n\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_bldr_maybeStartBuild_fails_once\r\n===============================================================================\r\n[FAIL]\r\nTraceback (most recent call last):\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/internet/defer.py\", line 1039, in _inlineCallbacks\r\n    result = g.send(result)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 410, in do_test_maybeStartBuildsOnBuilder\r\n    self.assertMyClaims(exp_claims)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 152, in assertMyClaims\r\n    set(brids))\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/trial/unittest.py\", line 270, in assertEqual\r\n    % (msg, pformat(first), pformat(second)))\r\ntwisted.trial.unittest.FailTest: not equal:\r\na = set()\r\nb = set([11])\r\n\r\n\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_claim_race\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_limited_by_requests\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_nextSlave_deferred\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_nextSlave_simple\r\n===============================================================================\r\n[FAIL]\r\nTraceback (most recent call last):\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/internet/defer.py\", line 1039, in _inlineCallbacks\r\n    result = g.send(result)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 410, in do_test_maybeStartBuildsOnBuilder\r\n    self.assertMyClaims(exp_claims)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 152, in assertMyClaims\r\n    set(brids))\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/trial/unittest.py\", line 270, in assertEqual\r\n    % (msg, pformat(first), pformat(second)))\r\ntwisted.trial.unittest.FailTest: not equal:\r\na = set()\r\nb = set([10, 11])\r\n\r\n\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_limited_by_canStartBuild\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_limited_by_canStartWithSlavebuilder\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_unlimited\r\n===============================================================================\r\n[FAIL]\r\nTraceback (most recent call last):\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/internet/defer.py\", line 1039, in _inlineCallbacks\r\n    result = g.send(result)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 410, in do_test_maybeStartBuildsOnBuilder\r\n    self.assertMyClaims(exp_claims)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 152, in assertMyClaims\r\n    set(brids))\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/trial/unittest.py\", line 270, in assertEqual\r\n    % (msg, pformat(first), pformat(second)))\r\ntwisted.trial.unittest.FailTest: not equal:\r\na = set()\r\nb = set([10])\r\n\r\n\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_limited_by_canStartBuild_deferreds\r\n===============================================================================\r\n[FAIL]\r\nTraceback (most recent call last):\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/internet/defer.py\", line 1039, in _inlineCallbacks\r\n    result = g.send(result)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 410, in do_test_maybeStartBuildsOnBuilder\r\n    self.assertMyClaims(exp_claims)\r\n  File \"/home/travis/build/buildbot/buildbot/master/buildbot/test/unit/test_process_buildrequestdistributor.py\", line 152, in assertMyClaims\r\n    set(brids))\r\n  File \"/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/twisted/trial/unittest.py\", line 270, in assertEqual\r\n    % (msg, pformat(first), pformat(second)))\r\ntwisted.trial.unittest.FailTest: not equal:\r\na = set()\r\nb = set([10, 11, 12, 13])\r\n\r\n\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_nextBuild_default\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_nextBuild_deferred\r\nbuildbot.test.unit.test_process_buildrequestdistributor.TestMaybeStartBuilds.test_nextBuild_simple\r\n```"}}