<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199332] trunk/Websites/perf.webkit.org</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199332">199332</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-11 20:18:16 -0700 (Mon, 11 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>New syncing script sometimes schedules a build request on a wrong builder
https://bugs.webkit.org/show_bug.cgi?id=156489
Reviewed by Stephanie Lewis.
The bug was caused by _scheduleNextRequestInGroupIfSlaveIsAvailable scheduling the next build request on
any available syncer regardless of whether the request is the first one in the test group or not because
BuildRequest.order was returning a string instead of a number.
Also fixed a bug that BuildbotTriggerable.syncOnce was re-ordering test groups by their id's instead of
respecting the order in which the perf dashboard returned.
* public/v3/models/build-request.js:
(BuildRequest.prototype.order): Force the order to be a number.
* server-tests/api-build-requests-tests.js: Assert the order as numbers.
* server-tests/resources/mock-data.js:
(MockData.addAnotherMockTestGroup): Changed the test group id to 601, which is after the first mock data.
The old number was masking a bug in BuildbotTriggerable that it was re-ordering test groups by their id's
instead of using the order set forth by the perf dashboard.
(MockData.mockTestSyncConfigWithSingleBuilder):
* server-tests/tools-buildbot-triggerable-tests.js: Added a test case for scheduling two build requests in
a single call to syncOnce. Each build request should be scheduled on the same builder as the previous build
requests in the same test group.
* tools/js/buildbot-triggerable.js:
(BuildbotTriggerable.prototype.syncOnce): Order test groups by groupOrder, which is the index at which first
build request in the group appeared.
(BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Don't re-order build requests
as they're already sorted on the server side.
(BuildbotTriggerable._testGroupMapForBuildRequests): Added groupOrder to test group info </pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv3modelsbuildrequestjs">trunk/Websites/perf.webkit.org/public/v3/models/build-request.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapibuildrequeststestsjs">trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsresourcesmockdatajs">trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgserverteststoolsbuildbottriggerabletestsjs">trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgtoolsjsbuildbottriggerablejs">trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsitesperfwebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/ChangeLog (199331 => 199332)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2016-04-12 03:07:18 UTC (rev 199331)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2016-04-12 03:18:16 UTC (rev 199332)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-04-11 Ryosuke Niwa <rniwa@webkit.org>
+
+ New syncing script sometimes schedules a build request on a wrong builder
+ https://bugs.webkit.org/show_bug.cgi?id=156489
+
+ Reviewed by Stephanie Lewis.
+
+ The bug was caused by _scheduleNextRequestInGroupIfSlaveIsAvailable scheduling the next build request on
+ any available syncer regardless of whether the request is the first one in the test group or not because
+ BuildRequest.order was returning a string instead of a number.
+
+ Also fixed a bug that BuildbotTriggerable.syncOnce was re-ordering test groups by their id's instead of
+ respecting the order in which the perf dashboard returned.
+
+ * public/v3/models/build-request.js:
+ (BuildRequest.prototype.order): Force the order to be a number.
+ * server-tests/api-build-requests-tests.js: Assert the order as numbers.
+ * server-tests/resources/mock-data.js:
+ (MockData.addAnotherMockTestGroup): Changed the test group id to 601, which is after the first mock data.
+ The old number was masking a bug in BuildbotTriggerable that it was re-ordering test groups by their id's
+ instead of using the order set forth by the perf dashboard.
+ (MockData.mockTestSyncConfigWithSingleBuilder):
+ * server-tests/tools-buildbot-triggerable-tests.js: Added a test case for scheduling two build requests in
+ a single call to syncOnce. Each build request should be scheduled on the same builder as the previous build
+ requests in the same test group.
+ * tools/js/buildbot-triggerable.js:
+ (BuildbotTriggerable.prototype.syncOnce): Order test groups by groupOrder, which is the index at which first
+ build request in the group appeared.
+ (BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Don't re-order build requests
+ as they're already sorted on the server side.
+ (BuildbotTriggerable._testGroupMapForBuildRequests): Added groupOrder to test group info
+
</ins><span class="cx"> 2016-04-09 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Build fix. Don't treat a build number 0 as a pending build.
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv3modelsbuildrequestjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v3/models/build-request.js (199331 => 199332)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v3/models/build-request.js        2016-04-12 03:07:18 UTC (rev 199331)
+++ trunk/Websites/perf.webkit.org/public/v3/models/build-request.js        2016-04-12 03:18:16 UTC (rev 199332)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> testGroup() { return this._testGroup; }
</span><span class="cx"> platform() { return this._platform; }
</span><span class="cx"> test() { return this._test; }
</span><del>- order() { return this._order; }
</del><ins>+ order() { return +this._order; }
</ins><span class="cx"> rootSet() { return this._rootSet; }
</span><span class="cx">
</span><span class="cx"> status() { return this._status; }
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapibuildrequeststestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js (199331 => 199332)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js        2016-04-12 03:07:18 UTC (rev 199331)
+++ trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js        2016-04-12 03:18:16 UTC (rev 199332)
</span><span class="lines">@@ -338,21 +338,29 @@
</span><span class="cx"> assert.equal(buildRequests.length, 8);
</span><span class="cx"> assert.equal(buildRequests[0].id(), 700);
</span><span class="cx"> assert.equal(buildRequests[0].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[0].order(), 0);
</ins><span class="cx"> assert.equal(buildRequests[1].id(), 701);
</span><span class="cx"> assert.equal(buildRequests[1].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[1].order(), 1);
</ins><span class="cx"> assert.equal(buildRequests[2].id(), 702);
</span><span class="cx"> assert.equal(buildRequests[2].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[2].order(), 2);
</ins><span class="cx"> assert.equal(buildRequests[3].id(), 703);
</span><span class="cx"> assert.equal(buildRequests[3].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[3].order(), 3);
</ins><span class="cx">
</span><span class="cx"> assert.equal(buildRequests[4].id(), 710);
</span><del>- assert.equal(buildRequests[4].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[4].testGroupId(), 601);
+ assert.strictEqual(buildRequests[4].order(), 0);
</ins><span class="cx"> assert.equal(buildRequests[5].id(), 711);
</span><del>- assert.equal(buildRequests[5].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[5].testGroupId(), 601);
+ assert.strictEqual(buildRequests[5].order(), 1);
</ins><span class="cx"> assert.equal(buildRequests[6].id(), 712);
</span><del>- assert.equal(buildRequests[6].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[6].testGroupId(), 601);
+ assert.strictEqual(buildRequests[6].order(), 2);
</ins><span class="cx"> assert.equal(buildRequests[7].id(), 713);
</span><del>- assert.equal(buildRequests[7].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[7].testGroupId(), 601);
+ assert.strictEqual(buildRequests[7].order(), 3);
</ins><span class="cx"> done();
</span><span class="cx"> }).catch(done);
</span><span class="cx"> });
</span><span class="lines">@@ -368,22 +376,30 @@
</span><span class="cx"> }).then(function (buildRequests) {
</span><span class="cx"> assert.equal(buildRequests.length, 8);
</span><span class="cx"> assert.equal(buildRequests[0].id(), 710);
</span><del>- assert.equal(buildRequests[0].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[0].testGroupId(), 601);
+ assert.strictEqual(buildRequests[0].order(), 0);
</ins><span class="cx"> assert.equal(buildRequests[1].id(), 711);
</span><del>- assert.equal(buildRequests[1].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[1].testGroupId(), 601);
+ assert.strictEqual(buildRequests[1].order(), 1);
</ins><span class="cx"> assert.equal(buildRequests[2].id(), 712);
</span><del>- assert.equal(buildRequests[2].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[2].testGroupId(), 601);
+ assert.strictEqual(buildRequests[2].order(), 2);
</ins><span class="cx"> assert.equal(buildRequests[3].id(), 713);
</span><del>- assert.equal(buildRequests[3].testGroupId(), 599);
</del><ins>+ assert.equal(buildRequests[3].testGroupId(), 601);
+ assert.strictEqual(buildRequests[3].order(), 3);
</ins><span class="cx">
</span><span class="cx"> assert.equal(buildRequests[4].id(), 700);
</span><span class="cx"> assert.equal(buildRequests[4].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[4].order(), 0);
</ins><span class="cx"> assert.equal(buildRequests[5].id(), 701);
</span><span class="cx"> assert.equal(buildRequests[5].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[5].order(), 1);
</ins><span class="cx"> assert.equal(buildRequests[6].id(), 702);
</span><span class="cx"> assert.equal(buildRequests[6].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[6].order(), 2);
</ins><span class="cx"> assert.equal(buildRequests[7].id(), 703);
</span><span class="cx"> assert.equal(buildRequests[7].testGroupId(), 600);
</span><ins>+ assert.strictEqual(buildRequests[7].order(), 3);
</ins><span class="cx"> done();
</span><span class="cx"> }).catch(done);
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsresourcesmockdatajs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js (199331 => 199332)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js        2016-04-12 03:07:18 UTC (rev 199331)
+++ trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js        2016-04-12 03:18:16 UTC (rev 199332)
</span><span class="lines">@@ -51,11 +51,11 @@
</span><span class="cx"> if (!statusList)
</span><span class="cx"> statusList = ['pending', 'pending', 'pending', 'pending'];
</span><span class="cx"> return Promise.all([
</span><del>- db.insert('analysis_test_groups', {id: 599, task: 500, name: 'another test group', author: author}),
- db.insert('build_requests', {id: 713, status: statusList[3], triggerable: 1, platform: 65, test: 200, group: 599, order: 3, root_set: 402}),
- db.insert('build_requests', {id: 710, status: statusList[0], triggerable: 1, platform: 65, test: 200, group: 599, order: 0, root_set: 401}),
- db.insert('build_requests', {id: 712, status: statusList[2], triggerable: 1, platform: 65, test: 200, group: 599, order: 2, root_set: 401}),
- db.insert('build_requests', {id: 711, status: statusList[1], triggerable: 1, platform: 65, test: 200, group: 599, order: 1, root_set: 402}),
</del><ins>+ db.insert('analysis_test_groups', {id: 601, task: 500, name: 'another test group', author: author}),
+ db.insert('build_requests', {id: 713, status: statusList[3], triggerable: 1, platform: 65, test: 200, group: 601, order: 3, root_set: 402}),
+ db.insert('build_requests', {id: 710, status: statusList[0], triggerable: 1, platform: 65, test: 200, group: 601, order: 0, root_set: 401}),
+ db.insert('build_requests', {id: 712, status: statusList[2], triggerable: 1, platform: 65, test: 200, group: 601, order: 2, root_set: 401}),
+ db.insert('build_requests', {id: 711, status: statusList[1], triggerable: 1, platform: 65, test: 200, group: 601, order: 1, root_set: 402}),
</ins><span class="cx"> ]);
</span><span class="cx"> },
</span><span class="cx"> mockTestSyncConfigWithSingleBuilder: function ()
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgserverteststoolsbuildbottriggerabletestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js (199331 => 199332)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js        2016-04-12 03:07:18 UTC (rev 199331)
+++ trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js        2016-04-12 03:18:16 UTC (rev 199332)
</span><span class="lines">@@ -545,6 +545,112 @@
</span><span class="cx"> }).catch(done);
</span><span class="cx"> });
</span><span class="cx">
</span><ins>+ it('should schedule a build request on the same scheduler the first request had ran', function (done) {
+ let db = TestServer.database();
+ let syncPromise;
+ db.connect().then(function () {
+ return Promise.all([
+ MockData.addMockData(db, ['running', 'pending', 'pending', 'pending']),
+ MockData.addAnotherMockTestGroup(db, ['running', 'pending', 'pending', 'pending'])
+ ]);
+ }).then(function () {
+ return Manifest.fetch();
+ }).then(function () {
+ let config = MockData.mockTestSyncConfigWithTwoBuilders();
+ let logger = new MockLogger;
+ let slaveInfo = {name: 'sync-slave', password: 'password'};
+ let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
+ syncPromise = triggerable.syncOnce();
+ syncPromise.catch(done);
+ return MockRemoteAPI.waitForRequest();
+ }).then(function () {
+ assert.equal(MockRemoteAPI.requests.length, 2);
+ assert.equal(MockRemoteAPI.requests[0].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
+ MockRemoteAPI.requests[0].resolve([]);
+ assert.equal(MockRemoteAPI.requests[1].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some%20builder%202/pendingBuilds');
+ MockRemoteAPI.requests[1].resolve([]);
+ return MockRemoteAPI.waitForRequest();
+ }).then(function () {
+ assert.equal(MockRemoteAPI.requests.length, 4);
+ assert.equal(MockRemoteAPI.requests[2].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/builds/?select=-1&select=-2');
+ MockRemoteAPI.requests[2].resolve({[-1]: MockData.runningBuild({buildRequestId: 710})});
+ assert.equal(MockRemoteAPI.requests[3].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some%20builder%202/builds/?select=-1&select=-2');
+ MockRemoteAPI.requests[3].resolve({[-1]: MockData.runningBuild({builder: 'some builder 2', buildRequestId: 700})});
+ return MockRemoteAPI.waitForRequest();
+ }).then(function () {
+ assert.equal(MockRemoteAPI.requests.length, 6);
+ assert.equal(MockRemoteAPI.requests[4].method, 'POST');
+ assert.equal(MockRemoteAPI.requests[4].url, '/builders/some%20builder%202/force');
+ assert.deepEqual(MockRemoteAPI.requests[4].data, {'wk': '192736', 'os': '10.11 15A284', 'build-request-id': '701'});
+ MockRemoteAPI.requests[4].resolve('OK');
+ assert.equal(MockRemoteAPI.requests[5].method, 'POST');
+ assert.equal(MockRemoteAPI.requests[5].url, '/builders/some-builder-1/force');
+ assert.deepEqual(MockRemoteAPI.requests[5].data, {'wk': '192736', 'os': '10.11 15A284', 'build-request-id': '711'});
+ MockRemoteAPI.requests[5].resolve('OK');
+ return MockRemoteAPI.waitForRequest();
+ }).then(function () {
+ assert.equal(MockRemoteAPI.requests.length, 8);
+ assert.equal(MockRemoteAPI.requests[6].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[6].url, '/json/builders/some-builder-1/pendingBuilds');
+ MockRemoteAPI.requests[6].resolve([MockData.pendingBuild({buildRequestId: 711})]);
+ assert.equal(MockRemoteAPI.requests[7].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[7].url, '/json/builders/some%20builder%202/pendingBuilds');
+ MockRemoteAPI.requests[7].resolve([MockData.pendingBuild({builder: 'some builder 2',buildRequestId: 701})]);
+ return MockRemoteAPI.waitForRequest();
+ }).then(function () {
+ assert.equal(MockRemoteAPI.requests.length, 10);
+ assert.equal(MockRemoteAPI.requests[8].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[8].url, '/json/builders/some-builder-1/builds/?select=-1&select=-2');
+ MockRemoteAPI.requests[8].resolve({[-1]: MockData.runningBuild({buildRequestId: 710})});
+ assert.equal(MockRemoteAPI.requests[9].method, 'GET');
+ assert.equal(MockRemoteAPI.requests[9].url, '/json/builders/some%20builder%202/builds/?select=-1&select=-2');
+ MockRemoteAPI.requests[9].resolve({[-1]: MockData.runningBuild({builder: 'some builder 2', buildRequestId: 700})});
+ return syncPromise;
+ }).then(function () {
+ assert.equal(BuildRequest.all().length, 8);
+ assert.equal(BuildRequest.findById(700).status(), 'running');
+ assert.equal(BuildRequest.findById(700).statusUrl(), null);
+ assert.equal(BuildRequest.findById(701).status(), 'pending');
+ assert.equal(BuildRequest.findById(701).statusUrl(), null);
+ assert.equal(BuildRequest.findById(702).status(), 'pending');
+ assert.equal(BuildRequest.findById(702).statusUrl(), null);
+ assert.equal(BuildRequest.findById(703).status(), 'pending');
+ assert.equal(BuildRequest.findById(703).statusUrl(), null);
+ assert.equal(BuildRequest.findById(710).status(), 'running');
+ assert.equal(BuildRequest.findById(710).statusUrl(), null);
+ assert.equal(BuildRequest.findById(711).status(), 'pending');
+ assert.equal(BuildRequest.findById(711).statusUrl(), null);
+ assert.equal(BuildRequest.findById(712).status(), 'pending');
+ assert.equal(BuildRequest.findById(712).statusUrl(), null);
+ assert.equal(BuildRequest.findById(713).status(), 'pending');
+ assert.equal(BuildRequest.findById(713).statusUrl(), null);
+ return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
+ }).then(function () {
+ assert.equal(BuildRequest.all().length, 8);
+ assert.equal(BuildRequest.findById(700).status(), 'running');
+ assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some%20builder%202/builds/124');
+ assert.equal(BuildRequest.findById(701).status(), 'scheduled');
+ assert.equal(BuildRequest.findById(701).statusUrl(), 'http://build.webkit.org/builders/some%20builder%202/');
+ assert.equal(BuildRequest.findById(702).status(), 'pending');
+ assert.equal(BuildRequest.findById(702).statusUrl(), null);
+ assert.equal(BuildRequest.findById(703).status(), 'pending');
+ assert.equal(BuildRequest.findById(703).statusUrl(), null);
+ assert.equal(BuildRequest.findById(710).status(), 'running');
+ assert.equal(BuildRequest.findById(710).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/builds/124');
+ assert.equal(BuildRequest.findById(711).status(), 'scheduled');
+ assert.equal(BuildRequest.findById(711).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/');
+ assert.equal(BuildRequest.findById(712).status(), 'pending');
+ assert.equal(BuildRequest.findById(712).statusUrl(), null);
+ assert.equal(BuildRequest.findById(713).status(), 'pending');
+ assert.equal(BuildRequest.findById(713).statusUrl(), null);
+ done();
+ }).catch(done);
+ });
+
</ins><span class="cx"> it('should update the status of a supposedly scheduled build that went missing', function (done) {
</span><span class="cx"> let db = TestServer.database();
</span><span class="cx"> let syncPromise;
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgtoolsjsbuildbottriggerablejs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js (199331 => 199332)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js        2016-04-12 03:07:18 UTC (rev 199331)
+++ trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js        2016-04-12 03:18:16 UTC (rev 199332)
</span><span class="lines">@@ -34,15 +34,14 @@
</span><span class="cx">
</span><span class="cx"> let self = this;
</span><span class="cx"> this._logger.log(`Fetching build requests for ${this._name}...`);
</span><del>- return BuildRequest.fetchForTriggerable(this._name).then(function () {
- let buildRequests = BuildRequest.all();
</del><ins>+ return BuildRequest.fetchForTriggerable(this._name).then(function (buildRequests) {
</ins><span class="cx"> self._validateRequests(buildRequests);
</span><span class="cx"> buildReqeustsByGroup = BuildbotTriggerable._testGroupMapForBuildRequests(buildRequests);
</span><span class="cx"> return self._pullBuildbotOnAllSyncers(buildReqeustsByGroup);
</span><span class="cx"> }).then(function (updates) {
</span><span class="cx"> self._logger.log('Scheduling builds');
</span><span class="cx"> let promistList = [];
</span><del>- let testGroupList = Array.from(buildReqeustsByGroup.values()).sort(function (a, b) { return a.id - b.id; });
</del><ins>+ let testGroupList = Array.from(buildReqeustsByGroup.values()).sort(function (a, b) { return a.groupOrder - b.groupOrder; });
</ins><span class="cx"> for (let group of testGroupList) {
</span><span class="cx"> let promise = self._scheduleNextRequestInGroupIfSlaveIsAvailable(group, updates);
</span><span class="cx"> if (promise)
</span><span class="lines">@@ -121,9 +120,8 @@
</span><span class="cx">
</span><span class="cx"> _scheduleNextRequestInGroupIfSlaveIsAvailable(groupInfo, pendingUpdates)
</span><span class="cx"> {
</span><del>- let orderedRequests = groupInfo.requests.sort(function (a, b) { return a.order() - b.order(); });
</del><span class="cx"> let nextRequest = null;
</span><del>- for (let request of orderedRequests) {
</del><ins>+ for (let request of groupInfo.requests) {
</ins><span class="cx"> if (request.isScheduled() || (request.id() in pendingUpdates && pendingUpdates[request.id()]['status'] == 'scheduled'))
</span><span class="cx"> break;
</span><span class="cx"> if (request.isPending() && !(request.id() in pendingUpdates)) {
</span><span class="lines">@@ -134,10 +132,9 @@
</span><span class="cx"> if (!nextRequest)
</span><span class="cx"> return null;
</span><span class="cx">
</span><del>- let firstRequest = !nextRequest.order();
- if (firstRequest) {
</del><ins>+ if (!!nextRequest.order()) {
</ins><span class="cx"> this._logger.log(`Scheduling build request ${nextRequest.id()} on ${groupInfo.slaveName} in ${groupInfo.syncer.builderName()}`);
</span><del>- return groupInfo.syncer.scheduleRequest(request, groupInfo.slaveName);
</del><ins>+ return groupInfo.syncer.scheduleRequest(nextRequest, groupInfo.slaveName);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (let syncer of this._syncers) {
</span><span class="lines">@@ -154,10 +151,11 @@
</span><span class="cx"> static _testGroupMapForBuildRequests(buildRequests)
</span><span class="cx"> {
</span><span class="cx"> let map = new Map;
</span><ins>+ let groupOrder = 0;
</ins><span class="cx"> for (let request of buildRequests) {
</span><span class="cx"> let groupId = request.testGroupId();
</span><span class="cx"> if (!map.has(groupId)) // Don't use real TestGroup objects to avoid executing postgres query in the server
</span><del>- map.set(groupId, {id: groupId, requests: [request], syncer: null, slaveName: null});
</del><ins>+ map.set(groupId, {id: groupId, groupOrder: groupOrder++, requests: [request], syncer: null, slaveName: null});
</ins><span class="cx"> else
</span><span class="cx"> map.get(groupId).requests.push(request);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>