Title: [90165] trunk/Tools
Revision
90165
Author
[email protected]
Date
2011-06-30 14:49:42 -0700 (Thu, 30 Jun 2011)

Log Message

Make TestFaiulres only load old-results directories as needed

Fixes <http://webkit.org/b/63752> Tester pages on TestFailures page load very slowly

Reviewed by Anders Carlsson.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js:
(Builder.prototype.getBuildNames): Moved up into the API section of the class. Now just
calls through to _getBuildNamesFromResultsDirectory.
(Builder.prototype.getOldBuildNames): Added. Just calls through to
_getBuildNamesFromResultsDirectory.
(Builder.prototype._getBuildNamesFromResultsDirectory): Renamed from getBuildNames. Now
takes the directory URL as an argument and only fetches that single URL.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js:
(LayoutTestHistoryAnalyzer.prototype.start): Moved most logic to _analyzeBuilds. First
analyzes builds from Builder.getBuildNames, then from Builder.getOldBuildNames if needed.
(LayoutTestHistoryAnalyzer.prototype._analyzeBuilds): Moved logic here from start. (Most
changes are just indentation.) Now takes a callback to call when we've finished analyzing
all builds in buildNames so that we can try to fetch more build names if needed.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js (90164 => 90165)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js	2011-06-30 21:46:50 UTC (rev 90164)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js	2011-06-30 21:49:42 UTC (rev 90165)
@@ -57,6 +57,10 @@
         return diagnosticInfo[testResult.failureType];
     },
 
+    getBuildNames: function(callback) {
+        this._getBuildNamesFromResultsDirectory(this.buildbot.baseURL + 'results/' + this.name, callback);
+    },
+
     getMostRecentCompletedBuildNumber: function(callback) {
         var cacheKey = 'getMostRecentCompletedBuildNumber';
         if (cacheKey in this._cache) {
@@ -146,6 +150,10 @@
         });
     },
 
+    getOldBuildNames: function(callback) {
+        this._getBuildNamesFromResultsDirectory(this.buildbot.baseURL + 'old-results/' + this.name, callback);
+    },
+
     resultsDirectoryURL: function(buildName) {
         return this.buildbot.resultsDirectoryURL(this.name, buildName);
     },
@@ -169,8 +177,8 @@
         });
     },
 
-    getBuildNames: function(callback) {
-        var cacheKey = '_getBuildNames';
+    _getBuildNamesFromResultsDirectory: function(directoryURL, callback) {
+        var cacheKey = '_getBuildNamesFromResultsDirectory.' + directoryURL;
         if (cacheKey in this._cache) {
             callback(this._cache[cacheKey]);
             return;
@@ -192,13 +200,10 @@
             return buildNames;
         }
 
-        getResource(self.buildbot.baseURL + 'results/' + self.name, function(xhr) {
-            // FIXME: It would be better for performance if we could avoid loading old-results until needed.
-            getResource(self.buildbot.baseURL + 'old-results/' + self.name, function(oldXHR) {
-                var buildNames = buildNamesFromDirectoryXHR(xhr).concat(buildNamesFromDirectoryXHR(oldXHR));
-                self._cache[cacheKey] = buildNames;
-                callback(buildNames);
-            });
+        getResource(directoryURL, function(xhr) {
+            var buildNames = buildNamesFromDirectoryXHR(xhr);
+            self._cache[cacheKey] = buildNames;
+            callback(buildNames);
         });
     },
 };

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js (90164 => 90165)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js	2011-06-30 21:46:50 UTC (rev 90164)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js	2011-06-30 21:49:42 UTC (rev 90165)
@@ -69,28 +69,46 @@
     start: function(callback) {
         var self = this;
         self._builder.getBuildNames(function(buildNames) {
-            function inner(buildIndex) {
-                self._incorporateBuildHistory(buildNames, buildIndex, function(callAgain) {
-                    var nextIndex = buildIndex + 1;
-                    if (nextIndex >= buildNames.length)
-                        callAgain = false;
-                    var data = {
-                        history: self._history,
-                        possiblyFlaky: {},
-                    };
-                    self._flakinessDetector.possiblyFlakyTests.forEach(function(testName) {
-                        data.possiblyFlaky[testName] = self._flakinessDetector.flakinessExamples(testName);
-                    });
-                    var callbackRequestedStop = !callback(data, callAgain);
-                    if (callbackRequestedStop || !callAgain)
-                        return;
-                    setTimeout(function() { inner(nextIndex) }, 0);
+            self._analyzeBuilds(buildNames, callback, function() {
+                self._builder.getOldBuildNames(function(oldBuildNames) {
+                    self._analyzeBuilds(oldBuildNames, callback);
                 });
-            }
-            inner(0);
+            });
         });
     },
 
+    _analyzeBuilds: function(buildNames, callback, analyzedAllBuildsCallback) {
+        var self = this;
+        function inner(buildIndex) {
+            self._incorporateBuildHistory(buildNames, buildIndex, function(callAgain) {
+                var data = {
+                    history: self._history,
+                    possiblyFlaky: {},
+                };
+                self._flakinessDetector.possiblyFlakyTests.forEach(function(testName) {
+                    data.possiblyFlaky[testName] = self._flakinessDetector.flakinessExamples(testName);
+                });
+
+                var nextIndex = buildIndex + 1;
+                var analyzedAllBuilds = nextIndex >= buildNames.length;
+                var haveMoreDataToFetch = !analyzedAllBuilds || analyzedAllBuildsCallback;
+
+                var callbackRequestedStop = !callback(data, haveMoreDataToFetch);
+                if (callbackRequestedStop)
+                    return;
+
+                if (analyzedAllBuilds) {
+                    if (analyzedAllBuildsCallback)
+                        analyzedAllBuildsCallback();
+                    return;
+                }
+
+                setTimeout(function() { inner(nextIndex) }, 0);
+            });
+        }
+        inner(0);
+    },
+
     _incorporateBuildHistory: function(buildNames, buildIndex, callback) {
         var previousBuildName = Object.keys(this._history).last();
         var nextBuildName = buildNames[buildIndex];

Modified: trunk/Tools/ChangeLog (90164 => 90165)


--- trunk/Tools/ChangeLog	2011-06-30 21:46:50 UTC (rev 90164)
+++ trunk/Tools/ChangeLog	2011-06-30 21:49:42 UTC (rev 90165)
@@ -1,3 +1,26 @@
+2011-06-30  Adam Roben  <[email protected]>
+
+        Make TestFaiulres only load old-results directories as needed
+
+        Fixes <http://webkit.org/b/63752> Tester pages on TestFailures page load very slowly
+
+        Reviewed by Anders Carlsson.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js:
+        (Builder.prototype.getBuildNames): Moved up into the API section of the class. Now just
+        calls through to _getBuildNamesFromResultsDirectory.
+        (Builder.prototype.getOldBuildNames): Added. Just calls through to
+        _getBuildNamesFromResultsDirectory.
+        (Builder.prototype._getBuildNamesFromResultsDirectory): Renamed from getBuildNames. Now
+        takes the directory URL as an argument and only fetches that single URL.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js:
+        (LayoutTestHistoryAnalyzer.prototype.start): Moved most logic to _analyzeBuilds. First
+        analyzes builds from Builder.getBuildNames, then from Builder.getOldBuildNames if needed.
+        (LayoutTestHistoryAnalyzer.prototype._analyzeBuilds): Moved logic here from start. (Most
+        changes are just indentation.) Now takes a callback to call when we've finished analyzing
+        all builds in buildNames so that we can try to fetch more build names if needed.
+
 2011-06-30  Mark Rowe  <[email protected]>
 
         Reviewed by Anders Carlsson.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to